/
worklog.go
148 lines (131 loc) · 6.74 KB
/
worklog.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package jira
import (
"context"
model "github.com/ctreminiom/go-atlassian/pkg/infra/models"
)
type WorklogSharedConnector interface {
// Delete deletes a worklog from an issue.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// DELETE /rest/api/{2-3}/issue/{issueIdOrKey}/worklog/{id}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#delete-worklog
Delete(ctx context.Context, issueKeyOrId, worklogId string, options *model.WorklogOptionsScheme) (*model.ResponseScheme, error)
// Deleted returns a list of IDs and delete timestamps for worklogs deleted after a date and time.
//
// This resource is paginated, with a limit of 1000 worklogs per page. Each page lists worklogs from oldest to youngest.
// If the number of items in the date range exceeds 1000, until indicates the timestamp of the youngest item on the page.
// Also, nextPage provides the URL for the next page of worklogs.
// The lastPage parameter is set to true on the last page of worklogs.
//
// This resource does not return worklogs deleted during the minute preceding the request.
//
// GET /rest/api/{2-3}/worklog/deleted
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-ids-of-deleted-worklogs
Deleted(ctx context.Context, since int) (result *model.ChangedWorklogPageScheme, response *model.ResponseScheme, err error)
// Updated returns a list of IDs and update timestamps for worklogs updated after a date and time.
//
// This resource is paginated, with a limit of 1000 worklogs per page. Each page lists worklogs from oldest to youngest.
// If the number of items in the date range exceeds 1000, until indicates the timestamp of the youngest item on the page.
// Also, nextPage provides the URL for the next page of worklogs.
// The lastPage parameter is set to true on the last page of worklogs.
//
// This resource does not return worklogs updated during the minute preceding the request.
//
// GET /rest/api/{2-3}/worklog/updated
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-ids-of-updated-worklogs
Updated(ctx context.Context, since int, expand []string) (*model.ChangedWorklogPageScheme, *model.ResponseScheme, error)
}
type WorklogRichTextConnector interface {
WorklogSharedConnector
// Gets returns worklog details for a list of worklog IDs.
//
// The returned list of worklogs is limited to 1000 items.
//
// POST /rest/api/{2-3}/worklog/list
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-worklogs
Gets(ctx context.Context, worklogIds []int, expand []string) ([]*model.IssueWorklogRichTextScheme, *model.ResponseScheme, error)
// Get returns a worklog.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// GET /rest/api/{2-3}/issue/{issueIdOrKey}/worklog/{id}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-worklog
Get(ctx context.Context, issueKeyOrId, worklogId string, expand []string) (*model.IssueWorklogRichTextScheme, *model.ResponseScheme, error)
// Issue returns worklogs for an issue, starting from the oldest worklog or from the worklog started on or after a date and time.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// GET /rest/api/{2-3}/issue/{issueIdOrKey}/worklog
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-issue-worklogs
Issue(ctx context.Context, issueKeyOrId string, startAt, maxResults, after int, expand []string) (*model.IssueWorklogRichTextPageScheme, *model.ResponseScheme, error)
// Add adds a worklog to an issue.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// POST /rest/api/2/issue/{issueIdOrKey}/worklog
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#add-worklog
Add(ctx context.Context, issueKeyOrID string, payload *model.WorklogRichTextPayloadScheme, options *model.WorklogOptionsScheme) (*model.IssueWorklogRichTextScheme,
*model.ResponseScheme, error)
// Update updates a worklog.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// PUT /rest/api/2/issue/{issueIdOrKey}/worklog/{id}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#update-worklog
Update(ctx context.Context, issueKeyOrId, worklogId string, payload *model.WorklogRichTextPayloadScheme, options *model.WorklogOptionsScheme) (
*model.IssueWorklogRichTextScheme, *model.ResponseScheme, error)
}
type WorklogADFConnector interface {
WorklogSharedConnector
// Gets returns worklog details for a list of worklog IDs.
//
// The returned list of worklogs is limited to 1000 items.
//
// POST /rest/api/{2-3}/worklog/list
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-worklogs
Gets(ctx context.Context, worklogIds []int, expand []string) ([]*model.IssueWorklogADFScheme, *model.ResponseScheme, error)
// Get returns a worklog.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// GET /rest/api/{2-3}/issue/{issueIdOrKey}/worklog/{id}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-worklog
Get(ctx context.Context, issueKeyOrId, worklogId string, expand []string) (*model.IssueWorklogADFScheme, *model.ResponseScheme, error)
// Issue returns worklogs for an issue, starting from the oldest worklog or from the worklog started on or after a date and time.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// GET /rest/api/{2-3}/issue/{issueIdOrKey}/worklog
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#get-issue-worklogs
Issue(ctx context.Context, issueKeyOrId string, startAt, maxResults, after int, expand []string) (*model.IssueWorklogADFPageScheme, *model.ResponseScheme, error)
// Add adds a worklog to an issue.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// POST /rest/api/3/issue/{issueIdOrKey}/worklog
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#add-worklog
Add(ctx context.Context, issueKeyOrID string, payload *model.WorklogADFPayloadScheme, options *model.WorklogOptionsScheme) (*model.IssueWorklogADFScheme,
*model.ResponseScheme, error)
// Update updates a worklog.
//
// Time tracking must be enabled in Jira, otherwise this operation returns an error.
//
// PUT /rest/api/3/issue/{issueIdOrKey}/worklog/{id}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues/worklogs#update-worklog
Update(ctx context.Context, issueKeyOrId, worklogId string, payload *model.WorklogADFPayloadScheme, options *model.WorklogOptionsScheme) (
*model.IssueWorklogADFScheme, *model.ResponseScheme, error)
}