add support for Pipelines API
https://docs.gitlab.com/ee/api/pipelines.html
Covers all the api methods in docs except delete (there are no delete methods for other types, either).
A couple fields on struct Pipeline
are undocumented since I wasn't sure of their meaning.
Still needs to be tested against a Gitlab instance; we're still running v11.7 at my shop, but if any has access to a v12 with pipelines, here's a test program:
//! Exercise the Pipeline API.
//!
//! NOTE: this will create, retry, and cancel a pipeline on the target
//! project/branch.
extern crate gitlab;
use gitlab::{Gitlab};
fn main() {
let empty_params: &[(&str,&str)] = &[];
let client = Gitlab::new("HOST", "TOKEN")
.expect("could not get gitlab client");
let project = client.project_by_name("YOUR PROJECT", empty_params)
.expect("could not get project");
let pipelines = client.pipelines(project.id, empty_params)
.expect("could not get pipelines");
eprintln!("{:#?}", pipelines);
let commit = client.commit(project.id, pipelines[0].sha.value())
.expect("could not get commit");
eprintln!("{:#?}", commit);
let pipeline = client.pipeline(project.id, pipelines[0].id).expect("could not get pipeline");
eprintln!("{:#?}", pipeline);
let pipeline = client.create_pipeline(project.id, pipeline.sha, &[]).expect("could not create new pipeline");
eprintln!("postcreate: {:#?}", pipeline);
let pipeline = client.cancel_pipeline(project.id, pipeline.id).expect("could not cancel new pipeline");
eprintln!("postcancel: {:#?}", pipeline);
let pipeline = client.retry_pipeline(project.id, pipeline.id).expect("could not retry cancelled pipeline");
eprintln!("postretry: {:#?}", pipeline);
let pipeline = client.cancel_pipeline(project.id, pipeline.id).expect("could not cancel again");
eprintln!("postcancel: {:#?}", pipeline);
}
Edited by Dan Anderson