/* Options: Date: 2025-12-06 06:17:18 SwiftVersion: 5.0 Version: 8.0 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://1fetch.api.client.prod.86degrees.com //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: CalculateDistance.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/calculatedistance", "POST") public class CalculateDistance : ApiServiceRequest, IReturn, ILogRequest { public typealias Return = CalculateDistanceResponse /** * Array of coordinates */ // @ApiMember(Description="Array of coordinates", IsRequired=true) public var coordinates:[Coordinate] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case coordinates } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) coordinates = try container.decodeIfPresent([Coordinate].self, forKey: .coordinates) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if coordinates.count > 0 { try container.encode(coordinates, forKey: .coordinates) } } } public class CalculateDistanceResponse : ApiServiceResponse { /** * A list of the distances between each point, returned in order that the points were provided */ // @ApiMember(Description="A list of the distances between each point, returned in order that the points were provided") public var pointDistances:[Double] = [] /** * The total distance between all points */ // @ApiMember(Description="The total distance between all points") public var totalDistance:Double required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case pointDistances case totalDistance } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) pointDistances = try container.decodeIfPresent([Double].self, forKey: .pointDistances) ?? [] totalDistance = try container.decodeIfPresent(Double.self, forKey: .totalDistance) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if pointDistances.count > 0 { try container.encode(pointDistances, forKey: .pointDistances) } if totalDistance != nil { try container.encode(totalDistance, forKey: .totalDistance) } } } public class ApiServiceRequest : IServiceRequest, IHasApiKey, Codable { /** * The API Key required for authentication */ // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true) public var apiKey:String required public init(){} } public protocol IServiceRequest { } public protocol IHasApiKey { var apiKey:String { get set } } public protocol ILogRequest { } public class Coordinate : Codable { /** * The Latitude */ // @ApiMember(Description="The Latitude", IsRequired=true) public var latitude:Double /** * The Longitude */ // @ApiMember(Description="The Longitude", IsRequired=true) public var longitude:Double required public init(){} } public class ApiServiceResponse : IServiceResponse, Codable { /** * Information about the response. */ // @ApiMember(Description="Information about the response.", IsRequired=true) public var Description:String /** * Heading or summary of the response. */ // @ApiMember(Description="Heading or summary of the response.", IsRequired=true) public var heading:String /** * Did the intended operation for this response complete successfully? */ // @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true) public var wasSuccessful:Bool required public init(){} }