Portal

<back to all web services

EditSupplier

The following routes are available for this service:
PUT/supplier/{supplierid}
import Foundation
import ServiceStack

public class EditSupplier : SupplierBase, IPut
{
    public var supplierId:Int

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

    private enum CodingKeys : String, CodingKey {
        case supplierId
    }

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

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

public class SupplierBase : ModifyRequestBase
{
    public var vatNumber:String
    public var euTaxNumber:String
    public var groupTaxNumber:String
    public var businessType:Int
    public var countryId:Int
    public var name:String
    public var shortName:String
    public var registrationNumber:String
    public var establishedDate:Date
    public var registrationDate:Date
    public var duns:String
    public var operatingLicenseNumber:String
    public var isAccounting:Bool
    public var isSmallTaxPayer:Bool
    public var email:String
    public var phoneNumber:String
    public var website:String

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

    private enum CodingKeys : String, CodingKey {
        case vatNumber
        case euTaxNumber
        case groupTaxNumber
        case businessType
        case countryId
        case name
        case shortName
        case registrationNumber
        case establishedDate
        case registrationDate
        case duns
        case operatingLicenseNumber
        case isAccounting
        case isSmallTaxPayer
        case email
        case phoneNumber
        case website
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        vatNumber = try container.decodeIfPresent(String.self, forKey: .vatNumber)
        euTaxNumber = try container.decodeIfPresent(String.self, forKey: .euTaxNumber)
        groupTaxNumber = try container.decodeIfPresent(String.self, forKey: .groupTaxNumber)
        businessType = try container.decodeIfPresent(Int.self, forKey: .businessType)
        countryId = try container.decodeIfPresent(Int.self, forKey: .countryId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        shortName = try container.decodeIfPresent(String.self, forKey: .shortName)
        registrationNumber = try container.decodeIfPresent(String.self, forKey: .registrationNumber)
        establishedDate = try container.decodeIfPresent(Date.self, forKey: .establishedDate)
        registrationDate = try container.decodeIfPresent(Date.self, forKey: .registrationDate)
        duns = try container.decodeIfPresent(String.self, forKey: .duns)
        operatingLicenseNumber = try container.decodeIfPresent(String.self, forKey: .operatingLicenseNumber)
        isAccounting = try container.decodeIfPresent(Bool.self, forKey: .isAccounting)
        isSmallTaxPayer = try container.decodeIfPresent(Bool.self, forKey: .isSmallTaxPayer)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber)
        website = try container.decodeIfPresent(String.self, forKey: .website)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if vatNumber != nil { try container.encode(vatNumber, forKey: .vatNumber) }
        if euTaxNumber != nil { try container.encode(euTaxNumber, forKey: .euTaxNumber) }
        if groupTaxNumber != nil { try container.encode(groupTaxNumber, forKey: .groupTaxNumber) }
        if businessType != nil { try container.encode(businessType, forKey: .businessType) }
        if countryId != nil { try container.encode(countryId, forKey: .countryId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if shortName != nil { try container.encode(shortName, forKey: .shortName) }
        if registrationNumber != nil { try container.encode(registrationNumber, forKey: .registrationNumber) }
        if establishedDate != nil { try container.encode(establishedDate, forKey: .establishedDate) }
        if registrationDate != nil { try container.encode(registrationDate, forKey: .registrationDate) }
        if duns != nil { try container.encode(duns, forKey: .duns) }
        if operatingLicenseNumber != nil { try container.encode(operatingLicenseNumber, forKey: .operatingLicenseNumber) }
        if isAccounting != nil { try container.encode(isAccounting, forKey: .isAccounting) }
        if isSmallTaxPayer != nil { try container.encode(isSmallTaxPayer, forKey: .isSmallTaxPayer) }
        if email != nil { try container.encode(email, forKey: .email) }
        if phoneNumber != nil { try container.encode(phoneNumber, forKey: .phoneNumber) }
        if website != nil { try container.encode(website, forKey: .website) }
    }
}

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

    required public init(){}
}

public class ModifyEntityResponse : ResponseBase
{
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case id
    }

    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)
    }

    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) }
    }
}

public class ResponseBase : Codable
{
    public var responseStatus:ResponseStatus

    required public init(){}
}


Swift EditSupplier DTOs

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

HTTP + OTHER

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

PUT /supplier/{supplierid} HTTP/1.1 
Host: szallitoiportal-be.veolia.hu 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"SupplierId":0,"VatNumber":"String","EUTaxNumber":"String","GroupTaxNumber":"String","BusinessType":0,"CountryId":0,"Name":"String","ShortName":"String","RegistrationNumber":"String","EstablishedDate":"0001-01-01T00:00:00.0000000","RegistrationDate":"0001-01-01T00:00:00.0000000","Duns":"String","OperatingLicenseNumber":"String","IsAccounting":false,"IsSmallTaxPayer":false,"Email":"String","PhoneNumber":"String","Website":"String","ConcurrencyStamp":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Id":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}