feat: Adding fork relationship support

Implemented https://docs.gitlab.com/ce/api/projects.html#fork-relationship. ForkedFromId can be supplied as a optional argument.

closes: #410
This commit is contained in:
Justin 2019-08-13 10:45:02 -04:00
parent d9207f374e
commit 76cb783967

View File

@ -37,10 +37,13 @@ class Projects extends BaseService {
return RequestHelper.get(this, `projects/${pId}/events`, options);
}
fork(projectId: ProjectId, options?: BaseRequestOptions) {
fork(projectId: ProjectId, { forkedFromId, ...options }: { forkedFromId?: number } & BaseRequestOptions = {}) {
const pId = encodeURIComponent(projectId);
let url = `projects/${pId}/fork`;
return RequestHelper.post(this, `projects/${pId}/fork`, options);
if (forkedFromId) url += `/${encodeURIComponent(forkedFromId)}`;
return RequestHelper.post(this, url, options);
}
forks(projectId: ProjectId, options?: BaseRequestOptions) {