Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jocelyn Falempe
rust-gitlab
Commits
fd66aca0
Commit
fd66aca0
authored
Nov 27, 2016
by
Makoto Nakashima
Browse files
Add commit builds API
parent
7c26443d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/gitlab.rs
View file @
fd66aca0
...
...
@@ -293,6 +293,22 @@ impl Gitlab {
Self
::
_get_paged_req
(
req
)
}
/// 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"
,
project
,
commit
)));
req
.param
(
"all"
,
"true"
);
Self
::
_get_paged_req
(
req
)
}
/// Create a status message for a commit.
pub
fn
create_commit_status
(
&
self
,
project
:
ProjectId
,
sha
:
&
str
,
state
:
StatusState
,
info
:
&
CommitStatusInfo
)
...
...
src/types.rs.in
View file @
fd66aca0
...
...
@@ -1533,13 +1533,18 @@ impl Namespace {
// expose :id, :variables
//end
//class Runner < Grape::Entity
// expose :id
// expose :description
// expose :active
// expose :is_shared
// expose :name
//end
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
pub struct RunnerId(u64);
impl_id!(RunnerId);
#[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
//end
//class BuildArtifactFile < Grape::Entity
// expose :filename, :size
//end
#[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);
impl_id!(BuildId);
//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
//end
#[derive(Serialize, Deserialize, Debug)]
pub struct Build {
pub id: BuildId,
pub status: StatusState,
pub stage: String,
pub name: String,
#[serde(rename="ref")]
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
//end
//class PipelineBasic < Grape::Entity
// expose :id, :ref, :sha, :status
//end
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
/// Type-safe pipeline ID.
pub struct PipelineId(u64);
impl_id!(PipelineId);
#[derive(Serialize, Deserialize, Debug)]
pub struct PipelineBasic {
pub id: PipelineId,
#[serde(rename="ref")]
pub ref_: Option<String>,
pub sha: ObjectId,
pub status: StatusState,
}
//class Pipeline < Grape::Entity
// expose :before_sha, :tag, :yaml_errors
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment