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
type ObjectAttributes struct {
ID int64 `json:"id"`
Title string `json:"title"`
AssigneeID int64 `json:"assignee_id"`
AuthorID int64 `json:"author_id"`
ProjectID int64 `json:"project_id"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
Position int64 `json:"position"`
BranchName string `json:"branch_name"`
Description string `json:"description"`
MilestoneID int64 `json:"milestone_id"`
State string `json:"state"`
IID int64 `json:"iid"`
URL string `json:"url"`
Action string `json:"action"`
TargetBranch string `json:"target_branch"`
SourceBranch string `json:"source_branch"`
SourceProjectID int64 `json:"source_project_id"`
TargetProjectID int64 `json:"target_project_id"`
StCommits string `json:"st_commits"`
MergeStatus string `json:"merge_status"`
Content string `json:"content"`
Format string `json:"format"`
Message string `json:"message"`
Slug string `json:"slug"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
SHA string `json:"sha"`
BeforeSHA string `json:"before_sha"`
Status string `json:"status"`
Stages []string `json:"stages"`
Duration int64 `json:"duration"`
Note string `json:"note"`
NotebookType string `json:"noteable_type"`
At customTime `json:"attachment"`
LineCode string `json:"line_code"`
CommitID string `json:"commit_id"`
NoteableID int64 `json:"noteable_id"`
System bool `json:"system"`
WorkInProgress bool `json:"work_in_progress"`
StDiffs []StDiff `json:"st_diffs"`
Source Source `json:"source"`
Target Target `json:"target"`
LastCommit LastCommit `json:"last_commit"`
Assignee Assignee `json:"assignee"`
ID int64 `json:"id"`
Title string `json:"title"`
AssigneeID int64 `json:"assignee_id"`
AuthorID int64 `json:"author_id"`
ProjectID int64 `json:"project_id"`
CreatedAt customTime `json:"created_at"`
UpdatedAt customTime `json:"updated_at"`
ChangePosition Position `json:"change_position"`
OriginalPosition Position `json:"original_position"`
Position Position `json:"position"`
BranchName string `json:"branch_name"`
Description string `json:"description"`
MilestoneID int64 `json:"milestone_id"`
State string `json:"state"`
IID int64 `json:"iid"`
URL string `json:"url"`
Action string `json:"action"`
TargetBranch string `json:"target_branch"`
SourceBranch string `json:"source_branch"`
SourceProjectID int64 `json:"source_project_id"`
TargetProjectID int64 `json:"target_project_id"`
StCommits string `json:"st_commits"`
MergeStatus string `json:"merge_status"`
Content string `json:"content"`
Format string `json:"format"`
Message string `json:"message"`
Slug string `json:"slug"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
SHA string `json:"sha"`
BeforeSHA string `json:"before_sha"`
Status string `json:"status"`
Stages []string `json:"stages"`
Duration int64 `json:"duration"`
Note string `json:"note"`
NotebookType string `json:"noteable_type"`
At customTime `json:"attachment"`
LineCode string `json:"line_code"`
CommitID string `json:"commit_id"`
NoteableID int64 `json:"noteable_id"`
System bool `json:"system"`
WorkInProgress bool `json:"work_in_progress"`
StDiffs []StDiff `json:"st_diffs"`
Source Source `json:"source"`
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
+31 -2
View File
@@ -35,7 +35,36 @@
"project_id": 14,
"created_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,
"description": "Create new API for manipulations with repository",
"milestone_id": null,
@@ -49,4 +78,4 @@
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}
}
}
+31 -2
View File
@@ -35,7 +35,36 @@
"project_id": 14,
"created_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,
"description": "Create new API for manipulations with repository",
"milestone_id": null,
@@ -49,4 +78,4 @@
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}
}
}