| GET | /workflow/search |
|---|
import Foundation
import ServiceStack
public class SearchWorkflowRequest : PagingRequest
{
public var keyword:String
public var isInstance:Bool?
public var isActive:Bool?
public var documentTypeId:Int?
public var mainId:Int?
public var accountId:Int?
public var departmentId:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case keyword
case isInstance
case isActive
case documentTypeId
case mainId
case accountId
case departmentId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
keyword = try container.decodeIfPresent(String.self, forKey: .keyword)
isInstance = try container.decodeIfPresent(Bool.self, forKey: .isInstance)
isActive = try container.decodeIfPresent(Bool.self, forKey: .isActive)
documentTypeId = try container.decodeIfPresent(Int.self, forKey: .documentTypeId)
mainId = try container.decodeIfPresent(Int.self, forKey: .mainId)
accountId = try container.decodeIfPresent(Int.self, forKey: .accountId)
departmentId = try container.decodeIfPresent(Int.self, forKey: .departmentId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if keyword != nil { try container.encode(keyword, forKey: .keyword) }
if isInstance != nil { try container.encode(isInstance, forKey: .isInstance) }
if isActive != nil { try container.encode(isActive, forKey: .isActive) }
if documentTypeId != nil { try container.encode(documentTypeId, forKey: .documentTypeId) }
if mainId != nil { try container.encode(mainId, forKey: .mainId) }
if accountId != nil { try container.encode(accountId, forKey: .accountId) }
if departmentId != nil { try container.encode(departmentId, forKey: .departmentId) }
}
}
public class PagingRequest : Codable
{
public var page:Int
public var limit:Int
required public init(){}
}
public class PageResponse<AuditLog : Codable> : IResponseRequest, Codable
{
public var code:Int
public var message:String
public var data:[AuditLog] = []
public var pagination:Pagination
required public init(){}
}
public class AuditLog : MongoObject, IEntityId, ICreated, IUpdate
{
public var userName:String
public var userId:Int?
public var documentId:Int
public var action:String
public var Description:String
public var createdDate:Date
public var updatedDate:Date
public var ipAddress:String
public var userAgent:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case userName
case userId
case documentId
case action
case Description
case createdDate
case updatedDate
case ipAddress
case userAgent
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
userName = try container.decodeIfPresent(String.self, forKey: .userName)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
documentId = try container.decodeIfPresent(Int.self, forKey: .documentId)
action = try container.decodeIfPresent(String.self, forKey: .action)
Description = try container.decodeIfPresent(String.self, forKey: .Description)
createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate)
updatedDate = try container.decodeIfPresent(Date.self, forKey: .updatedDate)
ipAddress = try container.decodeIfPresent(String.self, forKey: .ipAddress)
userAgent = try container.decodeIfPresent(String.self, forKey: .userAgent)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if userName != nil { try container.encode(userName, forKey: .userName) }
if userId != nil { try container.encode(userId, forKey: .userId) }
if documentId != nil { try container.encode(documentId, forKey: .documentId) }
if action != nil { try container.encode(action, forKey: .action) }
if Description != nil { try container.encode(Description, forKey: .Description) }
if createdDate != nil { try container.encode(createdDate, forKey: .createdDate) }
if updatedDate != nil { try container.encode(updatedDate, forKey: .updatedDate) }
if ipAddress != nil { try container.encode(ipAddress, forKey: .ipAddress) }
if userAgent != nil { try container.encode(userAgent, forKey: .userAgent) }
}
}
public class MongoObject : IMongoModel, Codable
{
public var id:String
required public init(){}
}
public class Pagination : Codable
{
public var total:Int
public var pages:Int
public var offset:Int
public var limit:Int
public var currentPage:Int
required public init(){}
}
Swift SearchWorkflowRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /workflow/search HTTP/1.1 Host: qlcn-api.vsmlab.vn Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"code":0,"message":"String","data":[{"id":0,"title":"String","description":"String","documentCode":"String","documentTypeId":0,"isInstance":false,"mainId":0,"isActive":false,"statusId":0,"accountId":0,"departmentId":0,"scopeType":2,"createdBy":"String","createdAt":"0001-01-01T00:00:00.0000000+07:06","updatedBy":"String","updatedAt":"0001-01-01T00:00:00.0000000+07:06"}],"pagination":null}