Skip to content

Commit

Permalink
feat(api): Add issue time wrapper function
Browse files Browse the repository at this point in the history
These are building blocks for adding time tracking functionality for
issues.

Issue profclems#934
  • Loading branch information
zemzale committed Jan 31, 2022
1 parent 127e4df commit a150b45
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions api/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,29 @@ var LinkIssues = func(client *gitlab.Client, projectID interface{}, issueIDD int

return issueLink.SourceIssue, issueLink.TargetIssue, nil
}

var SetIssueTimeEstimate = func(client *gitlab.Client, projectID interface{}, issueIDD int, opts *gitlab.SetTimeEstimateOptions) (*gitlab.TimeStats, error) {
if client == nil {
client = apiClient.Lab()
}

timeStats, _, err := client.Issues.SetTimeEstimate(projectID, issueIDD, opts)
if err != nil {
return nil, err
}

return timeStats, nil
}

var AddIssueTimeSpent = func(client *gitlab.Client, projectID interface{}, issueIDD int, opts *gitlab.AddSpentTimeOptions) (*gitlab.TimeStats, error) {
if client == nil {
client = apiClient.Lab()
}

timeStats, _, err := client.Issues.AddSpentTime(projectID, issueIDD, opts)
if err != nil {
return nil, err
}

return timeStats, nil
}

0 comments on commit a150b45

Please sign in to comment.