Skip to content

Commit 10fb7b2

Browse files
committed
add features
1 parent 60f8355 commit 10fb7b2

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

index.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,60 @@ class SocketSdk {
275275
}
276276
}
277277

278+
/**
279+
* @param {string} orgSlug
280+
* @param {string} fullScanId
281+
* @returns {Promise<SocketSdkResultType<'getOrgFullScan'>>}
282+
*/
283+
async getOrgFullScan (orgSlug, fullScanId) {
284+
const orgSlugParam = encodeURIComponent(orgSlug)
285+
const fullScanIdParam = encodeURIComponent(fullScanId)
286+
287+
try {
288+
const client = await this.#getClient()
289+
const data = await client.get(`orgs/${orgSlugParam}/full-scans/${fullScanIdParam}`).json()
290+
return { success: true, status: 200, data }
291+
} catch (err) {
292+
return /** @type {SocketSdkErrorType<'getOrgFullScan'>} */ (this.#handleApiError(err))
293+
}
294+
}
295+
296+
/**
297+
* @param {string} orgSlug
298+
* @param {string} fullScanId
299+
* @returns {Promise<SocketSdkResultType<'getOrgFullScanMetadata'>>}
300+
*/
301+
async getOrgFullScanMetadata (orgSlug, fullScanId) {
302+
const orgSlugParam = encodeURIComponent(orgSlug)
303+
const fullScanIdParam = encodeURIComponent(fullScanId)
304+
305+
try {
306+
const client = await this.#getClient()
307+
const data = await client.get(`orgs/${orgSlugParam}/full-scans/${fullScanIdParam}/metadata`).json()
308+
return { success: true, status: 200, data }
309+
} catch (err) {
310+
return /** @type {SocketSdkErrorType<'getOrgFullScanMetadata'>} */ (this.#handleApiError(err))
311+
}
312+
}
313+
314+
/**
315+
* @param {string} orgSlug
316+
* @param {string} fullScanId
317+
* @returns {Promise<SocketSdkResultType<'deleteOrgFullScan'>>}
318+
*/
319+
async deleteOrgFullScan (orgSlug, fullScanId) {
320+
const orgSlugParam = encodeURIComponent(orgSlug)
321+
const fullScanIdParam = encodeURIComponent(fullScanId)
322+
323+
try {
324+
const client = await this.#getClient()
325+
const data = await client.delete(`orgs/${orgSlugParam}/full-scans/${fullScanIdParam}`).json()
326+
return { success: true, status: 200, data }
327+
} catch (err) {
328+
return /** @type {SocketSdkErrorType<'deleteOrgFullScan'>} */ (this.#handleApiError(err))
329+
}
330+
}
331+
278332
/**
279333
* @param {Array<{ organization?: string }>} selectors
280334
* @returns {Promise<SocketSdkResultType<'postSettings'>>}

0 commit comments

Comments
 (0)