Skip to content

Commit

Permalink
Merge pull request profclems#947 from zemzale/feat-time-api
Browse files Browse the repository at this point in the history
feat(api): Add issue time wrapper function
  • Loading branch information
zemzale authored Feb 1, 2022
2 parents a5f4099 + a150b45 commit 93ff2e4
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 93ff2e4

Please sign in to comment.