AlertRestClient class

Base class that should be used (derived from) to make requests to VSS REST apis

Extends

Constructors

AlertRestClient(IVssRestClientOptions)

Methods

getAlert(string, number, string, string, ExpandOption)

Get an alert.

getAlertInstances(string, number, string, string)

Get instances of an alert.

getAlerts(string, string, number, string, SearchCriteria, string)

Get alerts for a repository

getAlertSarif(string, number, string, string, ExpandOption)

Get an alert.

getSarif(number)

Get the status of the Sarif processing job

getUxFilters(string, string, AlertType)
updateAlert(AlertStateUpdate, string, number, string)

Update the status of an alert

updateAlertsMetadata(AlertMetadata[], string, string)

Update alert metadata associations.

uploadSarif(string, string, string, String)

Upload a Sarif containing security alerts

Constructor Details

AlertRestClient(IVssRestClientOptions)

new AlertRestClient(options: IVssRestClientOptions)

Parameters

Method Details

getAlert(string, number, string, string, ExpandOption)

Get an alert.

function getAlert(project: string, alertId: number, repository: string, ref?: string, expand?: ExpandOption): Promise<Alert>

Parameters

project

string

Project ID or project name

alertId

number

ID of alert to retrieve

repository

string

Name or id of a repository that alert is part of

ref

string

expand
ExpandOption

Expand alert attributes. Possible options are {ValidationFingerprint, None}

Returns

Promise<Alert>

getAlertInstances(string, number, string, string)

Get instances of an alert.

function getAlertInstances(project: string, alertId: number, repository: string, ref?: string): Promise<AlertAnalysisInstance[]>

Parameters

project

string

Project ID or project name

alertId

number

ID of alert to retrieve

repository

string

Name or id of a repository that alert is part of

ref

string

Returns

getAlerts(string, string, number, string, SearchCriteria, string)

Get alerts for a repository

function getAlerts(project: string, repository: string, top?: number, orderBy?: string, criteria?: SearchCriteria, continuationToken?: string): Promise<PagedList<Alert>>

Parameters

project

string

Project ID or project name

repository

string

The name or ID of the repository

top

number

The maximum number of alerts to return

orderBy

string

Must be "id" "firstSeen" "lastSeen" "fixedOn" or "severity" Defaults to "id"

criteria
SearchCriteria

Options to limit the alerts returned

continuationToken

string

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

Returns

Promise<PagedList<Alert>>

getAlertSarif(string, number, string, string, ExpandOption)

Get an alert.

function getAlertSarif(project: string, alertId: number, repository: string, ref?: string, expand?: ExpandOption): Promise<string>

Parameters

project

string

Project ID or project name

alertId

number

ID of alert to retrieve

repository

string

Name or id of a repository that alert is part of

ref

string

expand
ExpandOption

Expand alert attributes. Possible options are {ValidationFingerprint, None}

Returns

Promise<string>

getSarif(number)

Get the status of the Sarif processing job

function getSarif(sarifId: number): Promise<SarifUploadStatus>

Parameters

sarifId

number

Sarif ID returned when the Sarif was uploaded

Returns

getUxFilters(string, string, AlertType)

function getUxFilters(project: string, repository: string, alertType: AlertType): Promise<UxFilters>

Parameters

project

string

Project ID or project name

repository

string

alertType
AlertType

Returns

Promise<UxFilters>

updateAlert(AlertStateUpdate, string, number, string)

Update the status of an alert

function updateAlert(stateUpdate: AlertStateUpdate, project: string, alertId: number, repository: string): Promise<Alert>

Parameters

stateUpdate
AlertStateUpdate

The new status of the alert

project

string

Project ID or project name

alertId

number

The ID of the alert

repository

string

The name or ID of the repository

Returns

Promise<Alert>

updateAlertsMetadata(AlertMetadata[], string, string)

Update alert metadata associations.

function updateAlertsMetadata(alertsMetadata: AlertMetadata[], project: string, repository: string): Promise<AlertMetadataChange[]>

Parameters

alertsMetadata

AlertMetadata[]

A list of metadata to associate with alerts.

project

string

Project ID or project name

repository

string

The name or ID of the repository.

Returns

Promise<AlertMetadataChange[]>

uploadSarif(string, string, string, String)

Upload a Sarif containing security alerts

function uploadSarif(content: string, project: string, repository: string, notificationFlag?: String): Promise<number>

Parameters

content

string

Content to upload

project

string

Project ID or project name

repository

string

The name or ID of a repository

notificationFlag

String

Header to signal that this is a progress notification

Returns

Promise<number>