import { Injectable } from "@angular/core" ; import { Connector } from "../connector.service" ; import { SystemInfoMapDto , SystemInfoDetailMapDto } from "./system-info.dto" ; import { SystemInfoVo , SystemInfoDetailVo } from "./system-info.vo" ; @ Injectable ( ) export class SystemInfoService { constructor ( private connector ) { } getSystemList ( ) { return this . connector . get < Array < string > > ( `/system/list` ) ; } getSystemInfoDetail ( system , begin , end ) { if ( begin >= end ) throw new Error ( "begin >= end" ) ; if ( end - begin > 2 * 60 * 60 ) throw new Error ( "too large" ) ; return this . connector . get < SystemInfoDetailMapDto > ( `/system/${ system }` , { begin : begin , end : end , detail : true , count : - 1 } ) . then ( ( data ) => { return SystemInfoDetailVo . parse ( data ) ; } ) ; } getSystemInfo ( system , begin , end ) { return this . connector . get < SystemInfoMapDto > ( `/system/${ system }` , { begin : begin , end : end , count : - 1 } ) . then ( ( data ) => SystemInfoVo . parse ( data ) ) ; } }