1- import * as os from "os" ;
21import fs from "fs-extra" ;
3- import process from "process" ;
42import {
53 ContentType ,
64 DocsPortalManagementController ,
@@ -26,6 +24,7 @@ import { Sdl } from "../../types/sdl/sdl.js";
2624import { FilePath } from "../../types/file/filePath.js" ;
2725import { DirectoryPath } from "../../types/file/directoryPath.js" ;
2826import { FileService } from "../file-service.js" ;
27+ import { envInfo } from "../env-info.js" ;
2928
3029export class PortalService {
3130 private readonly CONTENT_TYPE = ContentType . EnumMultipartformdata ;
@@ -121,20 +120,12 @@ export class PortalService {
121120 return `X-Auth-Key ${ key ?? "" } ` ;
122121 } ;
123122
124- private getUserAgent ( ) : string {
125- const osInfo = `${ os . platform ( ) } ${ os . release ( ) } ` ;
126- const engine = "Node.js" ;
127- const engineVersion = process . version ;
128-
129- return `APIMATIC CLI - [OS: ${ osInfo } , Engine: ${ engine } /${ engineVersion } ]` ;
130- }
131-
132123 private createApiClient = ( authorizationHeader : string ) : Client => {
133124 return new Client ( {
134125 customHeaderAuthenticationCredentials : {
135126 Authorization : authorizationHeader
136127 } ,
137- userAgent : this . getUserAgent ( ) ,
128+ userAgent : envInfo . getUserAgent ( ) ,
138129 timeout : this . TIMEOUT
139130 } ) ;
140131 } ;
@@ -196,4 +187,4 @@ export class PortalService {
196187 ) ;
197188 }
198189 } ;
199- }
190+ }
0 commit comments