Commit fd66aca0 authored by Makoto Nakashima's avatar Makoto Nakashima
Browse files

Add commit builds API

parent 7c26443d
......@@ -293,6 +293,22 @@ impl Gitlab {
/// Get the builds of a commit.
pub fn commit_builds(&self, project: ProjectId, commit: &str) -> GitlabResult<Vec<Build>> {
self._get_paged(&format!("projects/{}/repository/commits/{}/builds", project, commit))
/// Get the builds of a commit.
pub fn commit_all_builds(&self, project: ProjectId, commit: &str) -> GitlabResult<Vec<Build>> {
let mut req = try!(self._mkrequest(&format!("projects/{}/repository/commits/{}/builds",
req.param("all", "true");
/// Create a status message for a commit.
pub fn create_commit_status(&self, project: ProjectId, sha: &str, state: StatusState,
info: &CommitStatusInfo)
......@@ -1533,13 +1533,18 @@ impl Namespace {
// expose :id, :variables
//class Runner < Grape::Entity
// expose :id
// expose :description
// expose :active
// expose :is_shared
// expose :name
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
pub struct RunnerId(u64);
#[derive(Serialize, Deserialize, Debug)]
pub struct Runner {
pub id: RunnerId,
pub description: Option<String>,
pub active: bool,
pub is_shared: bool,
pub name: Option<String>
//class RunnerDetails < Runner
// expose :tag_list
......@@ -1557,24 +1562,36 @@ impl Namespace {
// end
//class BuildArtifactFile < Grape::Entity
// expose :filename, :size
#[derive(Serialize, Deserialize, Debug)]
pub struct BuildArtifactFile {
pub filename: String,
pub size: usize,
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
/// Type-safe build ID.
pub struct BuildId(u64);
//class Build < Grape::Entity
// expose :id, :status, :stage, :name, :ref, :tag, :coverage
// expose :created_at, :started_at, :finished_at
// expose :user, with: User
// expose :artifacts_file, using: BuildArtifactFile, if: -> (build, opts) { build.artifacts? }
// expose :commit, with: RepoCommit
// expose :runner, with: Runner
// expose :pipeline, with: PipelineBasic
#[derive(Serialize, Deserialize, Debug)]
pub struct Build {
pub id: BuildId,
pub status: StatusState,
pub stage: String,
pub name: String,
pub ref_: Option<String>,
pub tag: bool,
pub coverage: Option<f32>,
pub created_at: DateTime<UTC>,
pub started_at: Option<DateTime<UTC>>,
pub finished_at: Option<DateTime<UTC>>,
pub user: Option<User>,
pub artifacts_file: Option<BuildArtifactFile>,
pub commit: RepoCommit,
pub runner: Option<Runner>,
pub pipeline: PipelineBasic,
//class Trigger < Grape::Entity
// expose :token, :created_at, :updated_at, :deleted_at, :last_used
......@@ -1649,9 +1666,19 @@ impl_id!(BuildId);
// expose :created_at
//class PipelineBasic < Grape::Entity
// expose :id, :ref, :sha, :status
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
/// Type-safe pipeline ID.
pub struct PipelineId(u64);
#[derive(Serialize, Deserialize, Debug)]
pub struct PipelineBasic {
pub id: PipelineId,
pub ref_: Option<String>,
pub sha: ObjectId,
pub status: StatusState,
//class Pipeline < Grape::Entity
// expose :before_sha, :tag, :yaml_errors
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment