UNPKG

6.13 kBTypeScriptView Raw
1/// <reference types="node" />
2import basem = require('./ClientApiBases');
3import VsoBaseInterfaces = require('./interfaces/common/VsoBaseInterfaces');
4import AlertInterfaces = require("./interfaces/AlertInterfaces");
5import VSSInterfaces = require("./interfaces/common/VSSInterfaces");
6export interface IAlertApi extends basem.ClientApiBase {
7 getAlert(project: string, alertId: number, repository: string, ref?: string, expand?: AlertInterfaces.ExpandOption): Promise<AlertInterfaces.Alert>;
8 getAlerts(project: string, repository: string, top?: number, orderBy?: string, criteria?: AlertInterfaces.SearchCriteria, continuationToken?: string): Promise<VSSInterfaces.PagedList<AlertInterfaces.Alert>>;
9 getAlertSarif(project: string, alertId: number, repository: string, ref?: string, expand?: AlertInterfaces.ExpandOption): Promise<string>;
10 updateAlert(stateUpdate: AlertInterfaces.AlertStateUpdate, project: string, alertId: number, repository: string): Promise<AlertInterfaces.Alert>;
11 getAlertInstances(project: string, alertId: number, repository: string, ref?: string): Promise<AlertInterfaces.AlertAnalysisInstance[]>;
12 updateAlertsMetadata(alertsMetadata: AlertInterfaces.AlertMetadata[], project: string, repository: string): Promise<AlertInterfaces.AlertMetadataChange[]>;
13 uploadSarif(customHeaders: any, contentStream: NodeJS.ReadableStream, project: string, repository: string): Promise<number>;
14 getUxFilters(project: string, repository: string, alertType: AlertInterfaces.AlertType): Promise<AlertInterfaces.UxFilters>;
15 getSarif(sarifId: number): Promise<AlertInterfaces.SarifUploadStatus>;
16}
17export declare class AlertApi extends basem.ClientApiBase implements IAlertApi {
18 constructor(baseUrl: string, handlers: VsoBaseInterfaces.IRequestHandler[], options?: VsoBaseInterfaces.IRequestOptions);
19 /**
20 * Get an alert.
21 *
22 * @param {string} project - Project ID or project name
23 * @param {number} alertId - ID of alert to retrieve
24 * @param {string} repository - Name or id of a repository that alert is part of
25 * @param {string} ref
26 * @param {AlertInterfaces.ExpandOption} expand - Expand alert attributes. Possible options are {ValidationFingerprint, None}
27 */
28 getAlert(project: string, alertId: number, repository: string, ref?: string, expand?: AlertInterfaces.ExpandOption): Promise<AlertInterfaces.Alert>;
29 /**
30 * Get alerts for a repository
31 *
32 * @param {string} project - Project ID or project name
33 * @param {string} repository - The name or ID of the repository
34 * @param {number} top - The maximum number of alerts to return
35 * @param {string} orderBy - Must be "id" "firstSeen" "lastSeen" "fixedOn" or "severity" Defaults to "id"
36 * @param {AlertInterfaces.SearchCriteria} criteria - Options to limit the alerts returned
37 * @param {string} continuationToken - If there are more alerts than can be returned, a continuation token is placed in the "x-ms-continuationtoken" header. Use that token here to get the next page of alerts
38 */
39 getAlerts(project: string, repository: string, top?: number, orderBy?: string, criteria?: AlertInterfaces.SearchCriteria, continuationToken?: string): Promise<VSSInterfaces.PagedList<AlertInterfaces.Alert>>;
40 /**
41 * Get an alert.
42 *
43 * @param {string} project - Project ID or project name
44 * @param {number} alertId - ID of alert to retrieve
45 * @param {string} repository - Name or id of a repository that alert is part of
46 * @param {string} ref
47 * @param {AlertInterfaces.ExpandOption} expand - Expand alert attributes. Possible options are {ValidationFingerprint, None}
48 */
49 getAlertSarif(project: string, alertId: number, repository: string, ref?: string, expand?: AlertInterfaces.ExpandOption): Promise<string>;
50 /**
51 * Update the status of an alert
52 *
53 * @param {AlertInterfaces.AlertStateUpdate} stateUpdate - The new status of the alert
54 * @param {string} project - Project ID or project name
55 * @param {number} alertId - The ID of the alert
56 * @param {string} repository - The name or ID of the repository
57 */
58 updateAlert(stateUpdate: AlertInterfaces.AlertStateUpdate, project: string, alertId: number, repository: string): Promise<AlertInterfaces.Alert>;
59 /**
60 * Get instances of an alert.
61 *
62 * @param {string} project - Project ID or project name
63 * @param {number} alertId - ID of alert to retrieve
64 * @param {string} repository - Name or id of a repository that alert is part of
65 * @param {string} ref
66 */
67 getAlertInstances(project: string, alertId: number, repository: string, ref?: string): Promise<AlertInterfaces.AlertAnalysisInstance[]>;
68 /**
69 * Update alert metadata associations.
70 *
71 * @param {AlertInterfaces.AlertMetadata[]} alertsMetadata - A list of metadata to associate with alerts.
72 * @param {string} project - Project ID or project name
73 * @param {string} repository - The name or ID of the repository.
74 */
75 updateAlertsMetadata(alertsMetadata: AlertInterfaces.AlertMetadata[], project: string, repository: string): Promise<AlertInterfaces.AlertMetadataChange[]>;
76 /**
77 * Upload a Sarif containing security alerts
78 *
79 * @param {NodeJS.ReadableStream} contentStream - Content to upload
80 * @param {string} project - Project ID or project name
81 * @param {string} repository - The name or ID of a repository
82 */
83 uploadSarif(customHeaders: any, contentStream: NodeJS.ReadableStream, project: string, repository: string): Promise<number>;
84 /**
85 * @param {string} project - Project ID or project name
86 * @param {string} repository
87 * @param {AlertInterfaces.AlertType} alertType
88 */
89 getUxFilters(project: string, repository: string, alertType: AlertInterfaces.AlertType): Promise<AlertInterfaces.UxFilters>;
90 /**
91 * Get the status of the Sarif processing job
92 *
93 * @param {number} sarifId - Sarif ID returned when the Sarif was uploaded
94 */
95 getSarif(sarifId: number): Promise<AlertInterfaces.SarifUploadStatus>;
96}