Justin Dalrymple 7f1648802b Major Release v36.0.0 - Improved Typing, and API support (16.0) (#2258)
Adding extensive typing support
Unified browser and Node.JS implementations
Adding support of Gitlab API 16.0
2023-04-26 12:58:56 -04:00

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],
});
}
}