/
issue.go
170 lines (152 loc) · 7.86 KB
/
issue.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package jira
import (
"context"
model "github.com/ctreminiom/go-atlassian/pkg/infra/models"
)
type IssueSharedConnector interface {
// Delete deletes an issue.
//
// 1.An issue cannot be deleted if it has one or more subtasks.
//
// 2.To delete an issue with subtasks, set deleteSubtasks.
//
// 3.This causes the issue's subtasks to be deleted with the issue.
//
// DELETE /rest/api/{2-3}/issue/{issueIdOrKey}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#delete-issue
Delete(ctx context.Context, issueKeyOrId string, deleteSubTasks bool) (*model.ResponseScheme, error)
// Assign assigns an issue to a user.
//
// Use this operation when the calling user does not have the Edit Issues permission but has the
//
// Assign issue permission for the project that the issue is in.
//
// If accountId is set to:
//
// 1. "-1", the issue is assigned to the default assignee for the project.
// 2. null, the issue is set to unassigned.
//
// PUT /rest/api/{2-3}/issue/{issueIdOrKey}/assignee
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#assign-issue
Assign(ctx context.Context, issueKeyOrId, accountId string) (*model.ResponseScheme, error)
// Notify creates an email notification for an issue and adds it to the mail queue.
//
// POST /rest/api/{2-3}/issue/{issueIdOrKey}/notify
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#send-notification-for-issue
Notify(ctx context.Context, issueKeyOrId string, options *model.IssueNotifyOptionsScheme) (*model.ResponseScheme, error)
// Transitions returns either all transitions or a transition that can be performed by the user on an issue, based on the issue's status.
//
// Note, if a request is made for a transition that does not exist or cannot be performed on the issue,
//
// given its status, the response will return any empty transitions list.
//
// GET /rest/api/{2-3}/issue/{issueIdOrKey}/transitions
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#get-transitions
Transitions(ctx context.Context, issueKeyOrId string) (*model.IssueTransitionsScheme, *model.ResponseScheme, error)
// TODO The Transitions methods requires more parameters such as expand, transitionId, and more
// The parameters are documented on this [page](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get)
}
type IssueRichTextConnector interface {
IssueSharedConnector
// Create creates an issue or, where the option to create subtasks is enabled in Jira, a subtask.
//
// POST /rest/api/{2-3}/issue
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#create-issue
Create(ctx context.Context, payload *model.IssueSchemeV2, customFields *model.CustomFields) (*model.IssueResponseScheme, *model.ResponseScheme, error)
// Creates issues and, where the option to create subtasks is enabled in Jira, subtasks.
//
// 1.Creates upto 50 issues and, where the option to create subtasks is enabled in Jira, subtasks.
//
// 2.Transitions may be applied, to move the issues or subtasks to a workflow step other than the default start step, and issue properties set.
//
// POST /rest/api/{2-3}/issue/bulk
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#bulk-create-issue
Creates(ctx context.Context, payload []*model.IssueBulkSchemeV2) (*model.IssueBulkResponseScheme, *model.ResponseScheme, error)
// Get returns the details for an issue.
//
// The issue is identified by its ID or key, however, if the identifier doesn't match an issue, a case-insensitive search
//
// and check for moved issues is performed. If a matching issue is found its details are returned, a 302 or other redirect is not returned.
//
// The issue key returned to the response is the key of the issue found.
//
// GET /rest/api/{2-3}/issue/{issueIdOrKey}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#get-issue
Get(ctx context.Context, issueKeyOrId string, fields, expand []string) (*model.IssueSchemeV2, *model.ResponseScheme, error)
// Update edits an issue.
//
// Edits an issue. A transition may be applied and issue properties updated as part of the edit.
//
// The edits to the issue's fields are defined using update and fields
//
// PUT /rest/api/{2-3}/issue/{issueIdOrKey}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#edit-issue
Update(ctx context.Context, issueKeyOrId string, notify bool, payload *model.IssueSchemeV2, customFields *model.CustomFields,
operations *model.UpdateOperations) (*model.ResponseScheme, error)
// Move performs an issue transition and, if the transition has a screen, updates the fields from the transition screen.
//
// sortByCategory To update the fields on the transition screen, specify the fields in the fields or update parameters in the request body. Get details about the fields using Get transitions with the transitions.fields expand.
//
// POST /rest/api/{2-3}/issue/{issueIdOrKey}/transitions
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#transition-issue
Move(ctx context.Context, issueKeyOrId, transitionId string, options *model.IssueMoveOptionsV2) (*model.ResponseScheme, error)
}
type IssueADFConnector interface {
IssueSharedConnector
// Create creates an issue or, where the option to create subtasks is enabled in Jira, a subtask.
//
// POST /rest/api/{2-3}/issue
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#create-issue
Create(ctx context.Context, payload *model.IssueScheme, customFields *model.CustomFields) (*model.IssueResponseScheme, *model.ResponseScheme, error)
// Creates issues and, where the option to create subtasks is enabled in Jira, subtasks.
//
// 1.Creates upto 50 issues and, where the option to create subtasks is enabled in Jira, subtasks.
//
// 2.Transitions may be applied, to move the issues or subtasks to a workflow step other than the default start step, and issue properties set.
//
// POST /rest/api/{2-3}/issue/bulk
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#bulk-create-issue
Creates(ctx context.Context, payload []*model.IssueBulkSchemeV3) (*model.IssueBulkResponseScheme, *model.ResponseScheme, error)
// Get returns the details for an issue.
//
// The issue is identified by its ID or key, however, if the identifier doesn't match an issue, a case-insensitive search
//
// and check for moved issues is performed. If a matching issue is found its details are returned, a 302 or other redirect is not returned.
//
// The issue key returned to the response is the key of the issue found.
//
// GET /rest/api/{2-3}/issue/{issueIdOrKey}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#get-issue
Get(ctx context.Context, issueKeyOrId string, fields, expand []string) (*model.IssueScheme, *model.ResponseScheme, error)
// Update edits an issue.
//
// Edits an issue. A transition may be applied and issue properties updated as part of the edit.
//
// The edits to the issue's fields are defined using update and fields
//
// PUT /rest/api/{2-3}/issue/{issueIdOrKey}
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#edit-issue
Update(ctx context.Context, issueKeyOrId string, notify bool, payload *model.IssueScheme, customFields *model.CustomFields,
operations *model.UpdateOperations) (*model.ResponseScheme, error)
// Move performs an issue transition and, if the transition has a screen, updates the fields from the transition screen.
//
// sortByCategory To update the fields on the transition screen, specify the fields in the fields or update parameters in the request body. Get details about the fields using Get transitions with the transitions.fields expand.
//
// POST /rest/api/{2-3}/issue/{issueIdOrKey}/transitions
//
// https://docs.go-atlassian.io/jira-software-cloud/issues#transition-issue
Move(ctx context.Context, issueKeyOrId, transitionId string, options *model.IssueMoveOptionsV3) (*model.ResponseScheme, error)
}