forked from jdalrymple/gitbeaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RubyGems.ts
40 lines (37 loc) · 1.32 KB
/
RubyGems.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
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper, endpoint } from '../infrastructure';
import type { GitlabAPIResponse, ShowExpanded } from '../infrastructure';
export class RubyGems<C extends boolean = false> extends BaseResource<C> {
allDependencies<E extends boolean = false>(
projectId: string,
options?: { gems?: string } & ShowExpanded<E>,
): Promise<GitlabAPIResponse<string, void, E, void>> {
return RequestHelper.get<string>()(
this,
endpoint`projects/${projectId}/packages/rubygems/api/v1/dependencies`,
options,
);
}
downloadGemFile<E extends boolean = false>(
projectId: string,
fileName: string,
options?: ShowExpanded<E>,
): Promise<GitlabAPIResponse<Blob, void, E, void>> {
return RequestHelper.get<Blob>()(
this,
endpoint`projects/${projectId}/packages/rubygems/gems/${fileName}`,
options,
);
}
uploadGemFile<E extends boolean = false>(
projectId: string | number,
packageFile: { content: Blob; filename: string },
options?: ShowExpanded<E>,
): Promise<GitlabAPIResponse<void, C, E, void>> {
return RequestHelper.post<void>()(this, `projects/${projectId}/packages/rubygems/api/v1/gems`, {
isForm: true,
...options,
file: [packageFile.content, packageFile.filename],
});
}
}