POST | /machines/{MachineId}/viewpoint |
---|
import Foundation
import ServiceStack
public class UploadViewpointPhotoRequest : PostOperationTenanted<UploadViewpointPhotoResponse>
{
public var machineId:String?
public var uploadedAt:Date?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case machineId
case uploadedAt
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
machineId = try container.decodeIfPresent(String.self, forKey: .machineId)
uploadedAt = try container.decodeIfPresent(Date.self, forKey: .uploadedAt)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if machineId != nil { try container.encode(machineId, forKey: .machineId) }
if uploadedAt != nil { try container.encode(uploadedAt, forKey: .uploadedAt) }
}
}
public class PostOperationTenanted<TResponse : Codable> : PostOperationUnTenanted<TResponse>, ITenantedRequest
{
public var organisationId:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case organisationId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
organisationId = try container.decodeIfPresent(String.self, forKey: .organisationId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if organisationId != nil { try container.encode(organisationId, forKey: .organisationId) }
}
}
public class PostOperationUnTenanted<TResponse : Codable> : IPost, Codable
{
required public init(){}
}
public class UploadViewpointPhotoResponse : Codable
{
public var responseStatus:ResponseStatus?
public var photo:Photo?
required public init(){}
}
public class Photo : IIdentifiableResource, Codable
{
public var uploadedAt:Date?
public var imageUrl:String?
public var thumbnailUrl:String?
public var id:String?
required public init(){}
}
Swift UploadViewpointPhotoRequest 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.
POST /machines/{MachineId}/viewpoint HTTP/1.1
Host: foundrystage-api-app.azurewebsites.net
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"machineId":"String","organisationId":"String"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"photo":{"imageUrl":"String","thumbnailUrl":"String","id":"String"}}