mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
Adding extensive typing support Unified browser and Node.JS implementations Adding support of Gitlab API 16.0
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
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],
|
|
});
|
|
}
|
|
}
|