@epilot/metering-client 0.6.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  API Client for epilot ts-sam API.
4
4
 
5
- Uses [`openapi-client-axios`](https://github.com/anttiviljami/openapi-client-axios)
5
+ Uses [`openapi-client-axios`](https://github.com/openapistack/openapi-client-axios)
6
6
 
7
7
  ## Getting Started
8
8
 
@@ -1 +1 @@
1
- (()=>{"use strict";var e={914:function(e,t,r){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=s(r(534));t.default=n.default},534:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"Metering API","version":"1.0.0"},"tags":[{"name":"ECP","description":"APIs defined for a portal user"},{"name":"ECP Admin","description":"APIs defined for a ECP Admin"}],"security":[{"EpilotAuth":[]},{"PortalAuth":[]},{"EitherAuth":[]}],"paths":{"/v1/metering/meter":{"get":{"operationId":"getCustomerMeters","summary":"Get Customer Meters","description":"Retrieves all meters related to a customer.","tags":["ECP"],"security":[{"PortalAuth":[]}],"responses":{"200":{"description":"Customer meters retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Meter"},{"type":"object","properties":{"journey_actions":{"$ref":"#/components/schemas/JourneyActions"}}}]}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/contract/meters/{contract_id}":{"get":{"operationId":"getMetersByContractId","summary":"getMetersByContractId","description":"Retrieves all meters related to a contract.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"contract_id","schema":{"$ref":"#/components/schemas/EntityId"},"required":true,"description":"The ID of the Contract."}],"responses":{"200":{"description":"Meters related to the contract retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Meter"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/meter/{id}":{"patch":{"operationId":"updateMeter","summary":"Update Meter","description":"Updates the details of a meter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"$ref":"#/components/schemas/EntityId"},"required":true,"description":"The ID of the meter."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Entity"}}}},"responses":{"200":{"description":"Meter updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Meter"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"get":{"operationId":"getMeter","summary":"Get Meter","description":"Retrieves the details of a meter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"$ref":"#/components/schemas/EntityId"},"required":true,"description":"The ID of the meter."}],"responses":{"200":{"description":"Meter retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"entity":{"$ref":"#/components/schemas/Meter"},"journey_actions":{"$ref":"#/components/schemas/JourneyActions"},"relations":{"type":"array","items":{"$ref":"#/components/schemas/EntityItem"}}}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/counter":{"get":{"operationId":"getMeterCounters","summary":"Get Meter Counters","description":"Retrieves all counters for a given meter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"query","name":"meter_id","required":true,"schema":{"$ref":"#/components/schemas/EntityId"}}],"responses":{"200":{"description":"Counters retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeterCounter"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/counter/{counter_id}":{"get":{"operationId":"getCounterDetails","summary":"Get Counter Details","description":"Retrieves the details of a meter counter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter."}],"responses":{"200":{"description":"Counter details retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterCounter"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading":{"post":{"operationId":"createMeterReading","summary":"Create Meter Reading","description":"Inserts a new meter reading.","tags":["ECP Admin","ECP"],"security":[{"EitherAuth":[]}],"requestBody":{"description":"Meter reading payload.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterReading"}}}},"responses":{"200":{"description":"Meter reading created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterReading"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/readings":{"post":{"operationId":"createMeterReadings","summary":"Create Meter Readings","description":"Inserts multiple meter readings at once. Limited to 100 readings per request.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"parameters":[{"in":"query","name":"async","description":"Don\'t wait for the reading to become available in GetReadings API. Useful for large migrations","required":false,"schema":{"type":"boolean","default":true}},{"$ref":"#/components/parameters/ActivityIdQueryParam"}],"requestBody":{"description":"Meter readings payload. Limited to 100 readings per request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"readings":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}}}}}}},"responses":{"200":{"description":"Meter readings created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading/submission":{"post":{"operationId":"createMeterReadingFromSubmission","summary":"Create Meter Reading from Submission","description":"Creates a reading from a journey submission.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"requestBody":{"description":"Meter reading payload.","required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"org_id":{"type":"string","example":"123","description":"ID of the organization"},"entity":{"type":"object","additionalProperties":true,"properties":{"_org":{"type":"string","example":"123","description":"ID of the organization"},"meterReadings":{"type":"array","items":{"$ref":"#/components/schemas/SubmissionMeterReading"}}}}}}}}},"responses":{"200":{"description":"Meter reading created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Successfully Processed"]}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/allowed/reading/{meter_id}":{"get":{"operationId":"getAllowedReadingForMeter","summary":"getAllowedReadingForMeter","description":"Get allowed reading for the given meter","tags":["ECP Admin","ECP"],"security":[{"EitherAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter."},{"in":"query","name":"timestamp","required":false,"description":"If not provided, the system will default to now.","schema":{"type":"string","example":"2022-10-01T10:10:00.000Z"}}],"responses":{"200":{"description":"Recent reading for the meter fetched successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"counter_id":{"$ref":"#/components/schemas/Id"},"min_value":{"type":"number","description":"Minimum allowed reading value for the meter"},"max_value":{"type":"number","description":"Maximum allowed reading value for the meter"}}}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading/with-meter":{"post":{"operationId":"createReadingWithMeter","summary":"Create Reading with Meter","description":"Creates a reading along with a meter.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"requestBody":{"description":"Meter reading payload.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadingWithMeter"}}}},"responses":{"200":{"description":"Reading with meter created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterReading"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading/{meter_id}/{counter_id}":{"get":{"operationId":"getReadingsByInterval","summary":"Get Readings by Interval","description":"Retrieves all readings specified in an interval.\\nIf the start_date and end_date are equal, then it returns the readings of the specified date.\\nThe start_date should be less than or equal to the end_date.\\n","tags":["ECP Admin","ECP"],"security":[{"EitherAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter."},{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter."},{"in":"query","name":"start_date","required":false,"description":"If not provided, the system will default to 2000-01-01.","schema":{"type":"string","example":"2022-10-01"}},{"in":"query","name":"end_date","required":false,"description":"If not provided, the system will default to today\'s date.","schema":{"type":"string","example":"2022-10-10"}},{"in":"query","name":"direction","required":false,"schema":{"$ref":"#/components/schemas/Direction"}},{"in":"query","name":"size","description":"Returns the first n results after the specified offset (from).\\nIf this value is provided as -1, then it returns all results at once.\\n","required":false,"schema":{"type":"number","example":20,"default":20}},{"in":"query","name":"from","required":false,"schema":{"type":"number","example":0,"default":0}},{"in":"query","name":"type","required":true,"description":"Since meter readings are cumulative, users may need to request actual consumptions, which are the difference between consecutive measurements.\\nIf this value is provided as \\"cumulative\\", then actual readings will be returned.\\nIf this value is provided as \\"relative\\", then actual consumption will be returned.\\n","schema":{"type":"string","default":"cumulative","enum":["cumulative","relative"]}},{"in":"query","name":"sort","required":false,"schema":{"type":"string","default":"asc","enum":["asc","desc"]},"description":"If this value is provided as \\"asc\\", then the results will be sorted by the timestamp field in ascending order.\\nIf this value is provided as \\"desc\\", then the results will be sorted by the timestamp field in descending order.\\n"}],"responses":{"200":{"description":"Readings retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}},"hits":{"type":"number","example":120},"firstRecordCreatedAt":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"put":{"operationId":"updateMeterReading","summary":"Update Meter Reading","description":"Updates a meter reading.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter entity."},{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter entity."},{"in":"query","name":"timestamp","required":true,"description":"The timestamp when the reading was created.","schema":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}],"requestBody":{"description":"Update meter reading payload.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterReading"}}}},"responses":{"200":{"description":"Meter reading updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterReading"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"delete":{"operationId":"deleteMeterReading","summary":"Delete Meter Reading","description":"Deletes a meter reading.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter entity."},{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter entity."},{"in":"query","name":"timestamp","required":true,"description":"The timestamp when the reading was created.","schema":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}],"responses":{"200":{"description":"Meter reading deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"meterId":{"$ref":"#/components/schemas/Id"},"counterId":{"$ref":"#/components/schemas/Id"},"timestamp":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/down-sample/readings/{meter_id}/{counter_id}":{"get":{"operationId":"getDownSampleReadingsByInterval","summary":"Get Down Sample Readings by Interval","description":"Retrieves the downsampled data of the entire readings specified in an interval.\\nIf the start_date and end_date are equal, then it returns the readings of the specified date.\\nThe start_date should be less than or equal to the end_date.\\n","tags":["ECP Admin","ECP"],"security":[{"EitherAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter."},{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter."},{"in":"query","name":"start_date","required":false,"description":"If not provided, the system will default to 2000-01-01.","schema":{"type":"string","example":"2022-10-01"}},{"in":"query","name":"end_date","required":false,"description":"If not provided, the system will default to today\'s date.","schema":{"type":"string","example":"2022-10-10"}},{"in":"query","name":"group_by","schema":{"type":"string","default":"day","enum":["day","week","month","year"]}},{"in":"query","name":"direction","required":false,"schema":{"$ref":"#/components/schemas/Direction"}},{"in":"query","name":"sort","required":false,"schema":{"type":"string","default":"asc","enum":["asc","desc"]},"description":"If this value is provided as \\"asc\\", then the results will be sorted by the timestamp field in ascending order.\\nIf this value is provided as \\"desc\\", then the results will be sorted by the timestamp field in descending order.\\n"}],"responses":{"200":{"description":"Downsampled readings retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"responses":{"InvalidRequest":{"description":"The request could not be validated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"Unauthorized":{"description":"Could not authenticate the user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"Forbidden":{"description":"The user is not allowed to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"NotFound":{"description":"The specified resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"InternalServerError":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}}},"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Authorization header with ePilot OAuth2 bearer token","bearerFormat":"JWT"},"PortalAuth":{"type":"http","scheme":"bearer","description":"Authorization header with customer portal OAuth2 bearer token","bearerFormat":"JWT"},"EitherAuth":{"type":"http","scheme":"bearer","description":"Portal or Epilot Bearer Token"},"AsOrganization":{"type":"apiKey","in":"header","name":"x-ivy-org-id","description":"Set organization id as internal user"}},"schemas":{"ErrorResp":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}}},"EntityId":{"type":"string","format":"uuid"},"EntitySlug":{"description":"URL-friendly identifier for the entity schema","type":"string","example":"contact"},"BaseEntity":{"type":"object","properties":{"_id":{"$ref":"#/components/schemas/EntityId","description":"Entity ID","example":"3fa85f64-5717-4562-b3fc-2c963f66afa6"},"_title":{"type":"string","description":"Title of the entity","example":"Example Entity"},"_org":{"type":"string","description":"Organization ID the entity belongs to","example":"123"},"_tags":{"type":"array","items":{"type":"string"},"description":"Array of entity tags","example":["example","mock"]},"_created_at":{"type":"string","format":"date-time","description":"Creation timestamp of the entity","example":"2021-02-09T12:41:43.662Z"},"_updated_at":{"type":"string","format":"date-time","description":"Last update timestamp of the entity","example":"2021-02-09T12:41:43.662Z"}},"required":["_id","_title","_org","_created_at","_updated_at"]},"Entity":{"type":"object","properties":{},"additionalProperties":true},"EntityItem":{"allOf":[{"$ref":"#/components/schemas/BaseEntity"},{"$ref":"#/components/schemas/Entity"}]},"Id":{"type":"string"},"EntityRelation":{"type":"object","properties":{"entity_id":{"$ref":"#/components/schemas/EntityId"},"_slug":{"type":"string","enum":["contact","contract"]}}},"Meter":{"allOf":[{"$ref":"#/components/schemas/BaseEntity"},{"type":"object","required":["_schema"],"properties":{"_schema":{"type":"string","enum":["meter"],"description":"The schema type of the meter"},"ma_lo_id":{"type":"string","example":"A09-123","description":"The MA-LO ID of the meter"},"meter_type":{"type":"string","enum":["three-phase-meter","bellow-gas-meter","rotary-piston-meter","smart-meter","performance-meter","maximum-meter","turbine-gas-meter","ultrasonic-gas-meter","alternating-current-meter","modern-metering-system","intelligent-measuring-system","electronic-meter"],"description":"The type of the meter"},"tariff_type":{"type":"string","example":"Peak load tariff","description":"The tariff type of the meter"},"meter_number":{"type":"string","example":"J-1093-1AK","description":"The number of the meter"},"sector":{"type":"string","enum":["power","water","gas","district_heating","waste_water"],"description":"The sector to which the meter belongs"},"location":{"type":"object","example":[{"country":"Germany","city":"Koln","postal_code":81475,"street":"Melatengürtel","street_number":71,"additional_info":"5. Etage","_tags":["billing","delivery"]}],"description":"The location information of the meter"},"used_for":{"type":"string","example":"Domestic Usage","description":"The usage purpose of the meter"},"manufacturer":{"type":"string","example":"Energy One","description":"The manufacturer of the meter"},"calibration_date":{"type":"string","example":"2022-10-10T00:00:00.000Z","description":"The calibration date of the meter"},"contract":{"type":"object","properties":{"$relation":{"type":"array","items":{"$ref":"#/components/schemas/EntityRelation"}}},"description":"The contract associated with the meter"},"customer":{"type":"object","properties":{"$relation":{"type":"array","items":{"$ref":"#/components/schemas/EntityRelation"}}},"description":"The customer associated with the meter"}}}]},"Direction":{"type":"string","enum":["feed-in","feed-out"]},"TariffType":{"type":"string","enum":["ht","nt"]},"Reason":{"type":"string","nullable":true,"example":"Storing the feed-in record","description":"The reason for recording the reading"},"ReadBy":{"type":"string","nullable":true,"example":"John Doe","description":"The person who recorded the reading"},"ReadingStatus":{"type":"string","nullable":true,"enum":["valid","in-validation","implausible",null,""]},"MeterReading":{"type":"object","required":["value","meter_id","source"],"properties":{"value":{"type":"number","example":240,"description":"The reading value of the meter"},"read_by":{"$ref":"#/components/schemas/ReadBy"},"reason":{"$ref":"#/components/schemas/Reason"},"meter_id":{"$ref":"#/components/schemas/EntityId","description":"The ID of the associated meter"},"counter_id":{"$ref":"#/components/schemas/EntityId","description":"The ID of the associated meter counter"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the reading (feed-in or feed-out)"},"timestamp":{"type":"string","description":"If the value is not provided, the system will be set with the time the request is processed.","example":"2022-10-10T00:00:00.000Z"},"source":{"$ref":"#/components/schemas/Source","description":"The source of the reading"},"status":{"$ref":"#/components/schemas/ReadingStatus","description":"The status of the reading"}}},"MeterCounter":{"allOf":[{"$ref":"#/components/schemas/BaseEntity"},{"type":"object","required":["_schema"],"properties":{"_id":{"$ref":"#/components/schemas/EntityId"},"_schema":{"type":"string","enum":["meter_counter"]},"obis_number":{"type":"string","example":"A-34","description":"The OBIS number of the meter counter"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the meter counter"},"transformer_ratio":{"type":"number","example":70,"description":"The transformer ratio of the meter counter"},"unit":{"$ref":"#/components/schemas/Unit","description":"The unit of measurement for the meter counter"},"forecast_reading_value":{"type":"string","example":270,"description":"The forecast reading value of the meter counter"},"forecast_as_of":{"type":"string","example":"2022-12-10T00:00:00.000Z","description":"The date as of which the forecast reading value is applicable"},"current_consumption":{"type":"number","example":240,"description":"The current consumption value of the meter counter"},"last_reading":{"type":"string","example":"2022-10-10T00:00:00.000Z","description":"The timestamp of the last reading"},"conversion_factor":{"type":"number","example":3,"description":"The conversion factor for the meter counter"},"tariff_type":{"$ref":"#/components/schemas/TariffType","description":"The tariff type of the meter counter"}}}]},"CounterReadingOnSubmission":{"type":"object","required":["counterId","direction","value"],"properties":{"counterId":{"$ref":"#/components/schemas/Id","description":"The ID of the associated meter counter"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the reading (feed-in or feed-out)"},"unit":{"type":"string","enum":["w","wh","kw","kWh","kvarh","mw","mWh","unit","cubic-meter","hour","day","month","year","percentage"],"description":"The unit of measurement for the reading"},"value":{"type":"number","example":240,"description":"The reading value of the meter counter"}}},"SubmissionMeterReading":{"type":"object","required":["meterId"],"nullable":true,"properties":{"meterId":{"$ref":"#/components/schemas/Id","description":"The ID of the associated meter"},"readings":{"type":"array","items":{"$ref":"#/components/schemas/CounterReadingOnSubmission"},"description":"- The counter readings of a meter\\n- This is only sent when the user is authenticated while submitting a journey\\n"},"readingValue":{"type":"number","example":240,"description":"The reading value of the meter when the counterId is passed or when the meterType is one-tariff"},"readingDate":{"type":"string","description":"If the value is not provided, the system will be set with the time the request is processed.","example":"2022-10-10T10:10:00.000Z"},"readBy":{"type":"string","example":"John Doe","description":"The person who recorded the reading"},"reason":{"$ref":"#/components/schemas/Reason"},"maloId":{"type":"string","example":"A09-123","description":"The MA-LO ID of the meter"},"obisNumber":{"type":"string","example":"A-34","description":"The OBIS number of the meter counter"},"readingUnit":{"$ref":"#/components/schemas/Unit","description":"The unit of measurement for the reading"},"meterType":{"type":"string","enum":["one_tariff","two_tariff","bi_directional"],"description":"The type of the meter"},"feedInValue":{"type":"number","example":240,"description":"The feed-in value of the meter when meterType is one-tariff or bi-directional"},"feedOutValue":{"type":"number","example":240,"description":"The feed-out value of the meter when meterType is bi-directional"},"htValue":{"type":"number","example":240,"description":"The high-peak tariff value of the meter when meterType is two-tariff"},"ntValue":{"type":"number","example":240,"description":"The off-peak tariff value of the meter when meterType is two-tariff"}}},"Unit":{"type":"string","enum":["w","wh","kw","kWh","kvarh","mw","mWh","unit","cubic-meter","hour","day","month","year","percentage"]},"Source":{"type":"string","enum":["ECP","ERP","360","journey-submission"]},"ActionLabel":{"type":"object","properties":{"en":{"type":"string","nullable":true},"de":{"type":"string","nullable":true}}},"Rule":{"type":"object","properties":{"entity":{"type":"string","nullable":true},"attribute":{"type":"string","nullable":true},"attribute_value":{"type":"string","nullable":true}}},"JourneyActions":{"type":"object","properties":{"journey_id":{"type":"string","nullable":true},"action_label":{"type":"object","$ref":"#/components/schemas/ActionLabel","nullable":true},"slug":{"type":"string","nullable":true},"rules":{"type":"array","items":{"$ref":"#/components/schemas/Rule"},"nullable":true}}},"ReadingWithMeter":{"type":"object","properties":{"ma_lo_id":{"type":"string","example":"A09-123","description":"The MA-LO ID of the meter"},"meter_id":{"$ref":"#/components/schemas/Id","description":"The ID of the associated meter"},"obis_number":{"type":"string","example":"A-34","description":"The OBIS number of the meter counter"},"unit":{"$ref":"#/components/schemas/Unit","description":"The unit of measurement for the reading"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the reading"},"tariff_type":{"$ref":"#/components/schemas/TariffType","description":"The tariff type of the reading"},"value":{"type":"number","example":240,"description":"The reading value"},"read_by":{"$ref":"#/components/schemas/ReadBy"},"reason":{"$ref":"#/components/schemas/Reason"},"timestamp":{"type":"string","description":"If the value is not provided, the system will be set with the time the request is processed.","example":"2022-10-10T10:10:00.000Z"},"source":{"$ref":"#/components/schemas/Source","description":"The source of the reading"}}},"ActivityId":{"type":"string","format":"ulid","description":"See https://github.com/ulid/spec","example":"01F130Q52Q6MWSNS8N2AVXV4JN"}},"parameters":{"ActivityIdQueryParam":{"name":"activity_id","description":"Activity to include in event feed","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ActivityId"}}}},"servers":[{"url":"https://metering.sls.epilot.io"}]}')}},t={},r=function r(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s].call(o.exports,o,o.exports,r),o.exports}(914),s=exports;for(var n in r)s[n]=r[n];r.__esModule&&Object.defineProperty(s,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={914:function(e,t,r){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=s(r(534));t.default=n.default},534:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"Metering API","version":"1.0.0"},"tags":[{"name":"ECP","description":"APIs defined for a portal user"},{"name":"ECP Admin","description":"APIs defined for a ECP Admin"},{"name":"meter_schema","x-displayName":"Meter","description":"<SchemaDefinition schemaRef=\\"#/components/schemas/Meter\\" />\\n"},{"name":"meter_counter_schema","x-displayName":"Meter Counter","description":"<SchemaDefinition schemaRef=\\"#/components/schemas/MeterCounter\\" />\\n"}],"x-tagGroups":[{"name":"APIs","tags":["ECP","ECP Admin"]},{"name":"Schemas","tags":["meter_schema","meter_counter_schema"]}],"security":[{"EpilotAuth":[]},{"PortalAuth":[]},{"EitherAuth":[]}],"paths":{"/v1/metering/meter":{"get":{"operationId":"getCustomerMeters","summary":"Get Customer Meters","description":"Retrieves all meters related to a customer.","tags":["ECP"],"security":[{"PortalAuth":[]}],"responses":{"200":{"description":"Customer meters retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Meter"},{"type":"object","properties":{"journey_actions":{"$ref":"#/components/schemas/JourneyActions"}}}]}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/contract/meters/{contract_id}":{"get":{"operationId":"getMetersByContractId","summary":"getMetersByContractId","description":"Retrieves all meters related to a contract.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"contract_id","schema":{"$ref":"#/components/schemas/EntityId"},"required":true,"description":"The ID of the Contract."}],"responses":{"200":{"description":"Meters related to the contract retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Meter"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/meter/{id}":{"patch":{"operationId":"updateMeter","summary":"Update Meter","description":"Updates the details of a meter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"$ref":"#/components/schemas/EntityId"},"required":true,"description":"The ID of the meter."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Entity"}}}},"responses":{"200":{"description":"Meter updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Meter"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequestUpdateMeter"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"get":{"operationId":"getMeter","summary":"Get Meter","description":"Retrieves the details of a meter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"$ref":"#/components/schemas/EntityId"},"required":true,"description":"The ID of the meter."}],"responses":{"200":{"description":"Meter retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"entity":{"$ref":"#/components/schemas/Meter"},"journey_actions":{"$ref":"#/components/schemas/JourneyActions"},"relations":{"type":"array","items":{"$ref":"#/components/schemas/EntityItem"}}}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/counter":{"get":{"operationId":"getMeterCounters","summary":"Get Meter Counters","description":"Retrieves all counters for a given meter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"query","name":"meter_id","required":true,"schema":{"$ref":"#/components/schemas/EntityId"}}],"responses":{"200":{"description":"Counters retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeterCounter"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/counter/{counter_id}":{"get":{"operationId":"getCounterDetails","summary":"Get Counter Details","description":"Retrieves the details of a meter counter.","tags":["ECP"],"security":[{"PortalAuth":[]}],"parameters":[{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter."}],"responses":{"200":{"description":"Counter details retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterCounter"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading":{"post":{"operationId":"createMeterReading","summary":"Create Meter Reading","description":"Inserts a new meter reading.","tags":["ECP Admin","ECP"],"security":[{"EitherAuth":[]}],"requestBody":{"description":"Meter reading payload.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterReading"}}}},"responses":{"200":{"description":"Meter reading created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterReading"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequestCreateMeterReading"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/readings":{"post":{"operationId":"createMeterReadings","summary":"Create Meter Readings","description":"Inserts multiple meter readings at once. Limited to 100 readings per request.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"parameters":[{"in":"query","name":"async","description":"Don\'t wait for the reading to become available in GetReadings API. Useful for large migrations","required":false,"schema":{"type":"boolean","default":true}},{"$ref":"#/components/parameters/ActivityIdQueryParam"}],"requestBody":{"description":"Meter readings payload. Limited to 100 readings per request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"readings":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}}}}}}},"responses":{"200":{"description":"Meter readings created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequestCreateMeterReadings"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v2/metering/readings":{"post":{"operationId":"batchWriteMeterReadings","summary":"Batch Write Readings","description":"Upserts/Deletes multiple meter readings at once. Limited to 100 readings per request.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"parameters":[{"in":"query","name":"async","description":"Don\'t wait for the reading to become available in GetReadings API. Useful for large migrations","required":false,"schema":{"type":"boolean","default":true}},{"$ref":"#/components/parameters/ActivityIdQueryParam"}],"requestBody":{"description":"Meter readings payload. Limited to 100 readings per request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"readings":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/MeterReading"},{"properties":{"operation":{"type":"string","enum":["create","update","delete"],"default":"create"}}}]}}}}}}},"responses":{"200":{"description":"Meter readings created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequestCreateMeterReadings"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading/submission":{"post":{"operationId":"createMeterReadingFromSubmission","summary":"Create Meter Reading from Submission","description":"Creates a reading from a journey submission.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"requestBody":{"description":"Meter reading payload.","required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"org_id":{"type":"string","example":"123","description":"ID of the organization"},"entity":{"type":"object","additionalProperties":true,"properties":{"_org":{"type":"string","example":"123","description":"ID of the organization"},"meterReadings":{"type":"array","items":{"$ref":"#/components/schemas/SubmissionMeterReading"}}}}}}}}},"responses":{"200":{"description":"Meter reading created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Successfully Processed"]}}}}}},"400":{"$ref":"#/components/responses/InvalidRequestCreateMeterReadingFromSubmission"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/allowed/reading/{meter_id}":{"get":{"operationId":"getAllowedReadingForMeter","summary":"getAllowedReadingForMeter","description":"Get allowed reading for the given meter","tags":["ECP Admin","ECP"],"security":[{"EitherAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter."},{"in":"query","name":"timestamp","required":false,"description":"If not provided, the system will default to now.","schema":{"type":"string","example":"2022-10-01T10:10:00.000Z"}}],"responses":{"200":{"description":"Recent reading for the meter fetched successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"counter_id":{"$ref":"#/components/schemas/Id"},"min_value":{"type":"number","description":"Minimum allowed reading value for the meter"},"max_value":{"type":"number","description":"Maximum allowed reading value for the meter"}}}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading/with-meter":{"post":{"operationId":"createReadingWithMeter","summary":"Create Reading with Meter","description":"Creates a reading along with a meter.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"requestBody":{"description":"Meter reading payload.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadingWithMeter"}}}},"responses":{"200":{"description":"Reading with meter created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterReading"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequestCreateReadingWithMeter"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/v1/metering/reading/{meter_id}/{counter_id}":{"get":{"operationId":"getReadingsByInterval","summary":"Get Readings by Interval","description":"Retrieves all readings specified in an interval.\\nIf the start_date and end_date are equal, then it returns the readings of the specified date.\\nThe start_date should be less than or equal to the end_date.\\n","tags":["ECP Admin","ECP"],"security":[{"EitherAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter."},{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter."},{"in":"query","name":"start_date","required":false,"description":"If not provided, the system will default to 2000-01-01.","schema":{"type":"string","example":"2022-10-01"}},{"in":"query","name":"end_date","required":false,"description":"If not provided, the system will default to today\'s date.","schema":{"type":"string","example":"2022-10-10"}},{"in":"query","name":"direction","required":false,"schema":{"$ref":"#/components/schemas/Direction"}},{"in":"query","name":"size","description":"Returns the first n results after the specified offset (from).\\nIf this value is provided as -1, then it returns all results at once.\\n","required":false,"schema":{"type":"number","example":20,"default":20}},{"in":"query","name":"from","required":false,"schema":{"type":"number","example":0,"default":0}},{"in":"query","name":"type","required":true,"description":"Since meter readings are cumulative, users may need to request actual consumptions, which are the difference between consecutive measurements.\\nIf this value is provided as \\"cumulative\\", then actual readings will be returned.\\nIf this value is provided as \\"relative\\", then actual consumption will be returned.\\n","schema":{"type":"string","default":"cumulative","enum":["cumulative","relative"]}},{"in":"query","name":"sort","required":false,"schema":{"type":"string","default":"asc","enum":["asc","desc"]},"description":"If this value is provided as \\"asc\\", then the results will be sorted by the timestamp field in ascending order.\\nIf this value is provided as \\"desc\\", then the results will be sorted by the timestamp field in descending order.\\n"}],"responses":{"200":{"description":"Readings retrieved successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/MeterReading"}},"hits":{"type":"number","example":120},"firstRecordCreatedAt":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"put":{"operationId":"updateMeterReading","summary":"Update Meter Reading","description":"Updates a meter reading.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter entity."},{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter entity."},{"in":"query","name":"timestamp","required":true,"description":"The timestamp when the reading was created.","schema":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}],"requestBody":{"description":"Update meter reading payload.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterReading"}}}},"responses":{"200":{"description":"Meter reading updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MeterReading"}}}}}},"400":{"$ref":"#/components/responses/InvalidRequestUpdateMeterReading"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"delete":{"operationId":"deleteMeterReading","summary":"Delete Meter Reading","description":"Deletes a meter reading.","tags":["ECP Admin"],"security":[{"EpilotAuth":[]}],"parameters":[{"in":"path","name":"meter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the meter entity."},{"in":"path","name":"counter_id","schema":{"$ref":"#/components/schemas/Id"},"required":true,"description":"The ID of the counter entity."},{"in":"query","name":"timestamp","required":true,"description":"The timestamp when the reading was created.","schema":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}],"responses":{"200":{"description":"Meter reading deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"meterId":{"$ref":"#/components/schemas/Id"},"counterId":{"$ref":"#/components/schemas/Id"},"timestamp":{"type":"string","example":"2022-10-01T20:00:00.000Z"}}}}}}}},"400":{"$ref":"#/components/responses/InvalidRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"responses":{"InvalidRequest":{"description":"The request could not be validated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"Unauthorized":{"description":"Could not authenticate the user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"Forbidden":{"description":"The user is not allowed to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"NotFound":{"description":"The specified resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"InternalServerError":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResp"}}}},"InvalidRequestUpdateMeter":{"description":"The request could not be validated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ErrorResp"},{"properties":{"reason":{"type":"string","enum":["missing_params"]}}}]}}}},"InvalidRequestCreateMeterReading":{"description":"The request could not be validated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ErrorResp"},{"properties":{"reason":{"type":"string","enum":["contract_period","no_counter","no_direction","timestamp_future","less_than_previous","greater_than_subsequent","meter_decommissioned"]}}}]}}}},"InvalidRequestCreateMeterReadings":{"description":"The request could not be validated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ErrorResp"},{"properties":{"reason":{"type":"string","enum":["too_many_records","timestamp_future","duplicate_reading","less_than_previous"]}}}]}}}},"InvalidRequestCreateMeterReadingFromSubmission":{"description":"The request could not be validated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ErrorResp"},{"properties":{"reason":{"type":"string","enum":["timestamp_future","less_than_previous","greater_than_subsequent"]}}}]}}}},"InvalidRequestCreateReadingWithMeter":{"description":"The request could not be validated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ErrorResp"},{"properties":{"reason":{"type":"string","enum":["missing_params","timestamp_future","less_than_previous","contract_period","greater_than_subsequent"]}}}]}}}},"InvalidRequestUpdateMeterReading":{"description":"The request could not be validated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ErrorResp"},{"properties":{"reason":{"type":"string","enum":["missing_params","timestamp_future","less_than_previous","greater_than_subsequent"]}}}]}}}}},"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Authorization header with ePilot OAuth2 bearer token","bearerFormat":"JWT"},"PortalAuth":{"type":"http","scheme":"bearer","description":"Authorization header with customer portal OAuth2 bearer token","bearerFormat":"JWT"},"EitherAuth":{"type":"http","scheme":"bearer","description":"Portal or Epilot Bearer Token"},"AsOrganization":{"type":"apiKey","in":"header","name":"x-ivy-org-id","description":"Set organization id as internal user"}},"schemas":{"ErrorResp":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}}},"EntityId":{"type":"string","format":"uuid"},"EntitySlug":{"description":"URL-friendly identifier for the entity schema","type":"string","example":"contact"},"BaseEntity":{"type":"object","properties":{"_id":{"$ref":"#/components/schemas/EntityId","description":"Entity ID","example":"3fa85f64-5717-4562-b3fc-2c963f66afa6"},"_title":{"type":"string","description":"Title of the entity","example":"Example Entity"},"_org":{"type":"string","description":"Organization ID the entity belongs to","example":"123"},"_tags":{"type":"array","items":{"type":"string"},"description":"Array of entity tags","example":["example","mock"]},"_created_at":{"type":"string","format":"date-time","description":"Creation timestamp of the entity","example":"2021-02-09T12:41:43.662Z"},"_updated_at":{"type":"string","format":"date-time","description":"Last update timestamp of the entity","example":"2021-02-09T12:41:43.662Z"}},"required":["_id","_title","_org","_created_at","_updated_at"]},"Entity":{"type":"object","properties":{},"additionalProperties":true},"EntityItem":{"allOf":[{"$ref":"#/components/schemas/BaseEntity"},{"$ref":"#/components/schemas/Entity"}]},"Id":{"type":"string"},"EntityRelation":{"type":"object","properties":{"entity_id":{"$ref":"#/components/schemas/EntityId"},"_slug":{"type":"string","enum":["contact","contract"]}}},"Meter":{"allOf":[{"$ref":"#/components/schemas/BaseEntity"},{"type":"object","required":["_schema"],"properties":{"_schema":{"type":"string","enum":["meter"],"description":"The schema type of the meter"},"ma_lo_id":{"type":"string","example":"A09-123","description":"The MA-LO ID of the meter"},"meter_type":{"type":"string","enum":["three-phase-meter","bellow-gas-meter","rotary-piston-meter","smart-meter","performance-meter","maximum-meter","turbine-gas-meter","ultrasonic-gas-meter","alternating-current-meter","modern-metering-system","intelligent-measuring-system","electronic-meter"],"description":"The type of the meter"},"tariff_type":{"type":"string","example":"Peak load tariff","description":"The tariff type of the meter"},"meter_number":{"type":"string","example":"J-1093-1AK","description":"The number of the meter"},"sector":{"type":"string","enum":["power","water","gas","district_heating","waste_water"],"description":"The sector to which the meter belongs"},"location":{"type":"object","example":[{"country":"Germany","city":"Koln","postal_code":81475,"street":"Melatengürtel","street_number":71,"additional_info":"5. Etage","_tags":["billing","delivery"]}],"description":"The location information of the meter"},"used_for":{"type":"string","example":"Domestic Usage","description":"The usage purpose of the meter"},"manufacturer":{"type":"string","example":"Energy One","description":"The manufacturer of the meter"},"calibration_date":{"type":"string","example":"2022-10-10T00:00:00.000Z","description":"The calibration date of the meter"},"contract":{"type":"object","properties":{"$relation":{"type":"array","items":{"$ref":"#/components/schemas/EntityRelation"}}},"description":"The contract associated with the meter"},"customer":{"type":"object","properties":{"$relation":{"type":"array","items":{"$ref":"#/components/schemas/EntityRelation"}}},"description":"The customer associated with the meter"},"last_reading":{"type":"string","example":"2022-10-10T00:00:00.000Z","description":"The timestamp of the last reading"}}}]},"Direction":{"type":"string","enum":["feed-in","feed-out"]},"TariffType":{"type":"string","enum":["ht","nt"]},"Reason":{"type":"string","nullable":true,"example":"Storing the feed-in record","description":"The reason for recording the reading"},"ReadBy":{"type":"string","nullable":true,"example":"John Doe","description":"The person who recorded the reading"},"ReadingStatus":{"type":"string","nullable":true,"enum":["valid","in-validation","implausible",null,""]},"MeterReading":{"type":"object","required":["value","meter_id","source"],"properties":{"value":{"type":"number","example":240,"description":"The reading value of the meter"},"read_by":{"$ref":"#/components/schemas/ReadBy"},"reason":{"$ref":"#/components/schemas/Reason"},"meter_id":{"$ref":"#/components/schemas/EntityId","description":"The ID of the associated meter"},"counter_id":{"$ref":"#/components/schemas/EntityId","description":"The ID of the associated meter counter"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the reading (feed-in or feed-out)"},"timestamp":{"type":"string","description":"If the value is not provided, the system will be set with the time the request is processed.","example":"2022-10-10T00:00:00.000Z"},"source":{"$ref":"#/components/schemas/Source","description":"The source of the reading"},"status":{"$ref":"#/components/schemas/ReadingStatus","description":"The status of the reading"}}},"MeterCounter":{"allOf":[{"$ref":"#/components/schemas/BaseEntity"},{"type":"object","required":["_schema"],"properties":{"_id":{"$ref":"#/components/schemas/EntityId"},"_schema":{"type":"string","enum":["meter_counter"]},"obis_number":{"type":"string","example":"A-34","description":"The OBIS number of the meter counter"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the meter counter"},"transformer_ratio":{"type":"number","example":70,"description":"The transformer ratio of the meter counter"},"unit":{"$ref":"#/components/schemas/Unit","description":"The unit of measurement for the meter counter"},"forecast_reading_value":{"type":"string","example":270,"description":"The forecast reading value of the meter counter"},"forecast_as_of":{"type":"string","example":"2022-12-10T00:00:00.000Z","description":"The date as of which the forecast reading value is applicable"},"current_consumption":{"type":"number","example":240,"description":"The current consumption value of the meter counter"},"last_reading":{"type":"string","example":"2022-10-10T00:00:00.000Z","description":"The timestamp of the last reading"},"conversion_factor":{"type":"number","example":3,"description":"The conversion factor for the meter counter"},"tariff_type":{"$ref":"#/components/schemas/TariffType","description":"The tariff type of the meter counter"}}}]},"CounterReadingOnSubmission":{"type":"object","required":["counterId","direction","value"],"properties":{"counterId":{"$ref":"#/components/schemas/Id","description":"The ID of the associated meter counter"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the reading (feed-in or feed-out)"},"unit":{"type":"string","enum":["w","wh","kw","kWh","kvarh","mw","mWh","unit","cubic-meter","hour","day","month","year","percentage"],"description":"The unit of measurement for the reading"},"value":{"type":"number","example":240,"description":"The reading value of the meter counter"}}},"SubmissionMeterReading":{"type":"object","required":["meterId"],"nullable":true,"properties":{"meterId":{"$ref":"#/components/schemas/Id","description":"The ID of the associated meter"},"readings":{"type":"array","items":{"$ref":"#/components/schemas/CounterReadingOnSubmission"},"description":"- The counter readings of a meter\\n- This is only sent when the user is authenticated while submitting a journey\\n"},"readingValue":{"type":"number","example":240,"description":"The reading value of the meter when the counterId is passed or when the meterType is one-tariff"},"readingDate":{"type":"string","description":"If the value is not provided, the system will be set with the time the request is processed.","example":"2022-10-10T10:10:00.000Z"},"readBy":{"type":"string","example":"John Doe","description":"The person who recorded the reading"},"reason":{"$ref":"#/components/schemas/Reason"},"maloId":{"type":"string","example":"A09-123","description":"The MA-LO ID of the meter"},"obisNumber":{"type":"string","example":"A-34","description":"The OBIS number of the meter counter"},"readingUnit":{"$ref":"#/components/schemas/Unit","description":"The unit of measurement for the reading"},"meterType":{"type":"string","enum":["one_tariff","two_tariff","bi_directional"],"description":"The type of the meter"},"feedInValue":{"type":"number","example":240,"description":"The feed-in value of the meter when meterType is one-tariff or bi-directional"},"feedOutValue":{"type":"number","example":240,"description":"The feed-out value of the meter when meterType is bi-directional"},"htValue":{"type":"number","example":240,"description":"The high-peak tariff value of the meter when meterType is two-tariff"},"ntValue":{"type":"number","example":240,"description":"The off-peak tariff value of the meter when meterType is two-tariff"}}},"Unit":{"type":"string","enum":["w","wh","kw","kWh","kvarh","mw","mWh","unit","cubic-meter","hour","day","month","year","percentage"]},"Source":{"type":"string","enum":["ECP","ERP","360","journey-submission"]},"ActionLabel":{"type":"object","properties":{"en":{"type":"string","nullable":true},"de":{"type":"string","nullable":true}}},"Rule":{"type":"object","properties":{"entity":{"type":"string","nullable":true},"attribute":{"type":"string","nullable":true},"attribute_value":{"type":"string","nullable":true}}},"JourneyActions":{"type":"object","properties":{"journey_id":{"type":"string","nullable":true},"action_label":{"type":"object","$ref":"#/components/schemas/ActionLabel","nullable":true},"slug":{"type":"string","nullable":true},"rules":{"type":"array","items":{"$ref":"#/components/schemas/Rule"},"nullable":true}}},"ReadingWithMeter":{"type":"object","properties":{"ma_lo_id":{"type":"string","example":"A09-123","description":"The MA-LO ID of the meter"},"meter_id":{"$ref":"#/components/schemas/Id","description":"The ID of the associated meter"},"obis_number":{"type":"string","example":"A-34","description":"The OBIS number of the meter counter"},"unit":{"$ref":"#/components/schemas/Unit","description":"The unit of measurement for the reading"},"direction":{"$ref":"#/components/schemas/Direction","description":"The direction of the reading"},"tariff_type":{"$ref":"#/components/schemas/TariffType","description":"The tariff type of the reading"},"value":{"type":"number","example":240,"description":"The reading value"},"read_by":{"$ref":"#/components/schemas/ReadBy"},"reason":{"$ref":"#/components/schemas/Reason"},"timestamp":{"type":"string","description":"If the value is not provided, the system will be set with the time the request is processed.","example":"2022-10-10T10:10:00.000Z"},"source":{"$ref":"#/components/schemas/Source","description":"The source of the reading"}}},"ActivityId":{"type":"string","format":"ulid","description":"See https://github.com/ulid/spec","example":"01F130Q52Q6MWSNS8N2AVXV4JN"}},"parameters":{"ActivityIdQueryParam":{"name":"activity_id","description":"Activity to include in event feed","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ActivityId"}}}},"servers":[{"url":"https://metering.sls.epilot.io"}]}')}},t={},r=function r(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s].call(o.exports,o,o.exports,r),o.exports}(914),s=exports;for(var n in r)s[n]=r[n];r.__esModule&&Object.defineProperty(s,"__esModule",{value:!0})})();
package/dist/openapi.d.ts CHANGED
@@ -24,6 +24,48 @@ declare namespace Components {
24
24
  export type Forbidden = Schemas.ErrorResp;
25
25
  export type InternalServerError = Schemas.ErrorResp;
26
26
  export type InvalidRequest = Schemas.ErrorResp;
27
+ export interface InvalidRequestCreateMeterReading {
28
+ /**
29
+ * Error message
30
+ */
31
+ message?: string;
32
+ reason?: "contract_period" | "no_counter" | "no_direction" | "timestamp_future" | "less_than_previous" | "greater_than_subsequent" | "meter_decommissioned";
33
+ }
34
+ export interface InvalidRequestCreateMeterReadingFromSubmission {
35
+ /**
36
+ * Error message
37
+ */
38
+ message?: string;
39
+ reason?: "timestamp_future" | "less_than_previous" | "greater_than_subsequent";
40
+ }
41
+ export interface InvalidRequestCreateMeterReadings {
42
+ /**
43
+ * Error message
44
+ */
45
+ message?: string;
46
+ reason?: "too_many_records" | "timestamp_future" | "duplicate_reading" | "less_than_previous";
47
+ }
48
+ export interface InvalidRequestCreateReadingWithMeter {
49
+ /**
50
+ * Error message
51
+ */
52
+ message?: string;
53
+ reason?: "missing_params" | "timestamp_future" | "less_than_previous" | "contract_period" | "greater_than_subsequent";
54
+ }
55
+ export interface InvalidRequestUpdateMeter {
56
+ /**
57
+ * Error message
58
+ */
59
+ message?: string;
60
+ reason?: "missing_params";
61
+ }
62
+ export interface InvalidRequestUpdateMeterReading {
63
+ /**
64
+ * Error message
65
+ */
66
+ message?: string;
67
+ reason?: "missing_params" | "timestamp_future" | "less_than_previous" | "greater_than_subsequent";
68
+ }
27
69
  export type NotFound = Schemas.ErrorResp;
28
70
  export type Unauthorized = Schemas.ErrorResp;
29
71
  }
@@ -280,6 +322,12 @@ declare namespace Components {
280
322
  customer?: {
281
323
  $relation?: EntityRelation[];
282
324
  };
325
+ /**
326
+ * The timestamp of the last reading
327
+ * example:
328
+ * 2022-10-10T00:00:00.000Z
329
+ */
330
+ last_reading?: string;
283
331
  }
284
332
  export interface MeterCounter {
285
333
  _id: EntityId /* uuid */;
@@ -571,13 +619,71 @@ declare namespace Components {
571
619
  }
572
620
  }
573
621
  declare namespace Paths {
622
+ namespace BatchWriteMeterReadings {
623
+ namespace Parameters {
624
+ export type ActivityId = /**
625
+ * See https://github.com/ulid/spec
626
+ * example:
627
+ * 01F130Q52Q6MWSNS8N2AVXV4JN
628
+ */
629
+ Components.Schemas.ActivityId /* ulid */;
630
+ export type Async = boolean;
631
+ }
632
+ export interface QueryParameters {
633
+ async?: Parameters.Async;
634
+ activity_id?: Parameters.ActivityId;
635
+ }
636
+ export interface RequestBody {
637
+ readings?: {
638
+ /**
639
+ * The reading value of the meter
640
+ * example:
641
+ * 240
642
+ */
643
+ value: number;
644
+ read_by?: /**
645
+ * The person who recorded the reading
646
+ * example:
647
+ * John Doe
648
+ */
649
+ Components.Schemas.ReadBy;
650
+ reason?: /**
651
+ * The reason for recording the reading
652
+ * example:
653
+ * Storing the feed-in record
654
+ */
655
+ Components.Schemas.Reason;
656
+ meter_id: Components.Schemas.EntityId /* uuid */;
657
+ counter_id?: Components.Schemas.EntityId /* uuid */;
658
+ direction?: Components.Schemas.Direction;
659
+ /**
660
+ * If the value is not provided, the system will be set with the time the request is processed.
661
+ * example:
662
+ * 2022-10-10T00:00:00.000Z
663
+ */
664
+ timestamp?: string;
665
+ source: Components.Schemas.Source;
666
+ status?: Components.Schemas.ReadingStatus;
667
+ operation?: "create" | "update" | "delete";
668
+ }[];
669
+ }
670
+ namespace Responses {
671
+ export interface $200 {
672
+ data?: Components.Schemas.MeterReading[];
673
+ }
674
+ export type $400 = Components.Responses.InvalidRequestCreateMeterReadings;
675
+ export type $401 = Components.Responses.Unauthorized;
676
+ export type $403 = Components.Responses.Forbidden;
677
+ export type $500 = Components.Responses.InternalServerError;
678
+ }
679
+ }
574
680
  namespace CreateMeterReading {
575
681
  export type RequestBody = Components.Schemas.MeterReading;
576
682
  namespace Responses {
577
683
  export interface $200 {
578
684
  data?: Components.Schemas.MeterReading;
579
685
  }
580
- export type $400 = Components.Responses.InvalidRequest;
686
+ export type $400 = Components.Responses.InvalidRequestCreateMeterReading;
581
687
  export type $401 = Components.Responses.Unauthorized;
582
688
  export type $403 = Components.Responses.Forbidden;
583
689
  export type $500 = Components.Responses.InternalServerError;
@@ -607,7 +713,7 @@ declare namespace Paths {
607
713
  export interface $200 {
608
714
  message?: "Successfully Processed";
609
715
  }
610
- export type $400 = Components.Responses.InvalidRequest;
716
+ export type $400 = Components.Responses.InvalidRequestCreateMeterReadingFromSubmission;
611
717
  export type $401 = Components.Responses.Unauthorized;
612
718
  export type $403 = Components.Responses.Forbidden;
613
719
  export type $500 = Components.Responses.InternalServerError;
@@ -634,7 +740,7 @@ declare namespace Paths {
634
740
  export interface $200 {
635
741
  data?: Components.Schemas.MeterReading[];
636
742
  }
637
- export type $400 = Components.Responses.InvalidRequest;
743
+ export type $400 = Components.Responses.InvalidRequestCreateMeterReadings;
638
744
  export type $401 = Components.Responses.Unauthorized;
639
745
  export type $403 = Components.Responses.Forbidden;
640
746
  export type $500 = Components.Responses.InternalServerError;
@@ -646,7 +752,7 @@ declare namespace Paths {
646
752
  export interface $200 {
647
753
  data?: Components.Schemas.MeterReading;
648
754
  }
649
- export type $400 = Components.Responses.InvalidRequest;
755
+ export type $400 = Components.Responses.InvalidRequestCreateReadingWithMeter;
650
756
  export type $401 = Components.Responses.Unauthorized;
651
757
  export type $403 = Components.Responses.Forbidden;
652
758
  export type $500 = Components.Responses.InternalServerError;
@@ -866,6 +972,12 @@ declare namespace Paths {
866
972
  customer?: {
867
973
  $relation?: Components.Schemas.EntityRelation[];
868
974
  };
975
+ /**
976
+ * The timestamp of the last reading
977
+ * example:
978
+ * 2022-10-10T00:00:00.000Z
979
+ */
980
+ last_reading?: string;
869
981
  journey_actions?: Components.Schemas.JourneyActions;
870
982
  }[];
871
983
  }
@@ -875,53 +987,6 @@ declare namespace Paths {
875
987
  export type $500 = Components.Responses.InternalServerError;
876
988
  }
877
989
  }
878
- namespace GetDownSampleReadingsByInterval {
879
- namespace Parameters {
880
- export type CounterId = Components.Schemas.Id;
881
- export type Direction = Components.Schemas.Direction;
882
- /**
883
- * example:
884
- * 2022-10-10
885
- */
886
- export type EndDate = string;
887
- export type GroupBy = "day" | "week" | "month" | "year";
888
- export type MeterId = Components.Schemas.Id;
889
- export type Sort = "asc" | "desc";
890
- /**
891
- * example:
892
- * 2022-10-01
893
- */
894
- export type StartDate = string;
895
- }
896
- export interface PathParameters {
897
- meter_id: Parameters.MeterId;
898
- counter_id: Parameters.CounterId;
899
- }
900
- export interface QueryParameters {
901
- start_date?: /**
902
- * example:
903
- * 2022-10-01
904
- */
905
- Parameters.StartDate;
906
- end_date?: /**
907
- * example:
908
- * 2022-10-10
909
- */
910
- Parameters.EndDate;
911
- group_by?: Parameters.GroupBy;
912
- direction?: Parameters.Direction;
913
- sort?: Parameters.Sort;
914
- }
915
- namespace Responses {
916
- export interface $200 {
917
- data?: Components.Schemas.MeterReading[];
918
- }
919
- export type $400 = Components.Responses.InvalidRequest;
920
- export type $401 = Components.Responses.Unauthorized;
921
- export type $403 = Components.Responses.Forbidden;
922
- export type $500 = Components.Responses.InternalServerError;
923
- }
924
- }
925
990
  namespace GetMeter {
926
991
  namespace Parameters {
927
992
  export type Id = Components.Schemas.EntityId /* uuid */;
@@ -1066,7 +1131,7 @@ declare namespace Paths {
1066
1131
  export interface $200 {
1067
1132
  data?: Components.Schemas.Meter;
1068
1133
  }
1069
- export type $400 = Components.Responses.InvalidRequest;
1134
+ export type $400 = Components.Responses.InvalidRequestUpdateMeter;
1070
1135
  export type $401 = Components.Responses.Unauthorized;
1071
1136
  export type $403 = Components.Responses.Forbidden;
1072
1137
  export type $500 = Components.Responses.InternalServerError;
@@ -1098,7 +1163,7 @@ declare namespace Paths {
1098
1163
  export interface $200 {
1099
1164
  data?: Components.Schemas.MeterReading;
1100
1165
  }
1101
- export type $400 = Components.Responses.InvalidRequest;
1166
+ export type $400 = Components.Responses.InvalidRequestUpdateMeterReading;
1102
1167
  export type $401 = Components.Responses.Unauthorized;
1103
1168
  export type $403 = Components.Responses.Forbidden;
1104
1169
  export type $500 = Components.Responses.InternalServerError;
@@ -1187,6 +1252,16 @@ export interface OperationMethods {
1187
1252
  data?: Paths.CreateMeterReadings.RequestBody,
1188
1253
  config?: AxiosRequestConfig
1189
1254
  ): OperationResponse<Paths.CreateMeterReadings.Responses.$200>
1255
+ /**
1256
+ * batchWriteMeterReadings - Batch Write Readings
1257
+ *
1258
+ * Upserts/Deletes multiple meter readings at once. Limited to 100 readings per request.
1259
+ */
1260
+ 'batchWriteMeterReadings'(
1261
+ parameters?: Parameters<Paths.BatchWriteMeterReadings.QueryParameters> | null,
1262
+ data?: Paths.BatchWriteMeterReadings.RequestBody,
1263
+ config?: AxiosRequestConfig
1264
+ ): OperationResponse<Paths.BatchWriteMeterReadings.Responses.$200>
1190
1265
  /**
1191
1266
  * createMeterReadingFromSubmission - Create Meter Reading from Submission
1192
1267
  *
@@ -1250,19 +1325,6 @@ export interface OperationMethods {
1250
1325
  data?: any,
1251
1326
  config?: AxiosRequestConfig
1252
1327
  ): OperationResponse<Paths.DeleteMeterReading.Responses.$200>
1253
- /**
1254
- * getDownSampleReadingsByInterval - Get Down Sample Readings by Interval
1255
- *
1256
- * Retrieves the downsampled data of the entire readings specified in an interval.
1257
- * If the start_date and end_date are equal, then it returns the readings of the specified date.
1258
- * The start_date should be less than or equal to the end_date.
1259
- *
1260
- */
1261
- 'getDownSampleReadingsByInterval'(
1262
- parameters?: Parameters<Paths.GetDownSampleReadingsByInterval.QueryParameters & Paths.GetDownSampleReadingsByInterval.PathParameters> | null,
1263
- data?: any,
1264
- config?: AxiosRequestConfig
1265
- ): OperationResponse<Paths.GetDownSampleReadingsByInterval.Responses.$200>
1266
1328
  }
1267
1329
 
1268
1330
  export interface PathsDictionary {
@@ -1360,6 +1422,18 @@ export interface PathsDictionary {
1360
1422
  config?: AxiosRequestConfig
1361
1423
  ): OperationResponse<Paths.CreateMeterReadings.Responses.$200>
1362
1424
  }
1425
+ ['/v2/metering/readings']: {
1426
+ /**
1427
+ * batchWriteMeterReadings - Batch Write Readings
1428
+ *
1429
+ * Upserts/Deletes multiple meter readings at once. Limited to 100 readings per request.
1430
+ */
1431
+ 'post'(
1432
+ parameters?: Parameters<Paths.BatchWriteMeterReadings.QueryParameters> | null,
1433
+ data?: Paths.BatchWriteMeterReadings.RequestBody,
1434
+ config?: AxiosRequestConfig
1435
+ ): OperationResponse<Paths.BatchWriteMeterReadings.Responses.$200>
1436
+ }
1363
1437
  ['/v1/metering/reading/submission']: {
1364
1438
  /**
1365
1439
  * createMeterReadingFromSubmission - Create Meter Reading from Submission
@@ -1431,21 +1505,6 @@ export interface PathsDictionary {
1431
1505
  config?: AxiosRequestConfig
1432
1506
  ): OperationResponse<Paths.DeleteMeterReading.Responses.$200>
1433
1507
  }
1434
- ['/v1/metering/down-sample/readings/{meter_id}/{counter_id}']: {
1435
- /**
1436
- * getDownSampleReadingsByInterval - Get Down Sample Readings by Interval
1437
- *
1438
- * Retrieves the downsampled data of the entire readings specified in an interval.
1439
- * If the start_date and end_date are equal, then it returns the readings of the specified date.
1440
- * The start_date should be less than or equal to the end_date.
1441
- *
1442
- */
1443
- 'get'(
1444
- parameters?: Parameters<Paths.GetDownSampleReadingsByInterval.QueryParameters & Paths.GetDownSampleReadingsByInterval.PathParameters> | null,
1445
- data?: any,
1446
- config?: AxiosRequestConfig
1447
- ): OperationResponse<Paths.GetDownSampleReadingsByInterval.Responses.$200>
1448
- }
1449
1508
  }
1450
1509
 
1451
1510
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
package/dist/openapi.json CHANGED
@@ -12,6 +12,32 @@
12
12
  {
13
13
  "name": "ECP Admin",
14
14
  "description": "APIs defined for a ECP Admin"
15
+ },
16
+ {
17
+ "name": "meter_schema",
18
+ "x-displayName": "Meter",
19
+ "description": "<SchemaDefinition schemaRef=\"#/components/schemas/Meter\" />\n"
20
+ },
21
+ {
22
+ "name": "meter_counter_schema",
23
+ "x-displayName": "Meter Counter",
24
+ "description": "<SchemaDefinition schemaRef=\"#/components/schemas/MeterCounter\" />\n"
25
+ }
26
+ ],
27
+ "x-tagGroups": [
28
+ {
29
+ "name": "APIs",
30
+ "tags": [
31
+ "ECP",
32
+ "ECP Admin"
33
+ ]
34
+ },
35
+ {
36
+ "name": "Schemas",
37
+ "tags": [
38
+ "meter_schema",
39
+ "meter_counter_schema"
40
+ ]
15
41
  }
16
42
  ],
17
43
  "security": [
@@ -193,7 +219,7 @@
193
219
  }
194
220
  },
195
221
  "400": {
196
- "$ref": "#/components/responses/InvalidRequest"
222
+ "$ref": "#/components/responses/InvalidRequestUpdateMeter"
197
223
  },
198
224
  "401": {
199
225
  "$ref": "#/components/responses/Unauthorized"
@@ -428,7 +454,7 @@
428
454
  }
429
455
  },
430
456
  "400": {
431
- "$ref": "#/components/responses/InvalidRequest"
457
+ "$ref": "#/components/responses/InvalidRequestCreateMeterReading"
432
458
  },
433
459
  "401": {
434
460
  "$ref": "#/components/responses/Unauthorized"
@@ -509,7 +535,105 @@
509
535
  }
510
536
  },
511
537
  "400": {
512
- "$ref": "#/components/responses/InvalidRequest"
538
+ "$ref": "#/components/responses/InvalidRequestCreateMeterReadings"
539
+ },
540
+ "401": {
541
+ "$ref": "#/components/responses/Unauthorized"
542
+ },
543
+ "403": {
544
+ "$ref": "#/components/responses/Forbidden"
545
+ },
546
+ "500": {
547
+ "$ref": "#/components/responses/InternalServerError"
548
+ }
549
+ }
550
+ }
551
+ },
552
+ "/v2/metering/readings": {
553
+ "post": {
554
+ "operationId": "batchWriteMeterReadings",
555
+ "summary": "Batch Write Readings",
556
+ "description": "Upserts/Deletes multiple meter readings at once. Limited to 100 readings per request.",
557
+ "tags": [
558
+ "ECP Admin"
559
+ ],
560
+ "security": [
561
+ {
562
+ "EpilotAuth": []
563
+ }
564
+ ],
565
+ "parameters": [
566
+ {
567
+ "in": "query",
568
+ "name": "async",
569
+ "description": "Don't wait for the reading to become available in GetReadings API. Useful for large migrations",
570
+ "required": false,
571
+ "schema": {
572
+ "type": "boolean",
573
+ "default": true
574
+ }
575
+ },
576
+ {
577
+ "$ref": "#/components/parameters/ActivityIdQueryParam"
578
+ }
579
+ ],
580
+ "requestBody": {
581
+ "description": "Meter readings payload. Limited to 100 readings per request.",
582
+ "required": true,
583
+ "content": {
584
+ "application/json": {
585
+ "schema": {
586
+ "type": "object",
587
+ "properties": {
588
+ "readings": {
589
+ "type": "array",
590
+ "items": {
591
+ "allOf": [
592
+ {
593
+ "$ref": "#/components/schemas/MeterReading"
594
+ },
595
+ {
596
+ "properties": {
597
+ "operation": {
598
+ "type": "string",
599
+ "enum": [
600
+ "create",
601
+ "update",
602
+ "delete"
603
+ ],
604
+ "default": "create"
605
+ }
606
+ }
607
+ }
608
+ ]
609
+ }
610
+ }
611
+ }
612
+ }
613
+ }
614
+ }
615
+ },
616
+ "responses": {
617
+ "200": {
618
+ "description": "Meter readings created successfully.",
619
+ "content": {
620
+ "application/json": {
621
+ "schema": {
622
+ "type": "object",
623
+ "properties": {
624
+ "data": {
625
+ "type": "array",
626
+ "items": {
627
+ "$ref": "#/components/schemas/MeterReading"
628
+ }
629
+ }
630
+ }
631
+ }
632
+ }
633
+ }
634
+ },
635
+ "400": {
636
+ "$ref": "#/components/responses/InvalidRequestCreateMeterReadings"
513
637
  },
514
638
  "401": {
515
639
  "$ref": "#/components/responses/Unauthorized"
@@ -592,7 +716,7 @@
592
716
  }
593
717
  },
594
718
  "400": {
595
- "$ref": "#/components/responses/InvalidRequest"
719
+ "$ref": "#/components/responses/InvalidRequestCreateMeterReadingFromSubmission"
596
720
  },
597
721
  "401": {
598
722
  "$ref": "#/components/responses/Unauthorized"
@@ -729,7 +853,7 @@
729
853
  }
730
854
  },
731
855
  "400": {
732
- "$ref": "#/components/responses/InvalidRequest"
856
+ "$ref": "#/components/responses/InvalidRequestCreateReadingWithMeter"
733
857
  },
734
858
  "401": {
735
859
  "$ref": "#/components/responses/Unauthorized"
@@ -965,7 +1089,7 @@
965
1089
  }
966
1090
  },
967
1091
  "400": {
968
- "$ref": "#/components/responses/InvalidRequest"
1092
+ "$ref": "#/components/responses/InvalidRequestUpdateMeterReading"
969
1093
  },
970
1094
  "401": {
971
1095
  "$ref": "#/components/responses/Unauthorized"
@@ -1062,130 +1186,6 @@
1062
1186
  }
1063
1187
  }
1064
1188
  }
1065
- },
1066
- "/v1/metering/down-sample/readings/{meter_id}/{counter_id}": {
1067
- "get": {
1068
- "operationId": "getDownSampleReadingsByInterval",
1069
- "summary": "Get Down Sample Readings by Interval",
1070
- "description": "Retrieves the downsampled data of the entire readings specified in an interval.\nIf the start_date and end_date are equal, then it returns the readings of the specified date.\nThe start_date should be less than or equal to the end_date.\n",
1071
- "tags": [
1072
- "ECP Admin",
1073
- "ECP"
1074
- ],
1075
- "security": [
1076
- {
1077
- "EitherAuth": []
1078
- }
1079
- ],
1080
- "parameters": [
1081
- {
1082
- "in": "path",
1083
- "name": "meter_id",
1084
- "schema": {
1085
- "$ref": "#/components/schemas/Id"
1086
- },
1087
- "required": true,
1088
- "description": "The ID of the meter."
1089
- },
1090
- {
1091
- "in": "path",
1092
- "name": "counter_id",
1093
- "schema": {
1094
- "$ref": "#/components/schemas/Id"
1095
- },
1096
- "required": true,
1097
- "description": "The ID of the counter."
1098
- },
1099
- {
1100
- "in": "query",
1101
- "name": "start_date",
1102
- "required": false,
1103
- "description": "If not provided, the system will default to 2000-01-01.",
1104
- "schema": {
1105
- "type": "string",
1106
- "example": "2022-10-01"
1107
- }
1108
- },
1109
- {
1110
- "in": "query",
1111
- "name": "end_date",
1112
- "required": false,
1113
- "description": "If not provided, the system will default to today's date.",
1114
- "schema": {
1115
- "type": "string",
1116
- "example": "2022-10-10"
1117
- }
1118
- },
1119
- {
1120
- "in": "query",
1121
- "name": "group_by",
1122
- "schema": {
1123
- "type": "string",
1124
- "default": "day",
1125
- "enum": [
1126
- "day",
1127
- "week",
1128
- "month",
1129
- "year"
1130
- ]
1131
- }
1132
- },
1133
- {
1134
- "in": "query",
1135
- "name": "direction",
1136
- "required": false,
1137
- "schema": {
1138
- "$ref": "#/components/schemas/Direction"
1139
- }
1140
- },
1141
- {
1142
- "in": "query",
1143
- "name": "sort",
1144
- "required": false,
1145
- "schema": {
1146
- "type": "string",
1147
- "default": "asc",
1148
- "enum": [
1149
- "asc",
1150
- "desc"
1151
- ]
1152
- },
1153
- "description": "If this value is provided as \"asc\", then the results will be sorted by the timestamp field in ascending order.\nIf this value is provided as \"desc\", then the results will be sorted by the timestamp field in descending order.\n"
1154
- }
1155
- ],
1156
- "responses": {
1157
- "200": {
1158
- "description": "Downsampled readings retrieved successfully.",
1159
- "content": {
1160
- "application/json": {
1161
- "schema": {
1162
- "type": "object",
1163
- "properties": {
1164
- "data": {
1165
- "type": "array",
1166
- "items": {
1167
- "$ref": "#/components/schemas/MeterReading"
1168
- }
1169
- }
1170
- }
1171
- }
1172
- }
1173
- }
1174
- },
1175
- "400": {
1176
- "$ref": "#/components/responses/InvalidRequest"
1177
- },
1178
- "401": {
1179
- "$ref": "#/components/responses/Unauthorized"
1180
- },
1181
- "403": {
1182
- "$ref": "#/components/responses/Forbidden"
1183
- },
1184
- "500": {
1185
- "$ref": "#/components/responses/InternalServerError"
1186
- }
1187
- }
1188
- }
1189
1189
  }
