Portal

<back to all web services

BrowsePurchaseOrder

The following routes are available for this service:
GET/user/{supplieruserid}/purchaseorder/{purchaseorderid}
import Foundation
import ServiceStack

public class BrowsePurchaseOrder : PurchaseOrderBase, IGet
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class PurchaseOrderBase : Codable
{
    public var purchaseOrderId:Int
    public var supplierUserId:Int

    required public init(){}
}

public class BrowsePurchaseOrderResponse : ResponseBase
{
    public var purchaseOrder:PurchaseOrderDetails

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

    private enum CodingKeys : String, CodingKey {
        case purchaseOrder
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        purchaseOrder = try container.decodeIfPresent(PurchaseOrderDetails.self, forKey: .purchaseOrder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if purchaseOrder != nil { try container.encode(purchaseOrder, forKey: .purchaseOrder) }
    }
}

public class ResponseBase : Codable
{
    public var responseStatus:ResponseStatus

    required public init(){}
}

public class PurchaseOrderDetails : ModifyPurchaseOrderBase
{
    public var id:Int
    public var cancellationDateTime:Date?
    public var isCancelled:Bool
    public var meta:[String:String] = [:]
    public var tenderUserId:Int?
    public var tenderId:Int?
    public var userId:Int?
    public var purchaseOrderVersions:[PurchaseOrderVersionSimple] = []

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

    private enum CodingKeys : String, CodingKey {
        case id
        case cancellationDateTime
        case isCancelled
        case meta
        case tenderUserId
        case tenderId
        case userId
        case purchaseOrderVersions
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        cancellationDateTime = try container.decodeIfPresent(Date.self, forKey: .cancellationDateTime)
        isCancelled = try container.decodeIfPresent(Bool.self, forKey: .isCancelled)
        meta = try container.decodeIfPresent([String:String].self, forKey: .meta) ?? [:]
        tenderUserId = try container.decodeIfPresent(Int.self, forKey: .tenderUserId)
        tenderId = try container.decodeIfPresent(Int.self, forKey: .tenderId)
        userId = try container.decodeIfPresent(Int.self, forKey: .userId)
        purchaseOrderVersions = try container.decodeIfPresent([PurchaseOrderVersionSimple].self, forKey: .purchaseOrderVersions) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if cancellationDateTime != nil { try container.encode(cancellationDateTime, forKey: .cancellationDateTime) }
        if isCancelled != nil { try container.encode(isCancelled, forKey: .isCancelled) }
        if meta.count > 0 { try container.encode(meta, forKey: .meta) }
        if tenderUserId != nil { try container.encode(tenderUserId, forKey: .tenderUserId) }
        if tenderId != nil { try container.encode(tenderId, forKey: .tenderId) }
        if userId != nil { try container.encode(userId, forKey: .userId) }
        if purchaseOrderVersions.count > 0 { try container.encode(purchaseOrderVersions, forKey: .purchaseOrderVersions) }
    }
}

public class ModifyPurchaseOrderBase : ModifyRequestBase
{
    public var purchaseOrderIdentifier:String
    public var tenderUserId:Int?
    public var supplierUserId:Int
    public var buyer:String
    public var subject:String
    public var confirmationDeadline:Date

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

    private enum CodingKeys : String, CodingKey {
        case purchaseOrderIdentifier
        case tenderUserId
        case supplierUserId
        case buyer
        case subject
        case confirmationDeadline
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        purchaseOrderIdentifier = try container.decodeIfPresent(String.self, forKey: .purchaseOrderIdentifier)
        tenderUserId = try container.decodeIfPresent(Int.self, forKey: .tenderUserId)
        supplierUserId = try container.decodeIfPresent(Int.self, forKey: .supplierUserId)
        buyer = try container.decodeIfPresent(String.self, forKey: .buyer)
        subject = try container.decodeIfPresent(String.self, forKey: .subject)
        confirmationDeadline = try container.decodeIfPresent(Date.self, forKey: .confirmationDeadline)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if purchaseOrderIdentifier != nil { try container.encode(purchaseOrderIdentifier, forKey: .purchaseOrderIdentifier) }
        if tenderUserId != nil { try container.encode(tenderUserId, forKey: .tenderUserId) }
        if supplierUserId != nil { try container.encode(supplierUserId, forKey: .supplierUserId) }
        if buyer != nil { try container.encode(buyer, forKey: .buyer) }
        if subject != nil { try container.encode(subject, forKey: .subject) }
        if confirmationDeadline != nil { try container.encode(confirmationDeadline, forKey: .confirmationDeadline) }
    }
}

public class ModifyRequestBase : IConcurrencyStamp, Codable
{
    public var concurrencyStamp:String

    required public init(){}
}

public class PurchaseOrderVersionSimple : Codable
{
    public var id:Int
    public var purchaseOrderId:Int
    public var supplierUserId: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
}


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

GET /user/{supplieruserid}/purchaseorder/{purchaseorderid} HTTP/1.1 
Host: szallitoiportal-be.veolia.hu 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<BrowsePurchaseOrderResponse 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>
  <PurchaseOrder>
    <ConcurrencyStamp>String</ConcurrencyStamp>
    <Buyer>String</Buyer>
    <ConfirmationDeadline>0001-01-01T00:00:00</ConfirmationDeadline>
    <PurchaseOrderIdentifier>String</PurchaseOrderIdentifier>
    <Subject>String</Subject>
    <SupplierUserId>0</SupplierUserId>
    <TenderUserId i:nil="true" />
    <CancellationDateTime>0001-01-01T00:00:00</CancellationDateTime>
    <Id>0</Id>
    <IsCancelled>false</IsCancelled>
    <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>
    <PurchaseOrderVersions>
      <PurchaseOrderVersionSimple>
        <Id>0</Id>
        <IsViewed>false</IsViewed>
        <PurchaseOrderId>0</PurchaseOrderId>
        <Status>Draft</Status>
        <SupplierUserId>0</SupplierUserId>
        <Version>0</Version>
      </PurchaseOrderVersionSimple>
    </PurchaseOrderVersions>
    <TenderId>0</TenderId>
    <TenderUserId>0</TenderUserId>
    <UserId>0</UserId>
  </PurchaseOrder>
</BrowsePurchaseOrderResponse>