/* Options: Date: 2026-01-12 03:49:26 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: Usage.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack /** * Get usages from tablestorage */ // @Route("/v5/meteringpoints/{Ean}/usages/{Aggregation}/{DateFrom}", "GET") // @Route("/v5/meteringpoints/{Ean}/usages/{Aggregation}/{DateFrom}/{DateTo}", "GET") // @Api(Description="Get usages from tablestorage") public class Usage : Generic { /** * Request of details of specific meteringpoint with Ean */ // @ApiMember(DataType="EAN (18 numbers)", Description="Request of details of specific meteringpoint with Ean", 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 */ // @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", 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. ", Name="DateTo") public var dateTo:Date? /** * The output can be generated in a few formats. UsageReturnCombined: return values will be subtracted from the usage, UsageReturn: separate columns form usage and return (if available) and UsageReturnAndTariff: for both usage and return a column for tariff1 and tariff2. Default value: UsageReturnCombined */ // @ApiMember(DataType="Enum", Description="The output can be generated in a few formats. UsageReturnCombined: return values will be subtracted from the usage, UsageReturn: separate columns form usage and return (if available) and UsageReturnAndTariff: for both usage and return a column for tariff1 and tariff2. Default value: UsageReturnCombined", Name="PayloadFormat") public var payloadFormat:PayloadFormat /** * See filter. Usages are available from the Detail or Day channel. Default value: Detail */ // @ApiMember(DataType="Enum", Description="See filter. Usages are available from the Detail or Day channel. Default value: Detail", Name="Source") public var source:MeasurementSource /** * Add column with Dutch day (Default: false) */ // @ApiMember(DataType="Boolean", Description="Add column with Dutch day (Default: false)", Name="AddDateNL") public var addDateNL:Bool /** * Add columns with CreatedOn and LastUpdated (Default: false) */ // @ApiMember(DataType="Boolean", Description="Add columns with CreatedOn and LastUpdated (Default: false)", Name="AddTimestamps") public var addTimestamps:Bool /** * Add column with ean (Default: false) */ // @ApiMember(DataType="Boolean", Description="Add column with ean (Default: false)", Name="AddEan") public var addEan:Bool /** * Create a row for each register instead of a column/field for each register (Default: false) */ // @ApiMember(DataType="Boolean", Description="Create a row for each register instead of a column/field for each register (Default: false)", Name="RegistersInRows") public var registersInRows:Bool /** * Gridoperator doesn't provided tariff information for the detail channel, but this can be calculated (Default: false) */ // @ApiMember(DataType="Boolean", Description="Gridoperator doesn't provided tariff information for the detail channel, but this can be calculated (Default: false)", Name="CalculateDetailTariff") public var calculateDetailTariff:Bool /** * 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 payloadFormat case source case addDateNL case addTimestamps case addEan case registersInRows case calculateDetailTariff 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) payloadFormat = try container.decodeIfPresent(PayloadFormat.self, forKey: .payloadFormat) source = try container.decodeIfPresent(MeasurementSource.self, forKey: .source) addDateNL = try container.decodeIfPresent(Bool.self, forKey: .addDateNL) addTimestamps = try container.decodeIfPresent(Bool.self, forKey: .addTimestamps) addEan = try container.decodeIfPresent(Bool.self, forKey: .addEan) registersInRows = try container.decodeIfPresent(Bool.self, forKey: .registersInRows) calculateDetailTariff = try container.decodeIfPresent(Bool.self, forKey: .calculateDetailTariff) 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 payloadFormat != nil { try container.encode(payloadFormat, forKey: .payloadFormat) } if source != nil { try container.encode(source, forKey: .source) } if addDateNL != nil { try container.encode(addDateNL, forKey: .addDateNL) } if addTimestamps != nil { try container.encode(addTimestamps, forKey: .addTimestamps) } if addEan != nil { try container.encode(addEan, forKey: .addEan) } if registersInRows != nil { try container.encode(registersInRows, forKey: .registersInRows) } if calculateDetailTariff != nil { try container.encode(calculateDetailTariff, forKey: .calculateDetailTariff) } 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 MeasurementSource : String, Codable { case Detail case Day case Month case Unknown } public enum AggregationForAPI : String, Codable { case None case Hour case Day case Week case Month case Year } public enum PayloadFormat : String, Codable { case UsageReturnCombined case UsageReturn case UsageReturnAndTariff }