async def get_connection_log_items( from_time: Optional[str] = Query(None, alias='from'), to_time: Optional[str] = Query(None, alias='to'), ): _from = parse_iso_parameter(from_time) _to = parse_iso_parameter(to_time) return get_connection_log(_from, _to)
async def get_message_log_items( chargepoint_id: str, action: Optional[List[Action]] = Query(None), from_time: Optional[str] = Query(None, alias='from'), to_time: Optional[str] = Query(None, alias='to'), ): _from = parse_iso_parameter(from_time) _to = parse_iso_parameter(to_time) return get_message_log(chargepoint_id, action, _from, _to)
async def get_transaction_items(db: Session = Depends(get_db), from_time: Optional[str] = Query(None, alias='from'), to_time: Optional[str] = Query(None, alias='to'), over: Optional[int] = Query(None)): _from = parse_iso_parameter(from_time) _to = parse_iso_parameter(to_time) return get_transactions(db, from_timestamp=_from, to_timestamp=_to, meter_over=over)
async def get_usage_items(db: Session = Depends(get_db), chargepoint: Optional[str] = None, from_time: Optional[str] = Query(None, alias='from'), to_time: Optional[str] = Query(None, alias='to'), named: Optional[bool] = False, header: Optional[bool] = False): _from = parse_iso_parameter(from_time) _to = parse_iso_parameter(to_time) result = get_usage(db, chargepoint=chargepoint, from_timestamp=_from, to_timestamp=_to) if header: return [['Date', 'Count', 'kWh']] + result elif named: return [r._asdict() for r in result] if named else result return result