POST | /business-entities/{BeeNumber}/documents |
---|
import Foundation
import ServiceStack
public class BusinessEntityDocumentCreate : IPost, Codable
{
// @ApiMember(IsRequired=true)
public var beeNumber:Double?
// @ApiMember(IsRequired=true)
public var documentCategoryId:String?
// @ApiMember(IsRequired=true)
public var documentName:String?
public var userName:String?
// @ApiMember(IsRequired=true)
public var createdDate:Date?
// @ApiMember()
public var documentDefinition:String?
// @ApiMember()
public var overwriteIfExists:Bool?
required public init(){}
}
public class BusinessEntityDocumentCreateResponse : CreateResponse
{
public var beeDocumentGuid:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case beeDocumentGuid
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
beeDocumentGuid = try container.decodeIfPresent(Int.self, forKey: .beeDocumentGuid)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if beeDocumentGuid != nil { try container.encode(beeDocumentGuid, forKey: .beeDocumentGuid) }
}
}
public class CreateResponse : ICreateResponse, Codable
{
public var responseStatus:ResponseStatus?
public var links:HateoasLinks?
required public init(){}
}
public class HateoasLinks : List<HateoasLink>
{
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 HateoasLink : Codable
{
public var rel:String?
public var href:String?
public var type:String?
required public init(){}
}
Swift BusinessEntityDocumentCreate 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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /business-entities/{BeeNumber}/documents HTTP/1.1
Host: extensions.avon.ca
Accept: application/json
Content-Type: application/json
Content-Length: length
{"beeNumber":0,"documentCategoryId":"String","documentName":"String","userName":"String","createdDate":"0001-01-01T00:00:00.0000000","documentDefinition":"String","overwriteIfExists":false}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"beeDocumentGuid":0,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"links":[{"rel":"String","href":"String","type":"String"}]}