Commit b6c44aa3 authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot
Browse files

Merge topic 'commit-builds'

e71719ba Rename to commit_latest_statuses, improve docstrings.
6d4d192d Rename to commit_latest_build, improve docstrings.

 Add commit builds API

Acked-by: Kitware Robot's avatarKitware Robot <>
Merge-request: !50
parents 7c26443d e71719ba
......@@ -273,15 +273,15 @@ impl Gitlab {
/// Get the statuses of a commit.
pub fn commit_statuses(&self, project: ProjectId, commit: &str)
/// Get the latest statuses of a commit.
pub fn commit_latest_statuses(&self, project: ProjectId, commit: &str)
-> GitlabResult<Vec<CommitStatus>> {
/// Get the statuses of a commit.
/// Get the all statuses of a commit.
pub fn commit_all_statuses(&self, project: ProjectId, commit: &str)
-> GitlabResult<Vec<CommitStatus>> {
let mut req = try!(self._mkrequest(&format!("projects/{}/repository/commits/{}/statuses",
......@@ -293,6 +293,22 @@ impl Gitlab {
/// Get the latest builds of a commit.
pub fn commit_latest_builds(&self, project: ProjectId, commit: &str) -> GitlabResult<Vec<Build>> {
self._get_paged(&format!("projects/{}/repository/commits/{}/builds", project, commit))
/// Get the all 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
Supports Markdown
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