import { toQueryString } from "../../utils" ; import { SdkClient } from "../common/sdk-client" ; import { TrendPredictionModels } from "./trend-prediction-models" ; export class extends SdkClient export class TrendPredictionClient extends SdkClient { private _baseUrl = "/api/trendprediction/v3" ; param { TrendPredictionModels . TrainBody } modelData returns { Promise < TrendPredictionModels . ModelDto > } memberOf public async Train ( modelData ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/train` , body : modelData , } ) ; return result as TrendPredictionModels . ModelDto ; } param { TrendPredictionModels . TrainBodyDirect } modelData param { { from : Date ; to : Date ; * } } params param params . from param params . to returns { Promise < TrendPredictionModels . ModelDtoDirect > } memberOf public async TrainDirect ( modelData , params ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/trainDirect?${ toQueryString ( params ) }` , body : modelData , } ) ; return result as TrendPredictionModels . ModelDtoDirect ; } param { TrendPredictionModels . PredictBody } modelData example returns { Promise < TrendPredictionModels . PredictionDataArray > } memberOf public async Predict ( modelData ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/predict` , body : modelData , } ) ; return result as TrendPredictionModels . PredictionDataArray ; } param { TrendPredictionModels . PredictBodyDirect } modelData param { { from : Date ; to : Date ; * } } params param params . from param params . to example returns { Promise < TrendPredictionModels . PredictionDataArrayDirect > } memberOf public async PredictDirect ( modelData , params ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/predictDirect?${ toQueryString ( params ) }` , body : modelData , } ) ; return result as TrendPredictionModels . PredictionDataArrayDirect ; } param { TrendPredictionModels . TrainPredictBody } modelData returns { Promise < TrendPredictionModels . PredictionDataArray > } memberOf public async TrainAndPredict ( modelData ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/trainAndPredict` , body : modelData , } ) ; return result as TrendPredictionModels . PredictionDataArray ; } param { TrendPredictionModels . TrainPredictBodyDirect } modelData param { { trainFrom : Date ; trainTo : Date ; predictFrom : Date ; predictTo : Date ; * } } params param params . trainFrom param params . trainTo param params . predictFrom param params . predictTo returns { Promise < TrendPredictionModels . PredictionDataArrayDirect > } memberOf public async TrainAndPredictDirect ( modelData , params ) { const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/trainAndPredictDirect?${ toQueryString ( params ) }` , body : modelData , } ) ; return result as TrendPredictionModels . PredictionDataArrayDirect ; } param { ( { entityId : string ; sort ? : "asc" | "desc" ; * } ) } optional returns { Promise < TrendPredictionModels . ModelDto [ ] > } memberOf public async GetModels ( optional = { entityId : "*" , sort : "asc" , size : 100 } ) { const qs = toQueryString ( optional ) ; return ( await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models?${ qs }` , message : "GetModels" , } ) ) as TrendPredictionModels . ModelDto [ ] ; } param { string } id returns { Promise < TrendPredictionModels . ModelDto > } memberOf public async GetModel ( id ) { return ( await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ id }` , message : "GetModel" , } ) ) as TrendPredictionModels . ModelDto ; } param { string } id returns memberOf public async DeleteModel ( id ) { return await this . HttpAction ( { verb : "DELETE" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ id }` , message : "DeleteModel" , noResponse : true , } ) ; } }