-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathSuggestions.ts
36 lines (33 loc) · 1.12 KB
/
Suggestions.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
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper } from '../infrastructure';
import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure';
export interface SuggestionSchema extends Record<string, unknown> {
id: number;
from_line: number;
to_line: number;
appliable: boolean;
applied: boolean;
from_content: string;
to_content: string;
}
export class Suggestions<C extends boolean = false> extends BaseResource<C> {
edit<E extends boolean = false>(
suggestionId: number,
options?: { commitMessage?: string } & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<SuggestionSchema, C, E, void>> {
return RequestHelper.put<SuggestionSchema>()(
this,
`suggestions/${suggestionId}/apply`,
options,
);
}
editBatch<E extends boolean = false>(
suggestionIds: number[],
options?: { commitMessage?: string } & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<SuggestionSchema, C, E, void>> {
return RequestHelper.put<SuggestionSchema>()(this, `suggestions/batch_apply`, {
...options,
ids: suggestionIds,
});
}
}