Commit b8155516 authored by Brad King's avatar Brad King
Browse files

types: update for 10.8

Notes gained fields describing their resolution.
Merge requests gained a field describing its diff.
parent 101151e3
{"target_project_id": 855, "web_url": "https://gitlab.kitware.com/utils/rust-gitlab/merge_requests/35", "source_branch": "add_hook-api", "downvotes": 0, "labels": [], "updated_at": "2016-10-04T16:18:57.940-04:00", "work_in_progress": false, "assignee": {"username": "brad.king", "web_url": "https://gitlab.kitware.com/brad.king", "name": "Brad King", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/0617392a2f9fd505720d0c42cefc1a10?s=80&d=identicon", "id": 10}, "user_notes_count": 3, "closed_at": null, "id": 20215, "force_remove_source_branch": true, "target_branch": "master", "subscribed": true, "title": "gitlab: expose hook addition API", "merge_commit_sha": null, "merge_when_pipeline_succeeds": false, "time_stats": {"time_estimate": 0, "human_total_time_spent": null, "human_time_estimate": null, "total_time_spent": 0}, "state": "merged", "upvotes": 0, "project_id": 855, "merged_at": "2016-10-04T16:18:57.914-04:00", "description": "Fixes #5.", "iid": 35, "milestone": null, "discussion_locked": null, "closed_by": null, "source_project_id": 856, "merged_by": null, "merge_status": "can_be_merged", "changes_count": "3", "should_remove_source_branch": null, "created_at": "2016-10-04T15:56:43.276-04:00", "author": {"username": "ben.boeckel", "web_url": "https://gitlab.kitware.com/ben.boeckel", "name": "Ben Boeckel", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/2f5f7e99190174edb5a2f66b8653b0b2?s=80&d=identicon", "id": 13}, "sha": "04e94ae667024a62a90179f395bfdc2b35f3efd2", "allow_maintainer_to_push": null}
{"target_project_id": 855, "web_url": "https://gitlab.kitware.com/utils/rust-gitlab/merge_requests/35", "source_branch": "add_hook-api", "downvotes": 0, "labels": [], "updated_at": "2016-10-04T16:18:57.940-04:00", "work_in_progress": false, "assignee": {"username": "brad.king", "web_url": "https://gitlab.kitware.com/brad.king", "name": "Brad King", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/0617392a2f9fd505720d0c42cefc1a10?s=80&d=identicon", "id": 10}, "user_notes_count": 3, "closed_at": null, "id": 20215, "force_remove_source_branch": true, "target_branch": "master", "subscribed": true, "title": "gitlab: expose hook addition API", "merge_commit_sha": null, "merge_when_pipeline_succeeds": false, "time_stats": {"time_estimate": 0, "human_total_time_spent": null, "human_time_estimate": null, "total_time_spent": 0}, "state": "merged", "upvotes": 0, "project_id": 855, "merged_at": "2016-10-04T16:18:57.914-04:00", "diff_refs": {"start_sha": "981262b03fc0149c1677ca51ea47b570e30d6a90", "base_sha": "981262b03fc0149c1677ca51ea47b570e30d6a90", "head_sha": "04e94ae667024a62a90179f395bfdc2b35f3efd2"}, "description": "Fixes #5.", "iid": 35, "milestone": null, "discussion_locked": null, "closed_by": null, "source_project_id": 856, "merged_by": null, "merge_status": "can_be_merged", "changes_count": "3", "should_remove_source_branch": null, "created_at": "2016-10-04T15:56:43.276-04:00", "author": {"username": "ben.boeckel", "web_url": "https://gitlab.kitware.com/ben.boeckel", "name": "Ben Boeckel", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/2f5f7e99190174edb5a2f66b8653b0b2?s=80&d=identicon", "id": 13}, "sha": "04e94ae667024a62a90179f395bfdc2b35f3efd2", "allow_maintainer_to_push": null}
{"body": "Mentioned in commit 47d475d8625424bd37efd27f7097354306842b93", "author": {"username": "brad.king", "web_url": "https://gitlab.kitware.com/brad.king", "name": "Brad King", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/0617392a2f9fd505720d0c42cefc1a10?s=80&d=identicon", "id": 10}, "created_at": "2016-10-04T16:18:57.786-04:00", "updated_at": "2016-10-04T16:18:57.786-04:00", "noteable_type": "MergeRequest", "system": true, "attachment": null, "noteable_id": 20215, "noteable_iid": 35, "id": 177371}
{"body": "Status changed to merged", "author": {"username": "kwrobot", "web_url": "https://gitlab.kitware.com/kwrobot", "name": "Kitware Robot", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/9ddcd45fcb89d966aab95b1f1002f84c?s=80&d=identicon", "id": 11}, "created_at": "2016-10-04T16:18:57.937-04:00", "updated_at": "2016-10-04T16:18:57.937-04:00", "noteable_type": "MergeRequest", "system": true, "resolvable": false, "attachment": null, "noteable_id": 20215, "noteable_iid": 35, "type": null, "id": 177373}
......@@ -293,6 +293,12 @@ fn test_read_merge_request() {
assert_eq!(merge_request.merge_status, MergeStatus::CanBeMerged);
assert_eq!(merge_request.sha,
Some(ObjectId::new("04e94ae667024a62a90179f395bfdc2b35f3efd2")));
assert_eq!(merge_request.diff_refs.base_sha,
Some(ObjectId::new("981262b03fc0149c1677ca51ea47b570e30d6a90")));
assert_eq!(merge_request.diff_refs.head_sha,
Some(ObjectId::new("04e94ae667024a62a90179f395bfdc2b35f3efd2")));
assert_eq!(merge_request.diff_refs.start_sha,
Some(ObjectId::new("981262b03fc0149c1677ca51ea47b570e30d6a90")));
assert_eq!(merge_request.merge_commit_sha, None);
assert_eq!(merge_request.subscribed, Some(true));
assert_eq!(merge_request.time_stats.time_estimate, 0);
......@@ -312,23 +318,26 @@ fn test_read_merge_request() {
fn test_read_note() {
let note: Note = read_test_file("note");
assert_eq!(note.id, NoteId::new(177371));
assert_eq!(note.id, NoteId::new(177373));
assert_eq!(note.body,
"Mentioned in commit 47d475d8625424bd37efd27f7097354306842b93");
"Status changed to merged");
assert_eq!(note.attachment, None);
assert_eq!(note.author.username, "brad.king");
assert_eq!(note.author.web_url, "https://gitlab.kitware.com/brad.king");
assert_eq!(note.author.name, "Brad King");
assert_eq!(note.author.username, "kwrobot");
assert_eq!(note.author.web_url, "https://gitlab.kitware.com/kwrobot");
assert_eq!(note.author.name, "Kitware Robot");
assert_eq!(note.author.state, UserState::Active);
assert_eq!(note.author.avatar_url,
"https://secure.gravatar.com/avatar/0617392a2f9fd505720d0c42cefc1a10?s=80&d=identicon");
assert_eq!(note.author.id, UserId::new(10));
"https://secure.gravatar.com/avatar/9ddcd45fcb89d966aab95b1f1002f84c?s=80&d=identicon");
assert_eq!(note.author.id, UserId::new(11));
assert_eq!(note.created_at,
Utc.ymd(2016, 10, 4)
.and_hms_milli(20, 18, 57, 786));
.and_hms_milli(20, 18, 57, 937));
assert_eq!(note.updated_at,
Utc.ymd(2016, 10, 4)
.and_hms_milli(20, 18, 57, 786));
.and_hms_milli(20, 18, 57, 937));
assert_eq!(note.resolvable, false);
assert_eq!(note.resolved, None);
assert!(note.resolved_by.is_none());
assert_eq!(note.system, true);
assert_eq!(note.noteable_id(),
Some(NoteableId::MergeRequest(MergeRequestId::new(20215))));
......
......@@ -1066,6 +1066,17 @@ pub struct RepoDiff {
pub deleted_file: bool,
}
#[cfg_attr(feature="strict", serde(deny_unknown_fields))]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct DiffRefs {
/// SHA referencing base commit in the source branch
pub base_sha: Option<ObjectId>,
/// SHA referencing head commit in the source branch
pub head_sha: Option<ObjectId>,
/// SHA referencing commit in target branch
pub start_sha: Option<ObjectId>,
}
#[cfg_attr(feature="strict", serde(deny_unknown_fields))]
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
/// Type-safe milestone ID.
......@@ -1399,6 +1410,8 @@ pub struct MergeRequest {
///
/// This is `None` if the source branch has been deleted.
pub sha: Option<ObjectId>,
/// The commits used to construct the merge request diffs.
pub diff_refs: DiffRefs,
/// The object ID of the commit which merged the merge request.
pub merge_commit_sha: Option<ObjectId>,
/// Whether the current user is subscribed or not.
......@@ -1486,6 +1499,8 @@ pub struct MergeRequestChanges {
///
/// This is `None` if the source branch has been deleted.
pub sha: Option<ObjectId>,
/// The commits used to construct the merge request diffs.
pub diff_refs: DiffRefs,
/// The object ID of the commit which merged the merge request.
pub merge_commit_sha: Option<ObjectId>,
/// GitLab does not include this in responses with lists of merge requests but
......@@ -1539,6 +1554,7 @@ impl From<MergeRequestChanges> for MergeRequest {
merge_when_pipeline_succeeds: mr.merge_when_pipeline_succeeds,
merge_status: mr.merge_status,
sha: mr.sha,
diff_refs: mr.diff_refs,
merge_commit_sha: mr.merge_commit_sha,
subscribed: mr.subscribed,
time_stats: mr.time_stats,
......@@ -1654,6 +1670,12 @@ pub struct Note {
pub created_at: DateTime<Utc>,
/// When the note was last updated.
pub updated_at: DateTime<Utc>,
/// Whether the note can be resolved.
pub resolvable: bool,
/// Whether the note has been resolved.
pub resolved: Option<bool>,
/// The user that resolved the note.
pub resolved_by: Option<UserBasic>,
/// Whether the note was created by a user or in response to an external action.
///
/// System notes include indications that the commit, issue, etc. was referenced elsewhere, a
......
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