import { toQueryString } from "../../utils" ; import { SdkClient } from "../common/sdk-client" ; import { AnomalyDetectionModels } from "./anomaly-detection-models" ; export class extends SdkClient export class AnomalyDetectionClient extends SdkClient { private _baseUrl : string = "/api/anomalydetection/v3" ; summary param { Array < Timeseries > } ioTTimeSeriesItems param { number } epsilon param { number } minPointsPerCluster param { 'EUCLIDEAN' | 'MANHATTAN' | 'CHEBYSHEV' } distanceMeasureAlgorithm param { string } name returns { Array < AnomalyDetectionModels . Timeseries > } throws memberof public async PostModel ( ioTTimeSeriesItems , epsilon , minPointsPerCluster , distanceMeasureAlgorithm ? , name ? ) { if ( ioTTimeSeriesItems === null || ioTTimeSeriesItems === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "ioTTimeSeriesItems" , "Required parameter ioTTimeSeriesItems was null or undefined when calling modelsPost." ) ; } if ( epsilon === null || epsilon === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "epsilon" , "Required parameter epsilon was null or undefined when calling modelsPost." ) ; } if ( minPointsPerCluster === null || minPointsPerCluster === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "minPointsPerCluster" , "Required parameter minPointsPerCluster was null or undefined when calling modelsPost." ) ; } const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models?${ toQueryString ( { epsilon , minPointsPerCluster , distanceMeasureAlgorithm , name , } ) }` , body : ioTTimeSeriesItems || { } , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as AnomalyDetectionModels . Model ; } summary param { Array < AnomalyDetectionModels . Timeseries > } ioTTimeSeriesItems param { string } modelID returns { Promise < Array < AnomalyDetectionModels . Anomaly > > } throws memberof public async DetectAnomalies ( ioTTimeSeriesItems , modelID ) { if ( ioTTimeSeriesItems === null || ioTTimeSeriesItems === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "ioTTimeSeriesItems" , "Required parameter ioTTimeSeriesItems was null or undefined when calling detectanomaliesPost." ) ; } if ( modelID === null || modelID === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "modelID" , "Required parameter modelID was null or undefined when calling detectanomaliesPost." ) ; } const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/detectanomalies?${ toQueryString ( { modelID } ) }` , body : ioTTimeSeriesItems || { } , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as Array < AnomalyDetectionModels . Anomaly > ; } summary param { number } epsilon param { number } minPointsPerCluster param { string } assetId param { string } aspectName param { Date } from param { Date } to param { 'EUCLIDEAN' | 'MANHATTAN' | 'CHEBYSHEV' } distanceMeasureAlgorithm param { string } name returns { Promise < AnomalyDetectionModels . Model > } throws memberof public async PostModelDirect ( epsilon , minPointsPerCluster , assetId , aspectName , from , to , distanceMeasureAlgorithm ? , name ? ) { if ( epsilon === null || epsilon === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "epsilon" , "Required parameter epsilon was null or undefined when calling modelsDirectPost." ) ; } if ( minPointsPerCluster === null || minPointsPerCluster === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "minPointsPerCluster" , "Required parameter minPointsPerCluster was null or undefined when calling modelsDirectPost." ) ; } if ( assetId === null || assetId === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "assetId" , "Required parameter assetId was null or undefined when calling modelsDirectPost." ) ; } if ( aspectName === null || aspectName === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "aspectName" , "Required parameter aspectName was null or undefined when calling modelsDirectPost." ) ; } if ( from === null || from === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "from" , "Required parameter from was null or undefined when calling modelsDirectPost." ) ; } if ( to === null || to === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "to" , "Required parameter to was null or undefined when calling modelsDirectPost." ) ; } const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/modelsDirect?${ toQueryString ( { epsilon , minPointsPerCluster , assetId , aspectName , from , to , distanceMeasureAlgorithm , name , } ) }` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as AnomalyDetectionModels . Model ; } summary param { string } modelID param { string } assetId param { string } aspectName param { Date } from param { Date } to returns { Promise < Array < AnomalyDetectionModels . Anomaly > > } throws memberof public async DetectAnomaliesDirect ( modelID , assetId , aspectName , from , to ) { if ( modelID === null || modelID === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "modelID" , "Required parameter modelID was null or undefined when calling detectanomaliesDirectPost." ) ; } if ( assetId === null || assetId === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "assetId" , "Required parameter assetId was null or undefined when calling detectanomaliesDirectPost." ) ; } if ( aspectName === null || aspectName === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "aspectName" , "Required parameter aspectName was null or undefined when calling detectanomaliesDirectPost." ) ; } if ( from === null || from === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "from" , "Required parameter from was null or undefined when calling detectanomaliesDirectPost." ) ; } if ( to === null || to === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "to" , "Required parameter to was null or undefined when calling detectanomaliesDirectPost." ) ; } const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/detectanomaliesDirect?${ toQueryString ( { modelID , assetId , aspectName , from , to , } ) }` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as Array < AnomalyDetectionModels . Anomaly > ; } summary param { string } id throws memberof public async CancelDetectAnomaliesJob ( id ) { if ( id === null || id === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "id" , "Required parameter id was null or undefined when calling detectAnomaliesJobsIdCancelPost." ) ; } await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/detectAnomaliesJobs/${ id }/cancel` , additionalHeaders : { "Content-Type" : "application/json" } , noResponse : true , } ) ; } summary param { string } id returns { Promise < AnomalyDetectionModels . ReasoningJobInfo > } throws memberof public async GetDetectAnomaliesJob ( id ) { if ( id === null || id === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "id" , "Required parameter id was null or undefined when calling detectAnomaliesJobsIdGet." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/detectAnomaliesJobs/${ id }` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as AnomalyDetectionModels . ReasoningJobInfo ; } summary param { AnomalyDetectionModels . SubmitReasoningRequest } submitReasoningRequest returns { Promise < AnomalyDetectionModels . ReasoningJobInfo > } throws memberof public async PostDetectAnomaliesJob ( submitReasoningRequest ? ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/detectAnomaliesJobs` , body : submitReasoningRequest || { } , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as AnomalyDetectionModels . ReasoningJobInfo ; } summary param { AnomalyDetectionModels . SubmitTrainingRequest } submitTrainingRequest returns { Promise < AnomalyDetectionModels . TrainingJobInfo > } throws memberof public async PostTrainModelJob ( submitTrainingRequest ? ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/trainModelJobs` , body : submitTrainingRequest || { } , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as AnomalyDetectionModels . TrainingJobInfo ; } summary param { string } id returns { Promise < AnomalyDetectionModels . TrainingJobInfo > } throws memberof public async GetTrainModelJob ( id ) { if ( id === null || id === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "id" , "Required parameter id was null or undefined when calling trainModelJobsIdGet." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/trainModelJobs/${ id }` , additionalHeaders : { "Content-Type" : "application/json" } , noResponse : true , } ) ; return result as AnomalyDetectionModels . TrainingJobInfo ; } summary param { string } id throws memberof public async CancelTrainModelJob ( id ) { if ( id === null || id === undefined ) { throw new AnomalyDetectionModels . RequiredError ( "id" , "Required parameter id was null or undefined when calling trainModelJobsIdCancelPost." ) ; } await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/trainModelJobs/${ id }/cancel` , additionalHeaders : { "Content-Type" : "application/json" } , noResponse : true , } ) ; } }