1190
1190
  },
1191
1191
  "components": {
@@ -1239,6 +1239,168 @@
1239
1239
  }
1240
1240
  }
1241
1241
  }
1242
+ },
1243
+ "InvalidRequestUpdateMeter": {
1244
+ "description": "The request could not be validated",
1245
+ "content": {
1246
+ "application/json": {
1247
+ "schema": {
1248
+ "allOf": [
1249
+ {
1250
+ "$ref": "#/components/schemas/ErrorResp"
1251
+ },
1252
+ {
1253
+ "properties": {
1254
+ "reason": {
1255
+ "type": "string",
1256
+ "enum": [
1257
+ "missing_params"
1258
+ ]
1259
+ }
1260
+ }
1261
+ }
1262
+ ]
1263
+ }
1264
+ }
1265
+ }
1266
+ },
1267
+ "InvalidRequestCreateMeterReading": {
1268
+ "description": "The request could not be validated",
1269
+ "content": {
1270
+ "application/json": {
1271
+ "schema": {
1272
+ "allOf": [
1273
+ {
1274
+ "$ref": "#/components/schemas/ErrorResp"
1275
+ },
1276
+ {
1277
+ "properties": {
1278
+ "reason": {
1279
+ "type": "string",
1280
+ "enum": [
1281
+ "contract_period",
1282
+ "no_counter",
1283
+ "no_direction",
1284
+ "timestamp_future",
1285
+ "less_than_previous",
1286
+ "greater_than_subsequent",
1287
+ "meter_decommissioned"
1288
+ ]
1289
+ }
1290
+ }
1291
+ }
1292
+ ]
1293
+ }
1294
+ }
1295
+ }
1296
+ },
1297
+ "InvalidRequestCreateMeterReadings": {
1298
+ "description": "The request could not be validated",
1299
+ "content": {
1300
+ "application/json": {
1301
+ "schema": {
1302
+ "allOf": [
1303
+ {
1304
+ "$ref": "#/components/schemas/ErrorResp"
1305
+ },
1306
+ {
1307
+ "properties": {
1308
+ "reason": {
1309
+ "type": "string",
1310
+ "enum": [
1311
+ "too_many_records",
1312
+ "timestamp_future",
1313
+ "duplicate_reading",
1314
+ "less_than_previous"
1315
+ ]
1316
+ }
1317
+ }
1318
+ }
1319
+ ]
1320
+ }
1321
+ }
1322
+ }
1323
+ },
1324
+ "InvalidRequestCreateMeterReadingFromSubmission": {
1325
+ "description": "The request could not be validated",
1326
+ "content": {
1327
+ "application/json": {
1328
+ "schema": {
1329
+ "allOf": [
1330
+ {
1331
+ "$ref": "#/components/schemas/ErrorResp"
1332
+ },
1333
+ {
1334
+ "properties": {
1335
+ "reason": {
1336
+ "type": "string",
1337
+ "enum": [
1338
+ "timestamp_future",
1339
+ "less_than_previous",
1340
+ "greater_than_subsequent"
1341
+ ]
1342
+ }
1343
+ }
1344
+ }
1345
+ ]
1346
+ }
1347
+ }
1348
+ }
1349
+ },
1350
+ "InvalidRequestCreateReadingWithMeter": {
1351
+ "description": "The request could not be validated",
1352
+ "content": {
1353
+ "application/json": {
1354
+ "schema": {
1355
+ "allOf": [
1356
+ {
1357
+ "$ref": "#/components/schemas/ErrorResp"
1358
+ },
1359
+ {
1360
+ "properties": {
1361
+ "reason": {
1362
+ "type": "string",
1363
+ "enum": [
1364
+ "missing_params",
1365
+ "timestamp_future",
1366
+ "less_than_previous",
1367
+ "contract_period",
1368
+ "greater_than_subsequent"
1369
+ ]
1370
+ }
1371
+ }
1372
+ }
1373
+ ]
1374
+ }
1375
+ }
1376
+ }
1377
+ },
1378
+ "InvalidRequestUpdateMeterReading": {
1379
+ "description": "The request could not be validated",
1380
+ "content": {
1381
+ "application/json": {
1382
+ "schema": {
1383
+ "allOf": [
1384
+ {
1385
+ "$ref": "#/components/schemas/ErrorResp"
1386
+ },
1387
+ {
1388
+ "properties": {
1389
+ "reason": {
1390
+ "type": "string",
1391
+ "enum": [
1392
+ "missing_params",
1393
+ "timestamp_future",
1394
+ "less_than_previous",
1395
+ "greater_than_subsequent"
1396
+ ]
1397
+ }
1398
+ }
1399
+ }
1400
+ ]
1401
+ }
1402
+ }
1403
+ }
1242
1404
  }
