mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
Gitbeaker has been split up into 5 subpackages: gitbeaker-core, gitbeaker-node, gitbeaker-cli, gitbeaker-browser and gitbeaker-requester-utils.
gitbeaker-[node,cli,browser] are enviroment
specific sub packages. For example, if you want to use gitbeaker in a NodeJS environment, use gitbeaker-node. gitbeaker-core is where all the
base logic exists, and gitbeaker-requester-utils is a collection of utility functions for making custom requester libraries.
BREAKING CHANGE: 🧨 This migration requires users to import specific subpackages. For NodeJS
usage, that would be @gitbeaker/node.
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import {
|
|
BaseService,
|
|
RequestHelper,
|
|
Sudo,
|
|
BaseRequestOptions,
|
|
PaginatedRequestOptions,
|
|
} from '../infrastructure';
|
|
|
|
export class DeployKeys extends BaseService {
|
|
add(projectId: string | number, options?: Sudo) {
|
|
const pId = encodeURIComponent(projectId);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/deploy_keys`, options);
|
|
}
|
|
|
|
all({ projectId, ...options }: { projectId?: string | number } & PaginatedRequestOptions) {
|
|
let url;
|
|
|
|
if (projectId) {
|
|
url = `projects/${encodeURIComponent(projectId)}/deploy_keys`;
|
|
} else {
|
|
url = 'deploy_keys';
|
|
}
|
|
|
|
return RequestHelper.get(this, url, options);
|
|
}
|
|
|
|
edit(projectId: string | number, keyId: string, options?: BaseRequestOptions) {
|
|
const [pId, kId] = [projectId, keyId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.put(this, `projects/${pId}/deploy_keys/${kId}`, options);
|
|
}
|
|
|
|
enable(projectId: string | number, keyId: string, options?: Sudo) {
|
|
const [pId, kId] = [projectId, keyId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.post(this, `projects/${pId}/deploy_keys/${kId}/enable`, options);
|
|
}
|
|
|
|
remove(projectId: string | number, keyId: string, options?: Sudo) {
|
|
const [pId, kId] = [projectId, keyId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.del(this, `projects/${pId}/deploy_keys/${kId}`, options);
|
|
}
|
|
|
|
show(projectId: string | number, keyId: string, options?: Sudo) {
|
|
const [pId, kId] = [projectId, keyId].map(encodeURIComponent);
|
|
|
|
return RequestHelper.get(this, `projects/${pId}/deploy_keys/${kId}`, options);
|
|
}
|
|
}
|