Required role: | VeoliaAdmin |
GET | /contractversion/{contractversionid} |
---|
import Foundation
import ServiceStack
public class BrowseContractVersionByVeoliaAdmin : IGet, Codable
{
public var contractVersionId:Int
required public init(){}
}
public class BrowseContractVersionByVeoliaAdminResponse : ResponseBase
{
public var contractVersion:ContractVersionDetailsExtended
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case contractVersion
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
contractVersion = try container.decodeIfPresent(ContractVersionDetailsExtended.self, forKey: .contractVersion)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if contractVersion != nil { try container.encode(contractVersion, forKey: .contractVersion) }
}
}
public class ResponseBase : Codable
{
public var responseStatus:ResponseStatus
required public init(){}
}
public class ContractVersionDetailsExtended : ContractVersionDetails
{
public var tenderId:Int?
public var userId:Int?
public var tenderUserId:Int?
public var supplierUserId:Int
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case tenderId
case userId
case tenderUserId
case supplierUserId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
tenderId = try container.decodeIfPresent(Int.self, forKey: .tenderId)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
tenderUserId = try container.decodeIfPresent(Int.self, forKey: .tenderUserId)
supplierUserId = try container.decodeIfPresent(Int.self, forKey: .supplierUserId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if tenderId != nil { try container.encode(tenderId, forKey: .tenderId) }
if userId != nil { try container.encode(userId, forKey: .userId) }
if tenderUserId != nil { try container.encode(tenderUserId, forKey: .tenderUserId) }
if supplierUserId != nil { try container.encode(supplierUserId, forKey: .supplierUserId) }
}
}
public class ContractVersionDetails : ContractVersionSimple
{
public var meta:[String:String] = [:]
public var viewingDateTime:Date?
public var reviewingDateTime:Date?
public var contractFiles:[ContractFileSimple] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case meta
case viewingDateTime
case reviewingDateTime
case contractFiles
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
meta = try container.decodeIfPresent([String:String].self, forKey: .meta) ?? [:]
viewingDateTime = try container.decodeIfPresent(Date.self, forKey: .viewingDateTime)
reviewingDateTime = try container.decodeIfPresent(Date.self, forKey: .reviewingDateTime)
contractFiles = try container.decodeIfPresent([ContractFileSimple].self, forKey: .contractFiles) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if meta.count > 0 { try container.encode(meta, forKey: .meta) }
if viewingDateTime != nil { try container.encode(viewingDateTime, forKey: .viewingDateTime) }
if reviewingDateTime != nil { try container.encode(reviewingDateTime, forKey: .reviewingDateTime) }
if contractFiles.count > 0 { try container.encode(contractFiles, forKey: .contractFiles) }
}
}
public class ContractVersionSimple : Codable
{
public var id:Int
public var contractId:Int
public var version:Int
public var isViewed:Bool
public var status:ReviewStatus
required public init(){}
}
public enum ReviewStatus : Int, Codable
{
case Draft = 0
case Commented = 1
case Accepted = 2
}
public class ContractFileSimple : BrowseFileResponseBase
{
public var contractVersionId:Int
public var documentType:ContractDocumentType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case contractVersionId
case documentType
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
contractVersionId = try container.decodeIfPresent(Int.self, forKey: .contractVersionId)
documentType = try container.decodeIfPresent(ContractDocumentType.self, forKey: .documentType)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if contractVersionId != nil { try container.encode(contractVersionId, forKey: .contractVersionId) }
if documentType != nil { try container.encode(documentType, forKey: .documentType) }
}
}
public class BrowseFileResponseBase : Codable
{
public var id:Int
public var fileContentId:Int
public var fileName:String
public var size:Int
required public init(){}
}
public enum ContractDocumentType : Int, Codable
{
case Draft = 0
case Comment = 1
}
Swift BrowseContractVersionByVeoliaAdmin DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /contractversion/{contractversionid} HTTP/1.1 Host: szallitoiportal-be.veolia.hu Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <BrowseContractVersionByVeoliaAdminResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Portal.ServiceDto"> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> <ContractVersion> <ContractId>0</ContractId> <Id>0</Id> <IsViewed>false</IsViewed> <Status>Draft</Status> <Version>0</Version> <ContractFiles> <ContractFileSimple> <FileContentId>0</FileContentId> <FileName>String</FileName> <Id>0</Id> <Size>0</Size> <ContractVersionId>0</ContractVersionId> <DocumentType>Draft</DocumentType> </ContractFileSimple> </ContractFiles> <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </Meta> <ReviewingDateTime>0001-01-01T00:00:00</ReviewingDateTime> <ViewingDateTime>0001-01-01T00:00:00</ViewingDateTime> <SupplierUserId>0</SupplierUserId> <TenderId>0</TenderId> <TenderUserId>0</TenderUserId> <UserId>0</UserId> </ContractVersion> </BrowseContractVersionByVeoliaAdminResponse>