1243
1405
  },
1244
1406
  "securitySchemes": {
@@ -1486,6 +1648,11 @@
1486
1648
  }
1487
1649
  },
1488
1650
  "description": "The customer associated with the meter"
1651
+ },
1652
+ "last_reading": {
1653
+ "type": "string",
1654
+ "example": "2022-10-10T00:00:00.000Z",
1655
+ "description": "The timestamp of the last reading"
1489
1656
  }
1490
1657
  }
1491
1658
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/metering-client",
3
- "version": "0.6.1",
3
+ "version": "0.7.1",
4
4
  "description": "API Client for epilot Metering API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/metering.yaml",
26
26
  "typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
27
27
  "build": "tsc && npm run build:patch && npm run bundle-definition",
28
- "build:patch": "sed -i '/^__exportStar.*openapi.*$/d' dist/index.js",
28
+ "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
29
29
  "build:watch": "npm run build && tsc -w",
30
30
  "prepublishOnly": "npm run typegen && npm run build",
31
31
  "lint": "../../node_modules/eslint/bin/eslint.js src"
@@ -69,6 +69,5 @@
69
69
  "typescript": "^4.1.3",
70
70
  "webpack": "^5.18.0",
71
71
  "webpack-cli": "^4.4.0"
72
- },
73
- "gitHead": "cb7e6acc938eb178e531c19834ea8bd0d6445e6f"
72
+ }
74
73
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 epilot GmbH
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.