From b140253bdb99745370fa549db06efb65d1111f47 Mon Sep 17 00:00:00 2001 From: Kyrylo Fedorov <426462+Kyr@users.noreply.github.com> Date: Mon, 25 Feb 2019 18:52:45 +0200 Subject: [PATCH] Add missing method for triggering pipelines [Triggering pipelines through the API](https://docs.gitlab.com/ee/ci/triggers/) --- src/services/Triggers.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/services/Triggers.ts b/src/services/Triggers.ts index 70b23644..a98e1cb8 100644 --- a/src/services/Triggers.ts +++ b/src/services/Triggers.ts @@ -33,6 +33,15 @@ class Triggers extends BaseService { return RequestHelper.get(this, `projects/${pId}/triggers/${tId}`); } + + pipeline(projectId: ProjectId, options: RequestOptions) { + if(!options.ref) throw new Error('Missing required property: ref'); + if(!options.token) throw new Error('Missing required property: token'); + + const pId = encodeURIComponent(projectId); + + return RequestHelper.post(this, `projects/${pId}/trigger/pipeline`, options); + } } export default Triggers;