-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathProjectVulnerabilities.ts
83 lines (80 loc) · 2.23 KB
/
ProjectVulnerabilities.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper, endpoint } from '../infrastructure';
import type { SimpleProjectSchema } from './Projects';
import type {
GitlabAPIResponse,
PaginationRequestOptions,
PaginationTypes,
ShowExpanded,
Sudo,
} from '../infrastructure';
export interface ProjectVulnerabilitySchema extends Record<string, unknown> {
author_id: number;
confidence: string;
created_at: string;
description?: string;
dismissed_at?: string;
dismissed_by_id?: number;
due_date?: string;
finding: {
confidence: string;
created_at: string;
id: number;
location_fingerprint: string;
metadata_version: string;
name: string;
primary_identifier_id: number;
project_fingerprint: string;
project_id: number;
raw_metadata: string;
report_type: string;
scanner_id: number;
severity: string;
updated_at: string;
uuid: string;
vulnerability_id: number;
};
id: number;
last_edited_at?: string;
last_edited_by_id?: number;
project: SimpleProjectSchema;
project_default_branch: string;
report_type: string;
resolved_at?: string;
resolved_by_id?: number;
resolved_on_default_branch: boolean;
severity: string;
start_date?: string;
state: string;
title: string;
updated_at: string;
updated_by_id?: number;
}
export class ProjectVulnerabilities<C extends boolean = false> extends BaseResource<C> {
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
projectId: string | number,
options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<ProjectVulnerabilitySchema[], C, E, P>> {
return RequestHelper.get<ProjectVulnerabilitySchema[]>()(
this,
endpoint`projects/${projectId}/vulnerabilities`,
options,
);
}
create<E extends boolean = false>(
projectId: string | number,
findingId: number,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<ProjectVulnerabilitySchema, C, E, void>> {
return RequestHelper.post<ProjectVulnerabilitySchema>()(
this,
endpoint`projects/${projectId}/vulnerabilities`,
{
...options,
searchParams: {
findingId,
},
},
);
}
}