/* Options: Date: 2026-01-12 03:48:33 SwiftVersion: 5.0 Version: 8.22 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://p4v8.smartdatasolutions.nl/api //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: Graph.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack /** * Get data for graph, usages and some statistical information */ // @Route("/v6/meteringpoints/{Ean}/graph/{Aggregation}/{DateFrom}/{DateTo}", "GET") // @Api(Description="Get data for graph, usages and some statistical information") public class Graph : Generic { /** * Request of details of specific meteringpoint with Ean */ // @ApiMember(DataType="EAN (18 numbers)", Description="Request of details of specific meteringpoint with Ean", IsRequired=true, Name="Ean") public var ean:String /** * Aggregation level. The None-'level' will give the most detailed level available for the requested asset. If a level is requested that is not available or can be calculate, no data is returned. Enum options: None, Hour, Day, Week, Month */ // @ApiMember(DataType="Enum", Description="Aggregation level. The None-'level' will give the most detailed level available for the requested asset. If a level is requested that is not available or can be calculate, no data is returned. Enum options: None, Hour, Day, Week, Month", IsRequired=true, Name="Aggregation") public var aggregation:AggregationForAPI /** * Start date the usages are requested for */ // @ApiMember(DataType="Date: yyyy-mm-dd", Description="Start date the usages are requested for", IsRequired=true, Name="DateFrom") public var dateFrom:Date /** * End date the usages are requested for (this is included in the response). If no date is provided the DateTo will seven days from the DateFrom. */ // @ApiMember(DataType="Date: yyyy-mm-dd", Description="End date the usages are requested for (this is included in the response). If no date is provided the DateTo will seven days from the DateFrom. ", IsRequired=true, Name="DateTo") public var dateTo:Date /** * calculate the usage of that period and divide it over the missing hours or 15 minute periods, but this can be calculated (Default: false) */ // @ApiMember(DataType="Boolean", Description="calculate the usage of that period and divide it over the missing hours or 15 minute periods, but this can be calculated (Default: false)", Name="CalculateMissingUsages") public var calculateMissingUsages:Bool required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case ean case aggregation case dateFrom case dateTo case calculateMissingUsages } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) ean = try container.decodeIfPresent(String.self, forKey: .ean) aggregation = try container.decodeIfPresent(AggregationForAPI.self, forKey: .aggregation) dateFrom = try container.decodeIfPresent(Date.self, forKey: .dateFrom) dateTo = try container.decodeIfPresent(Date.self, forKey: .dateTo) calculateMissingUsages = try container.decodeIfPresent(Bool.self, forKey: .calculateMissingUsages) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if ean != nil { try container.encode(ean, forKey: .ean) } if aggregation != nil { try container.encode(aggregation, forKey: .aggregation) } if dateFrom != nil { try container.encode(dateFrom, forKey: .dateFrom) } if dateTo != nil { try container.encode(dateTo, forKey: .dateTo) } if calculateMissingUsages != nil { try container.encode(calculateMissingUsages, forKey: .calculateMissingUsages) } } } public enum DateTimeFormat : String, Codable { case ISO8601 case UTC case NL case NLOffset case IN case INOffset case Unix case UnixMillis } public class Generic : Codable { /** * Api-key. Used to provide credentials to the api. Can also be provided through the request headers with key: X-API-KEY */ // @ApiMember(DataType="String", Description="Api-key. Used to provide credentials to the api. Can also be provided through the request headers with key: X-API-KEY", IsRequired=true, Name="ApiKey") public var apiKey:String /** * Normally the result of the request is put inside a resultobject with some status information about the request. If you want the output as csv this outer object can be irritating. Default value: FALSE */ // @ApiMember(DataType="Boolean", Description="Normally the result of the request is put inside a resultobject with some status information about the request. If you want the output as csv this outer object can be irritating. Default value: FALSE ", Name="OnlyPayload") public var onlyPayload:Bool /** * Show the request as interpreted by the api. Useful to see how filters / dates are parsed. If no value us provided, the default value is: FALSE */ // @ApiMember(DataType="Boolean", Description="Show the request as interpreted by the api. Useful to see how filters / dates are parsed. If no value us provided, the default value is: FALSE ", Name="ShowRequest") public var showRequest:Bool /** * Format all DateTime in the response object. If used in browser, sometimes ISO8601 is not correctly transformed. Enum options: ISO8601 (DEFAULT), UTC, NL, NLOffset, Unix, UnixMillis */ // @ApiMember(DataType="Enum", Description="Format all DateTime in the response object. If used in browser, sometimes ISO8601 is not correctly transformed. Enum options: ISO8601 (DEFAULT), UTC, NL, NLOffset, Unix, UnixMillis", Name="DateTimeFormat") public var dateTimeFormat:DateTimeFormat required public init(){} } public enum AggregationForAPI : String, Codable { case None case Hour case Day case Week case Month case Year }