import { toQueryString } from "../../utils" ; import { SdkClient } from "../common/sdk-client" ; import { modelDataTemplate } from "./model-data-template" ; import { ModelManagementModels } from "./model-models" ; export class extends SdkClient export class ModelManagementClient extends SdkClient { private _baseUrl : string = "/api/modelmanagement/v3" ; param { { pageNumber ? : number ; pageSize ? : number ; filter ? : string ; sort ? : string ; * } } params param params . pageNumber param params . pageSize param params . filter example param params . sort returns { Promise < ModelManagementModels . ModelArray > } example example memberOf public async GetModels ( params ? ) { const parameters = params || { } ; const { pageNumber , pageSize , filter , sort } = parameters ; const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models?${ toQueryString ( { pageNumber , pageSize , filter , sort } ) }` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as ModelManagementModels . ModelArray ; } param { string } id returns { Promise < ModelManagementModels . Model > } example memberOf public async GetModel ( id ) { if ( id === null || id === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling GetModel." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ id }` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as ModelManagementModels . Model ; } param { string } id param { ModelManagementModels . ModelDefinition } model returns { Promise < ModelManagementModels . Model > } throws example memberOf public async PatchModel ( id , model ) { if ( id === null || id === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling PatchModel." ) ; } if ( model === null || model === undefined ) { throw new ModelManagementModels . RequiredError ( "model" , "Required parameter model was null or undefined when calling PatchModel." ) ; } const result = await this . HttpAction ( { verb : "PATCH" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ id }` , body : model , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as ModelManagementModels . Model ; } param { string } id example memberOf public async DeleteModel ( id ) { if ( id === null || id === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling DeleteModel." ) ; } await this . HttpAction ( { verb : "DELETE" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ id }` , noResponse : true , } ) ; } param { any } file param { ModelManagementModels . ModelDefinition } metadata returns { Promise < ModelManagementModels . Model > } memberOf public async PostModel ( metadata , payload ) { if ( payload === null || payload === undefined ) { throw new ModelManagementModels . RequiredError ( "file" , "Required parameter file was null or undefined when calling postModel." ) ; } if ( metadata === null || metadata === undefined ) { throw new ModelManagementModels . RequiredError ( "metadata" , "Required parameter metadata was null or undefined when calling postModel." ) ; } const body = modelDataTemplate ( metadata , payload ) ; const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models` , body : body , multiPartFormData : true , additionalHeaders : { enctype : "multipart/form-data" } , } ) ; return result as ModelManagementModels . Model ; } param { { modelId ? : string ; pageNumber ? : number ; pageSize ? : number ; * } } params param params . modelId param params . pageNumber param params . pageSize returns { Promise < ModelManagementModels . VersionArray > } memberOf public async GetModelVersions ( params ? ) { const parameters = params || { } ; const { modelId , pageNumber , pageSize } = parameters ; if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling GetModelVersions." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions?${ toQueryString ( { pageNumber , pageSize } ) }` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as ModelManagementModels . VersionArray ; } param { string } modelId param { string } versionId example memberOf public async GetModelVersion ( modelId , versionId ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling GetModelVersion." ) ; } if ( versionId === null || versionId === undefined ) { throw new ModelManagementModels . RequiredError ( "versionId" , "Required parameter versionId was null or undefined when calling GetModelVersion." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions/${ versionId }` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as ModelManagementModels . Version ; } param { string } modelId param { string } versionId memberOf public async DownloadModelVersion ( modelId , versionId ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling GetModelVersion." ) ; } if ( versionId === null || versionId === undefined ) { throw new ModelManagementModels . RequiredError ( "versionId" , "Required parameter versionId was null or undefined when calling GetModelVersion." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions/${ versionId }` , additionalHeaders : { "Content-Type" : "application/octet-stream" } , rawResponse : true , } ) ; return result as Response ; } param { string } modelId returns { Promise < ModelManagementModels . Version > } example memberOf public async GetModelLastVersion ( modelId ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling modelsModelIdGet." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions/last` , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as ModelManagementModels . Version ; } param { string } modelId returns { Promise < ModelManagementModels . Version > } memberOf public async DownloadModelLastVersion ( modelId ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling modelsModelIdGet." ) ; } const result = await this . HttpAction ( { verb : "GET" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions/last` , additionalHeaders : { "Content-Type" : "application/octet-stream" } , rawResponse : true , } ) ; return result as Promise < Response > ; } summary param { string } modelId param { string } versionId example memberOf public async DeleteModelVersion ( modelId , versionId ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling modelsModelIdVersionsVersionIdDelete." ) ; } if ( versionId === null || versionId === undefined ) { throw new ModelManagementModels . RequiredError ( "versionId" , "Required parameter versionId was null or undefined when calling modelsModelIdVersionsVersionIdDelete." ) ; } const baseUrl = `${ this . _baseUrl }/models/{modelId}/versions/{versionId}` . replace ( `{${ "modelId" }}` , encodeURIComponent ( String ( modelId ) ) ) . replace ( `{${ "versionId" }}` , encodeURIComponent ( String ( versionId ) ) ) ; await this . HttpAction ( { verb : "DELETE" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : baseUrl , noResponse : true , } ) ; } param { string } modelId example memberOf public async DeleteModelLastVersion ( modelId ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling DeleteModelLastVersion." ) ; } await this . HttpAction ( { verb : "DELETE" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions/last` , noResponse : true , } ) ; } param { string } modelId param { ModelManagementModels . VersionDefinition } version returns { Promise < ModelManagementModels . VersionDefinition > } throws example memberOf public async PatchLastModelVersion ( modelId , version ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling PatchLastModelVersion." ) ; } if ( version === null || version === undefined ) { throw new ModelManagementModels . RequiredError ( "version" , "Required parameter version was null or undefined when calling PatchLastModelVersion." ) ; } const result = await this . HttpAction ( { verb : "PATCH" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions/last` , body : version , additionalHeaders : { "Content-Type" : "application/json" } , } ) ; return result as ModelManagementModels . VersionDefinition ; } param { string } modelId param { any } file param { ModelManagementModels . VersionDefinition } metadata returns { Promise < ModelManagementModels . Version > } memberOf public async PostModelVersion ( modelId , metadata , payload ) { if ( modelId === null || modelId === undefined ) { throw new ModelManagementModels . RequiredError ( "modelId" , "Required parameter modelId was null or undefined when calling postModelVersion." ) ; } if ( payload === null || payload === undefined ) { throw new ModelManagementModels . RequiredError ( "file" , "Required parameter file was null or undefined when calling postModelVersion." ) ; } if ( metadata === null || metadata === undefined ) { throw new ModelManagementModels . RequiredError ( "metadata" , "Required parameter metadata was null or undefined when calling postModelVersion." ) ; } const body = modelDataTemplate ( metadata , payload ) ; const result = await this . HttpAction ( { verb : "POST" , gateway : this . GetGateway ( ) , authorization : await this . GetToken ( ) , baseUrl : `${ this . _baseUrl }/models/${ modelId }/versions` , body : body , multiPartFormData : true , additionalHeaders : { enctype : "multipart/form-data" } , } ) ; return result as ModelManagementModels . Version ; } }