tvpl.api

<back to all web services

SearchTemplateRequest

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

public class SearchTemplateRequest : PagingRequest
{
    public var title:String
    public var isActive:Bool?

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

    private enum CodingKeys : String, CodingKey {
        case title
        case isActive
    }

    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)
        isActive = try container.decodeIfPresent(Bool.self, forKey: .isActive)
    }

    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 isActive != nil { try container.encode(isActive, forKey: .isActive) }
    }
}

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

    required public init(){}
}

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

    required public init(){}
}

public class DocumentTemplate : Codable
{
    public var id:Int
    // @Required()
    public var title:String?

    public var Description:String
    public var isActive:Bool
    public var fileKey:String
    public var fileUrl:String
    public var fileName:String
    public var fileSize:Int?

    required public init(){}
}


Swift SearchTemplateRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

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

{"code":0,"message":"String","data":[{"id":0,"title":"String","description":"String","isActive":false,"fileKey":"String","fileUrl":"String","fileName":"String","fileSize":0}],"totalCount":0}