Commit bb05e549 authored by Brad King's avatar Brad King 💬 Committed by Kitware Robot
Browse files

Merge topic 'gitlab-8.12'

05638882 webhooks: add lock_version field
e4df8a63 types: sync with 8.12's entity types
de8970f6

 gitlab: add missing trailing comma
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King's avatarBrad King <brad.king@kitware.com>
Merge-request: !33
parents 429ad8d7 05638882
......@@ -340,7 +340,7 @@ impl Gitlab {
// Refactored code which talks to Gitlab and transforms error messages properly.
fn _comm<F, T>(req: Request, f: F) -> GitlabResult<T>
where F: FnOnce(Request) -> Result<Response, EaseError>,
T: Deserialize
T: Deserialize,
{
match f(req) {
Ok(rsp) => {
......
......@@ -283,7 +283,6 @@ pub struct ProjectHook {
pub build_events: bool,
/// Whether the hook is contacted for pipeline events.
pub pipeline_events: bool,
#[serde(default="bool_false")]
/// Whether the hook is contacted for wiki page events.
pub wiki_page_events: bool,
}
......@@ -400,16 +399,6 @@ pub struct Project {
pub path: String,
/// The path to the project's repository with its namespace.
pub path_with_namespace: String,
/// Whether issues are enabled.
pub issues_enabled: bool,
/// Whether merge requests are enabled.
pub merge_requests_enabled: bool,
/// Whether project wiki is enabled.
pub wiki_enabled: bool,
/// Whether continuous integration is enabled.
pub builds_enabled: bool,
/// Whether project snippets is enabled.
pub snippets_enabled: bool,
/// Whether the continuous integration container registry is enabled.
///
/// This is supposed to be just `bool`, but projects created before the registry was
......@@ -421,6 +410,8 @@ pub struct Project {
pub last_activity_at: DateTime<UTC>,
/// Whether continuous integration shared runners are enabled.
pub shared_runners_enabled: bool,
/// Whether LFS object storage is enabled.
pub lfs_enabled: bool,
/// The user who created the repository.
pub creator_id: UserId,
/// The namespace the project lives in.
......@@ -440,6 +431,20 @@ pub struct Project {
/// Whether builds are publicly visible.
pub public_builds: bool,
pub shared_with_groups: Vec<SharedGroup>,
pub only_allow_merge_if_build_succeeds: bool,
pub request_access_enabled: bool,
// Deprecated.
/// Whether issues are enabled.
pub issues_enabled: bool,
/// Whether merge requests are enabled.
pub merge_requests_enabled: bool,
/// Whether project wiki is enabled.
pub wiki_enabled: bool,
/// Whether continuous integration is enabled.
pub builds_enabled: bool,
/// Whether project snippets is enabled.
pub snippets_enabled: bool,
/// If this is present, it is `ProjectWithAccess`, but since it is so similar, just have it be
/// optional here.
......@@ -561,10 +566,12 @@ pub struct Group {
pub description: Option<String>,
/// Integral value for the group's visibility.
pub visibility_level: u64,
pub lfs_enabled: bool,
/// The URL to the group avatar.
pub avatar_url: String,
/// The URL to the group's profile page.
pub web_url: String,
pub request_access_enabled: bool,
}
#[derive(Serialize, Deserialize, Debug)]
......@@ -580,6 +587,7 @@ pub struct GroupDetail {
pub description: Option<String>,
/// Integral value for the group's visibility.
pub visibility_level: u64,
pub lfs_enabled: bool,
/// The URL to the group avatar.
pub avatar_url: String,
/// The URL to the group's profile page.
......@@ -587,6 +595,7 @@ pub struct GroupDetail {
/// The projects in a group.
pub projects: Vec<Project>,
pub shared_projects: Vec<Project>,
pub request_access_enabled: bool,
}
impl From<GroupDetail> for Group {
......@@ -597,8 +606,10 @@ impl From<GroupDetail> for Group {
path: detail.path,
description: detail.description,
visibility_level: detail.visibility_level,
lfs_enabled: detail.lfs_enabled,
avatar_url: detail.avatar_url,
web_url: detail.web_url,
request_access_enabled: detail.request_access_enabled,
}
}
}
......@@ -713,6 +724,7 @@ pub struct ProjectSnippet {
pub author: UserBasic,
pub updated_at: DateTime<UTC>,
pub created_at: DateTime<UTC>,
pub web_url: String,
}
// This is just used as a common "base class" in Ruby.
......@@ -801,6 +813,8 @@ pub struct Issue {
pub upvotes: u64,
pub downvotes: u64,
pub due_date: Option<NaiveDate>,
pub confidential: bool,
pub web_url: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
......@@ -869,10 +883,6 @@ enum_serialize!(MergeRequestState -> "merge request state",
Locked => "locked",
);
fn bool_false() -> bool {
false
}
#[derive(Serialize, Deserialize, Debug)]
pub struct MergeRequest {
pub id: MergeRequestId,
......@@ -896,10 +906,13 @@ pub struct MergeRequest {
pub milestone: Option<Milestone>,
pub merge_when_build_succeeds: bool,
pub merge_status: MergeStatus,
pub diff_head_sha: ObjectId,
pub merge_commit_sha: Option<ObjectId>,
pub subscribed: bool,
pub user_notes_count: u64,
pub should_remove_source_branch: bool,
pub force_remove_source_branch: bool,
pub web_url: String,
}
#[derive(Serialize, Deserialize, Debug)]
......@@ -925,11 +938,14 @@ pub struct MergeRequestChanges {
pub milestone: Option<Milestone>,
pub merge_when_build_succeeds: bool,
pub merge_status: MergeStatus,
pub diff_head_sha: ObjectId,
pub merge_commit_sha: Option<ObjectId>,
pub subscribed: bool,
pub user_notes_count: u64,
pub changes: Vec<RepoDiff>,
pub should_remove_source_branch: bool,
pub force_remove_source_branch: bool,
pub web_url: String,
}
impl From<MergeRequestChanges> for MergeRequest {
......@@ -956,10 +972,13 @@ impl From<MergeRequestChanges> for MergeRequest {
milestone: mr.milestone,
merge_when_build_succeeds: mr.merge_when_build_succeeds,
merge_status: mr.merge_status,
diff_head_sha: mr.diff_head_sha,
merge_commit_sha: mr.merge_commit_sha,
subscribed: mr.subscribed,
user_notes_count: mr.user_notes_count,
should_remove_source_branch: mr.should_remove_source_branch,
force_remove_source_branch: mr.force_remove_source_branch,
web_url: mr.web_url,
}
}
}
......@@ -1244,6 +1263,21 @@ impl Namespace {
// end
//end
//class NotificationSetting < Grape::Entity
// expose :level
// expose :events, if: ->(notification_setting, _) { notification_setting.custom? } do
// ::NotificationSetting::EMAIL_EVENTS.each do |event|
// expose event
// end
// end
//end
//class GlobalNotificationSetting < NotificationSetting
// expose :notification_email do |notification_setting, options|
// notification_setting.user.notification_email
// end
//end
//class Label < Grape::Entity
// expose :name, :color, :description
// expose :open_issues_count, :closed_issues_count, :open_merge_requests_count
......@@ -1379,13 +1413,12 @@ impl_id!(BuildId);
// expose :key, :value
//end
//class Environment < Grape::Entity
//class EnvironmentBasic < Grape::Entity
// expose :id, :name, :external_url
// expose :project, using: Entities::Project
//end
//class EnvironmentBasic < Grape::Entity
// expose :id, :name, :external_url
//class Environment < EnvironmentBasic
// expose :project, using: Entities::Project
//end
//class Deployment < Grape::Entity
......@@ -1415,6 +1448,11 @@ impl_id!(BuildId);
// expose :name, :content
//end
//class BroadcastMessage < Grape::Entity
// expose :id, :message, :starts_at, :ends_at, :color, :font
// expose :active?, as: :active
//end
//class Todo < Grape::Entity
// expose :id
// expose :project, using: Entities::BasicProjectDetails
......@@ -1447,3 +1485,16 @@ impl_id!(BuildId);
// expose :created_at, :updated_at, :started_at, :finished_at, :committed_at
// expose :duration
//end
//class MergeRequestDiff < Grape::Entity
// expose :id, :head_commit_sha, :base_commit_sha, :start_commit_sha,
// :created_at, :merge_request_id, :state, :real_size
//end
//class MergeRequestDiffFull < MergeRequestDiff
// expose :commits, using: Entities::RepoCommit
// expose :diffs, using: Entities::RepoDiff do |compare, _|
// compare.diffs(all_diffs: true).to_a
// end
//end
......@@ -178,6 +178,7 @@ pub struct IssueHookAttrs {
pub state: IssueState,
pub iid: u64,
pub confidential: bool,
pub lock_version: u64,
// It seems that notes miss these properties?
pub url: Option<String>,
......@@ -269,6 +270,7 @@ pub struct MergeRequestHookAttrs {
pub merge_status: MergeStatus,
pub iid: u64,
pub description: String,
pub lock_version: u64,
// It seems that notes miss these properties?
pub url: Option<String>,
......
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