Merge pull request #79 from maguro/v5

Update position to struct
This commit is contained in:
Dean Karn
2019-07-10 08:11:48 -07:00
committed by GitHub
3 changed files with 130 additions and 49 deletions
+68 -45
View File
@@ -307,51 +307,74 @@ type Repository struct {
// ObjectAttributes contains all of the GitLab object attributes information // ObjectAttributes contains all of the GitLab object attributes information
type ObjectAttributes struct { type ObjectAttributes struct {
ID int64 `json:"id"` ID int64 `json:"id"`
Title string `json:"title"` Title string `json:"title"`
AssigneeID int64 `json:"assignee_id"` AssigneeID int64 `json:"assignee_id"`
AuthorID int64 `json:"author_id"` AuthorID int64 `json:"author_id"`
ProjectID int64 `json:"project_id"` ProjectID int64 `json:"project_id"`
CreatedAt customTime `json:"created_at"` CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"` UpdatedAt customTime `json:"updated_at"`
Position int64 `json:"position"` ChangePosition Position `json:"change_position"`
BranchName string `json:"branch_name"` OriginalPosition Position `json:"original_position"`
Description string `json:"description"` Position Position `json:"position"`
MilestoneID int64 `json:"milestone_id"` BranchName string `json:"branch_name"`
State string `json:"state"` Description string `json:"description"`
IID int64 `json:"iid"` MilestoneID int64 `json:"milestone_id"`
URL string `json:"url"` State string `json:"state"`
Action string `json:"action"` IID int64 `json:"iid"`
TargetBranch string `json:"target_branch"` URL string `json:"url"`
SourceBranch string `json:"source_branch"` Action string `json:"action"`
SourceProjectID int64 `json:"source_project_id"` TargetBranch string `json:"target_branch"`
TargetProjectID int64 `json:"target_project_id"` SourceBranch string `json:"source_branch"`
StCommits string `json:"st_commits"` SourceProjectID int64 `json:"source_project_id"`
MergeStatus string `json:"merge_status"` TargetProjectID int64 `json:"target_project_id"`
Content string `json:"content"` StCommits string `json:"st_commits"`
Format string `json:"format"` MergeStatus string `json:"merge_status"`
Message string `json:"message"` Content string `json:"content"`
Slug string `json:"slug"` Format string `json:"format"`
Ref string `json:"ref"` Message string `json:"message"`
Tag bool `json:"tag"` Slug string `json:"slug"`
SHA string `json:"sha"` Ref string `json:"ref"`
BeforeSHA string `json:"before_sha"` Tag bool `json:"tag"`
Status string `json:"status"` SHA string `json:"sha"`
Stages []string `json:"stages"` BeforeSHA string `json:"before_sha"`
Duration int64 `json:"duration"` Status string `json:"status"`
Note string `json:"note"` Stages []string `json:"stages"`
NotebookType string `json:"noteable_type"` Duration int64 `json:"duration"`
At customTime `json:"attachment"` Note string `json:"note"`
LineCode string `json:"line_code"` NotebookType string `json:"noteable_type"`
CommitID string `json:"commit_id"` At customTime `json:"attachment"`
NoteableID int64 `json:"noteable_id"` LineCode string `json:"line_code"`
System bool `json:"system"` CommitID string `json:"commit_id"`
WorkInProgress bool `json:"work_in_progress"` NoteableID int64 `json:"noteable_id"`
StDiffs []StDiff `json:"st_diffs"` System bool `json:"system"`
Source Source `json:"source"` WorkInProgress bool `json:"work_in_progress"`
Target Target `json:"target"` StDiffs []StDiff `json:"st_diffs"`
LastCommit LastCommit `json:"last_commit"` Source Source `json:"source"`
Assignee Assignee `json:"assignee"` Target Target `json:"target"`
LastCommit LastCommit `json:"last_commit"`
Assignee Assignee `json:"assignee"`
}
// Position defines a specific location, identified by paths line numbers and
// image coordinates, within a specific diff, identified by start, head and
// base commit ids.
//
// Text position will have: new_line and old_line
// Image position will have: width, height, x, y
type Position struct {
BaseSHA string `json:"base_sha"`
StartSHA string `json:"start_sha"`
HeadSHA string `json:"head_sha"`
OldPath string `json:"old_path"`
NewPath string `json:"new_path"`
PositionType string `json:"position_type"`
OldLine int64 `json:"old_line"`
NewLine int64 `json:"new_line"`
Width int64 `json:"width"`
Height int64 `json:"height"`
X int64 `json:"x"`
Y int64 `json:"y"`
} }
// MergeRequest contains all of the GitLab merge request information // MergeRequest contains all of the GitLab merge request information
+31 -2
View File
@@ -35,7 +35,36 @@
"project_id": 14, "project_id": 14,
"created_at": "2013-12-03T17:15:43Z", "created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z",
"position": 0, "change_position": {
"base_sha": null,
"start_sha": null,
"head_sha": null,
"old_path": null,
"new_path": null,
"position_type": "text",
"old_line": null,
"new_line": null
},
"original_position": {
"base_sha": "0a87d409a2d5ffbf586ed3e7ff36396ca59c3c14",
"start_sha": "5f7519856cb2a7c05427a8c1e83f941828567923",
"head_sha": "562e173be03b8ff2efb05345d12df18815438a4b",
"old_path": "core/src/main/java/com/example/server/CorbaServer.java",
"new_path": "core/src/main/java/com/example/server/CorbaServer.java",
"position_type": "text",
"old_line": null,
"new_line": 74
},
"position": {
"base_sha": "0a87d409a2d5ffbf586ed3e7ff36396ca59c3c14",
"start_sha": "5f7519856cb2a7c05427a8c1e83f941828567923",
"head_sha": "562e173be03b8ff2efb05345d12df18815438a4b",
"old_path": "core/src/main/java/com/example/server/CorbaServer.java",
"new_path": "core/src/main/java/com/example/server/CorbaServer.java",
"position_type": "text",
"old_line": null,
"new_line": 74
},
"branch_name": null, "branch_name": null,
"description": "Create new API for manipulations with repository", "description": "Create new API for manipulations with repository",
"milestone_id": null, "milestone_id": null,
@@ -49,4 +78,4 @@
"username": "user1", "username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
} }
} }
+31 -2
View File
@@ -35,7 +35,36 @@
"project_id": 14, "project_id": 14,
"created_at": "2013-12-03T17:15:43Z", "created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z",
"position": 0, "change_position": {
"base_sha": null,
"start_sha": null,
"head_sha": null,
"old_path": null,
"new_path": null,
"position_type": "text",
"old_line": null,
"new_line": null
},
"original_position": {
"base_sha": "0a87d409a2d5ffbf586ed3e7ff36396ca59c3c14",
"start_sha": "5f7519856cb2a7c05427a8c1e83f941828567923",
"head_sha": "562e173be03b8ff2efb05345d12df18815438a4b",
"old_path": "core/src/main/java/com/example/server/CorbaServer.java",
"new_path": "core/src/main/java/com/example/server/CorbaServer.java",
"position_type": "text",
"old_line": null,
"new_line": 74
},
"position": {
"base_sha": "0a87d409a2d5ffbf586ed3e7ff36396ca59c3c14",
"start_sha": "5f7519856cb2a7c05427a8c1e83f941828567923",
"head_sha": "562e173be03b8ff2efb05345d12df18815438a4b",
"old_path": "core/src/main/java/com/example/server/CorbaServer.java",
"new_path": "core/src/main/java/com/example/server/CorbaServer.java",
"position_type": "text",
"old_line": null,
"new_line": 74
},
"branch_name": null, "branch_name": null,
"description": "Create new API for manipulations with repository", "description": "Create new API for manipulations with repository",
"milestone_id": null, "milestone_id": null,
@@ -49,4 +78,4 @@
"username": "user1", "username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
} }
} }