@soos-io/api-client
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -9,2 +9,3 @@ import { AxiosError } from "axios"; | ||
apiClientName: string; | ||
skipDebugResponseLogging?: boolean; | ||
} | ||
@@ -11,0 +12,0 @@ declare class SOOSApiClient { |
@@ -11,3 +11,3 @@ "use strict"; | ||
class SOOSApiClient { | ||
static createHttpClient({ baseUri, apiKey, apiClientName }) { | ||
static createHttpClient({ baseUri, apiKey, apiClientName, skipDebugResponseLogging, }) { | ||
const client = axios_1.default.create({ | ||
@@ -35,3 +35,5 @@ baseURL: baseUri, | ||
client.interceptors.response.use((response) => { | ||
SOOSLogger_1.soosLogger.debug(apiClientName, `Response Body: ${JSON.stringify(response.data)}`); | ||
if (skipDebugResponseLogging !== true) { | ||
SOOSLogger_1.soosLogger.debug(apiClientName, `Response Body: ${JSON.stringify(response.data)}`); | ||
} | ||
return response; | ||
@@ -38,0 +40,0 @@ }, (rejectedResponse) => { |
@@ -41,2 +41,3 @@ import { AttributionFileTypeEnum, AttributionFormatEnum, AttributionStatusEnum } from "../enums"; | ||
private readonly client; | ||
private createApiClient; | ||
constructor(apiKey: string, baseUri?: string); | ||
@@ -43,0 +44,0 @@ createAttributionRequest({ clientId, projectHash, branchHash, scanId, format, fileType, includeDependentProjects, includeVulnerabilities, includeOriginalSbom, }: IPostScanAttributionRequest): Promise<IAttributionStatusModel>; |
@@ -8,9 +8,11 @@ "use strict"; | ||
constructor(apiKey, baseUri = constants_1.SOOS_CONSTANTS.Urls.API.Analysis) { | ||
this.apiKey = apiKey; | ||
this.baseUri = baseUri; | ||
this.client = SOOSApiClient_1.default.create({ | ||
this.createApiClient = (skipDebugResponseLogging) => SOOSApiClient_1.default.create({ | ||
baseUri: this.baseUri, | ||
apiKey: this.apiKey, | ||
apiClientName: "Analysis Attribution API", | ||
skipDebugResponseLogging, | ||
}); | ||
this.apiKey = apiKey; | ||
this.baseUri = baseUri; | ||
this.client = this.createApiClient(false); | ||
} | ||
@@ -32,3 +34,4 @@ async createAttributionRequest({ clientId, projectHash, branchHash, scanId, format, fileType, includeDependentProjects, includeVulnerabilities, includeOriginalSbom, }) { | ||
async getScanAttribution({ clientId, projectHash, branchHash, scanId, attributionId, }) { | ||
const response = await this.client.get(`clients/${clientId}/projects/${projectHash}/branches/${branchHash}/scans/${scanId}/attributions/${attributionId}`); | ||
const client = this.createApiClient(true); | ||
const response = await client.get(`clients/${clientId}/projects/${projectHash}/branches/${branchHash}/scans/${scanId}/attributions/${attributionId}`); | ||
return response.data; | ||
@@ -35,0 +38,0 @@ } |
@@ -290,3 +290,3 @@ "use strict"; | ||
}); | ||
if (output && workingDirectory && finalAttributionStatus.filename) { | ||
if (finalAttributionStatus.filename) { | ||
logging_1.soosLogger.info(`${format} report generated successfully.`); | ||
@@ -293,0 +293,0 @@ const outputFile = Path.join(workingDirectory, finalAttributionStatus.filename); |
{ | ||
"name": "@soos-io/api-client", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "This is the SOOS API Client for registered clients leveraging the various integrations to the SOOS platform.", | ||
@@ -66,3 +66,3 @@ "main": "dist/index.js", | ||
"@types/jest": "^29.5.14", | ||
"@types/node": "^20.17.13", | ||
"@types/node": "^20.17.16", | ||
"jest": "^29.1.2", | ||
@@ -69,0 +69,0 @@ "prettier": "^3.4.2", |
338350
3440