Add missing method for triggering pipelines

[Triggering pipelines through the API](https://docs.gitlab.com/ee/ci/triggers/)
This commit is contained in:
Kyrylo Fedorov 2019-02-25 18:52:45 +02:00 committed by GitHub
parent 8f551f1054
commit b140253bdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;