ruby-jira 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,291 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jira
4
+ class Client
5
+ # Defines methods related to boards (Jira Software Cloud API).
6
+ #
7
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/
8
+ module Boards
9
+ # Returns all boards
10
+ #
11
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-get
12
+ #
13
+ # @param options [Hash] Query parameters (startAt:, maxResults:, type:, name:, projectKeyOrId:, ...)
14
+ # @return [Jira::PaginatedResponse]
15
+ def boards(options = {})
16
+ agile_get("/board", query: options)
17
+ end
18
+
19
+ # Creates a new board
20
+ #
21
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-post
22
+ #
23
+ # @param payload [Hash] Board payload (name:, type:, filterId:, location:)
24
+ # @return [Hash]
25
+ def create_board(payload = {})
26
+ agile_post("/board", body: payload)
27
+ end
28
+
29
+ # Returns all boards for the given filter
30
+ #
31
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-filter-filterid-get
32
+ #
33
+ # @param filter_id [Integer] The ID of the filter
34
+ # @param options [Hash] Query parameters (startAt:, maxResults:)
35
+ # @return [Jira::PaginatedResponse]
36
+ def boards_for_filter(filter_id, options = {})
37
+ agile_get("/board/filter/#{filter_id}", query: options)
38
+ end
39
+
40
+ # Returns the board for the given board ID
41
+ #
42
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-get
43
+ #
44
+ # @param board_id [Integer] The ID of the board
45
+ # @return [Hash]
46
+ def board(board_id)
47
+ agile_get("/board/#{board_id}")
48
+ end
49
+
50
+ # Deletes the board
51
+ #
52
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-delete
53
+ #
54
+ # @param board_id [Integer] The ID of the board
55
+ # @return [nil]
56
+ def delete_board(board_id)
57
+ agile_delete("/board/#{board_id}")
58
+ end
59
+
60
+ # Returns all issues in the backlog of the board
61
+ #
62
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-backlog-get
63
+ #
64
+ # @param board_id [Integer] The ID of the board
65
+ # @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:, ...)
66
+ # @return [Jira::PaginatedResponse]
67
+ def board_backlog(board_id, options = {})
68
+ agile_get("/board/#{board_id}/backlog", query: options)
69
+ end
70
+
71
+ # Returns the configuration of the board
72
+ #
73
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-configuration-get
74
+ #
75
+ # @param board_id [Integer] The ID of the board
76
+ # @return [Hash]
77
+ def board_configuration(board_id)
78
+ agile_get("/board/#{board_id}/configuration")
79
+ end
80
+
81
+ # Returns all epics from the board
82
+ #
83
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-epic-get
84
+ #
85
+ # @param board_id [Integer] The ID of the board
86
+ # @param options [Hash] Query parameters (startAt:, maxResults:, done:)
87
+ # @return [Jira::PaginatedResponse]
88
+ def board_epics(board_id, options = {})
89
+ agile_get("/board/#{board_id}/epic", query: options)
90
+ end
91
+
92
+ # Returns all issues that do not belong to any epic on the board
93
+ #
94
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-epic-none-issue-get
95
+ #
96
+ # @param board_id [Integer] The ID of the board
97
+ # @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:, ...)
98
+ # @return [Jira::PaginatedResponse]
99
+ def board_issues_without_epic(board_id, options = {})
100
+ agile_get("/board/#{board_id}/epic/none/issue", query: options)
101
+ end
102
+
103
+ # Returns all issues that belong to the given epic on the board
104
+ #
105
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-epic-epicid-issue-get
106
+ #
107
+ # @param board_id [Integer] The ID of the board
108
+ # @param epic_id [Integer] The ID of the epic
109
+ # @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:, ...)
110
+ # @return [Jira::PaginatedResponse]
111
+ def board_epic_issues(board_id, epic_id, options = {})
112
+ agile_get("/board/#{board_id}/epic/#{epic_id}/issue", query: options)
113
+ end
114
+
115
+ # Returns the features enabled/disabled for the board
116
+ #
117
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-features-get
118
+ #
119
+ # @param board_id [Integer] The ID of the board
120
+ # @return [Hash]
121
+ def board_features(board_id)
122
+ agile_get("/board/#{board_id}/features")
123
+ end
124
+
125
+ # Toggles a feature on or off for the board
126
+ #
127
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-features-put
128
+ #
129
+ # @param board_id [Integer] The ID of the board
130
+ # @param payload [Hash] Feature toggle payload (feature:, state:)
131
+ # @return [Hash]
132
+ def toggle_board_feature(board_id, payload = {})
133
+ agile_put("/board/#{board_id}/features", body: payload)
134
+ end
135
+
136
+ # Returns all issues from the board
137
+ #
138
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-issue-get
139
+ #
140
+ # @param board_id [Integer] The ID of the board
141
+ # @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:, ...)
142
+ # @return [Jira::PaginatedResponse]
143
+ def board_issues(board_id, options = {})
144
+ agile_get("/board/#{board_id}/issue", query: options)
145
+ end
146
+
147
+ # Moves issues to the backlog of the board
148
+ #
149
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-issue-post
150
+ #
151
+ # @param board_id [Integer] The ID of the board
152
+ # @param issues [Array<String>] List of issue keys or IDs
153
+ # @return [nil]
154
+ def move_issues_to_board(board_id, issues:)
155
+ agile_post("/board/#{board_id}/issue", body: { issues: issues })
156
+ end
157
+
158
+ # Returns all projects that are associated with the board
159
+ #
160
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-project-get
161
+ #
162
+ # @param board_id [Integer] The ID of the board
163
+ # @param options [Hash] Query parameters (startAt:, maxResults:)
164
+ # @return [Jira::PaginatedResponse]
165
+ def board_projects(board_id, options = {})
166
+ agile_get("/board/#{board_id}/project", query: options)
167
+ end
168
+
169
+ # Returns all projects that are associated with the board, including all issue types
170
+ #
171
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-project-full-get
172
+ #
173
+ # @param board_id [Integer] The ID of the board
174
+ # @param options [Hash] Query parameters (startAt:, maxResults:)
175
+ # @return [Jira::PaginatedResponse]
176
+ def board_projects_full(board_id, options = {})
177
+ agile_get("/board/#{board_id}/project/full", query: options)
178
+ end
179
+
180
+ # Returns the keys of all properties for the board
181
+ #
182
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-properties-get
183
+ #
184
+ # @param board_id [Integer] The ID of the board
185
+ # @return [Hash]
186
+ def board_property_keys(board_id)
187
+ agile_get("/board/#{board_id}/properties")
188
+ end
189
+
190
+ # Returns the value of the property with the given key for the board
191
+ #
192
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-properties-propertykey-get
193
+ #
194
+ # @param board_id [Integer] The ID of the board
195
+ # @param property_key [String] The key of the property
196
+ # @return [Hash]
197
+ def board_property(board_id, property_key)
198
+ agile_get("/board/#{board_id}/properties/#{url_encode(property_key)}")
199
+ end
200
+
201
+ # Sets the value of the property with the given key for the board
202
+ #
203
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-properties-propertykey-put
204
+ #
205
+ # @param board_id [Integer] The ID of the board
206
+ # @param property_key [String] The key of the property
207
+ # @param value [Hash] The value to set
208
+ # @return [nil]
209
+ def set_board_property(board_id, property_key, value = {})
210
+ agile_put("/board/#{board_id}/properties/#{url_encode(property_key)}", body: value)
211
+ end
212
+
213
+ # Deletes the property with the given key for the board
214
+ #
215
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-properties-propertykey-delete
216
+ #
217
+ # @param board_id [Integer] The ID of the board
218
+ # @param property_key [String] The key of the property
219
+ # @return [nil]
220
+ def delete_board_property(board_id, property_key)
221
+ agile_delete("/board/#{board_id}/properties/#{url_encode(property_key)}")
222
+ end
223
+
224
+ # Returns all quick filters of the board
225
+ #
226
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-quickfilter-get
227
+ #
228
+ # @param board_id [Integer] The ID of the board
229
+ # @param options [Hash] Query parameters (startAt:, maxResults:)
230
+ # @return [Jira::PaginatedResponse]
231
+ def board_quick_filters(board_id, options = {})
232
+ agile_get("/board/#{board_id}/quickfilter", query: options)
233
+ end
234
+
235
+ # Returns the quick filter for the given board and quick filter ID
236
+ #
237
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-quickfilter-quickfilterid-get
238
+ #
239
+ # @param board_id [Integer] The ID of the board
240
+ # @param quick_filter_id [Integer] The ID of the quick filter
241
+ # @return [Hash]
242
+ def board_quick_filter(board_id, quick_filter_id)
243
+ agile_get("/board/#{board_id}/quickfilter/#{quick_filter_id}")
244
+ end
245
+
246
+ # Returns the board reports
247
+ #
248
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-reports-get
249
+ #
250
+ # @param board_id [Integer] The ID of the board
251
+ # @return [Hash]
252
+ def board_reports(board_id)
253
+ agile_get("/board/#{board_id}/reports")
254
+ end
255
+
256
+ # Returns all sprints from the board
257
+ #
258
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-sprint-get
259
+ #
260
+ # @param board_id [Integer] The ID of the board
261
+ # @param options [Hash] Query parameters (startAt:, maxResults:, state:)
262
+ # @return [Jira::PaginatedResponse]
263
+ def board_sprints(board_id, options = {})
264
+ agile_get("/board/#{board_id}/sprint", query: options)
265
+ end
266
+
267
+ # Returns all issues in the sprint for the given board
268
+ #
269
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-sprint-sprintid-issue-get
270
+ #
271
+ # @param board_id [Integer] The ID of the board
272
+ # @param sprint_id [Integer] The ID of the sprint
273
+ # @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:, ...)
274
+ # @return [Jira::PaginatedResponse]
275
+ def board_sprint_issues(board_id, sprint_id, options = {})
276
+ agile_get("/board/#{board_id}/sprint/#{sprint_id}/issue", query: options)
277
+ end
278
+
279
+ # Returns all versions from the board
280
+ #
281
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-boardid-version-get
282
+ #
283
+ # @param board_id [Integer] The ID of the board
284
+ # @param options [Hash] Query parameters (startAt:, maxResults:, released:)
285
+ # @return [Jira::PaginatedResponse]
286
+ def board_versions(board_id, options = {})
287
+ agile_get("/board/#{board_id}/version", query: options)
288
+ end
289
+ end
290
+ end
291
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jira
4
+ class Client
5
+ # Defines methods related to epics (Jira Software Cloud API).
6
+ #
7
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/
8
+ module Epics
9
+ # Returns all issues that do not belong to any epic
10
+ #
11
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-rest-agile-1-0-epic-none-issue-get
12
+ #
13
+ # @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:, ...)
14
+ # @return [Jira::PaginatedResponse]
15
+ def issues_without_epic(options = {})
16
+ agile_get("/epic/none/issue", query: options)
17
+ end
18
+
19
+ # Removes issues from their epic (moves them to no epic)
20
+ #
21
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-rest-agile-1-0-epic-none-issue-post
22
+ #
23
+ # @param issues [Array<String>] List of issue keys or IDs
24
+ # @return [nil]
25
+ def unassign_issues_from_epic(issues:)
26
+ agile_post("/epic/none/issue", body: { issues: issues })
27
+ end
28
+
29
+ # Returns the epic for the given epic ID or key
30
+ #
31
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-rest-agile-1-0-epic-epicidorkey-get
32
+ #
33
+ # @param epic_id_or_key [Integer, String] The ID or key of the epic
34
+ # @return [Hash]
35
+ def epic(epic_id_or_key)
36
+ agile_get("/epic/#{url_encode(epic_id_or_key)}")
37
+ end
38
+
39
+ # Partially updates an epic
40
+ #
41
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-rest-agile-1-0-epic-epicidorkey-post
42
+ #
43
+ # @param epic_id_or_key [Integer, String] The ID or key of the epic
44
+ # @param payload [Hash] Fields to update (name:, summary:, color:, done:)
45
+ # @return [Hash]
46
+ def update_epic(epic_id_or_key, payload = {})
47
+ agile_post("/epic/#{url_encode(epic_id_or_key)}", body: payload)
48
+ end
49
+
50
+ # Returns all issues that belong to the given epic
51
+ #
52
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-rest-agile-1-0-epic-epicidorkey-issue-get
53
+ #
54
+ # @param epic_id_or_key [Integer, String] The ID or key of the epic
55
+ # @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:, ...)
56
+ # @return [Jira::PaginatedResponse]
57
+ def epic_issues(epic_id_or_key, options = {})
58
+ agile_get("/epic/#{url_encode(epic_id_or_key)}/issue", query: options)
59
+ end
60
+
61
+ # Moves issues to an epic
62
+ #
63
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-rest-agile-1-0-epic-epicidorkey-issue-post
64
+ #
65
+ # @param epic_id_or_key [Integer, String] The ID or key of the epic
66
+ # @param issues [Array<String>] List of issue keys or IDs
67
+ # @return [nil]
68
+ def move_issues_to_epic(epic_id_or_key, issues:)
69
+ agile_post("/epic/#{url_encode(epic_id_or_key)}/issue", body: { issues: issues })
70
+ end
71
+
72
+ # Ranks the epic before or after a given epic
73
+ #
74
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-epic/#api-rest-agile-1-0-epic-epicidorkey-rank-put
75
+ #
76
+ # @param epic_id_or_key [Integer, String] The ID or key of the epic
77
+ # @param payload [Hash] Rank payload (rankBeforeEpic:, rankAfterEpic:, rankCustomFieldId:)
78
+ # @return [nil]
79
+ def rank_epic(epic_id_or_key, payload = {})
80
+ agile_put("/epic/#{url_encode(epic_id_or_key)}/rank", body: payload)
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jira
4
+ class Client
5
+ # Defines methods related to issue comments.
6
+ #
7
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/
8
+ module IssueComments
9
+ # Returns a paginated list of comments specified by a list of comment IDs
10
+ #
11
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-comment-list-post
12
+ #
13
+ # @param payload [Hash] Payload with comment IDs (e.g. { ids: [1, 2, 3] })
14
+ # @param options [Hash] Query parameters (e.g. expand:)
15
+ # @return [Jira::PaginatedResponse]
16
+ def comments_by_ids(payload = {}, options = {})
17
+ post("/comment/list", body: payload, query: options)
18
+ end
19
+
20
+ # Returns all comments for an issue
21
+ #
22
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-get
23
+ #
24
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
25
+ # @param options [Hash] Query parameters (e.g. startAt:, maxResults:, orderBy:, expand:)
26
+ # @return [Jira::PaginatedResponse]
27
+ def issue_comments(issue_id_or_key, options = {})
28
+ get("/issue/#{url_encode(issue_id_or_key)}/comment", query: options)
29
+ end
30
+
31
+ # Adds a comment to an issue
32
+ #
33
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post
34
+ #
35
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
36
+ # @param payload [Hash] Comment payload
37
+ # @param options [Hash] Query parameters (e.g. expand:)
38
+ # @return [Hash]
39
+ def add_comment(issue_id_or_key, payload = {}, options = {})
40
+ post("/issue/#{url_encode(issue_id_or_key)}/comment", body: payload, query: options)
41
+ end
42
+
43
+ # Returns a single comment for an issue
44
+ #
45
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-get
46
+ #
47
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
48
+ # @param comment_id [Integer, String] The ID of the comment
49
+ # @param options [Hash] Query parameters
50
+ # @return [Hash]
51
+ def issue_comment(issue_id_or_key, comment_id, options = {})
52
+ get("/issue/#{url_encode(issue_id_or_key)}/comment/#{comment_id}", query: options)
53
+ end
54
+
55
+ # Updates a comment on an issue
56
+ #
57
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-put
58
+ #
59
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
60
+ # @param comment_id [Integer, String] The ID of the comment
61
+ # @param payload [Hash] Comment payload
62
+ # @param options [Hash] Query parameters (e.g. expand:)
63
+ # @return [Hash]
64
+ def update_comment(issue_id_or_key, comment_id, payload = {}, options = {})
65
+ put("/issue/#{url_encode(issue_id_or_key)}/comment/#{comment_id}", body: payload, query: options)
66
+ end
67
+
68
+ # Deletes a comment from an issue
69
+ #
70
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-delete
71
+ #
72
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
73
+ # @param comment_id [Integer, String] The ID of the comment
74
+ # @return [nil]
75
+ def delete_comment(issue_id_or_key, comment_id)
76
+ delete("/issue/#{url_encode(issue_id_or_key)}/comment/#{comment_id}")
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jira
4
+ class Client
5
+ # Defines methods related to issue search.
6
+ #
7
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/
8
+ module IssueSearch
9
+ # Returns issue suggestions for auto-completion based on a query string
10
+ #
11
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-issue-picker-get
12
+ #
13
+ # @param options [Hash] Query parameters (e.g. query:, currentJQL:, currentIssueKey:)
14
+ # @return [Hash]
15
+ def issue_picker(options = {})
16
+ get("/issue/picker", query: options)
17
+ end
18
+
19
+ # Checks whether one or more issues would be returned by a JQL query
20
+ #
21
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-jql-match-post
22
+ #
23
+ # @param payload [Hash] Payload with JQL queries and issue IDs to match
24
+ # @return [Hash]
25
+ def match_issues(payload = {})
26
+ post("/jql/match", body: payload)
27
+ end
28
+
29
+ # Returns an approximate count of issues matching a JQL query
30
+ #
31
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-approximate-count-post
32
+ #
33
+ # @param payload [Hash] Payload with JQL query (e.g. { jql: "project = EX" })
34
+ # @return [Hash]
35
+ def approximate_issue_count(payload = {})
36
+ post("/search/approximate-count", body: payload)
37
+ end
38
+
39
+ # Searches for issues using JQL with reconciliation (GET)
40
+ #
41
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get
42
+ #
43
+ # @param options [Hash] Query parameters (e.g. jql:, nextPageToken:, maxResults:, fields:)
44
+ # @return [Jira::CursorPaginatedResponse]
45
+ def search_issues_jql(options = {})
46
+ get("/search/jql", query: options)
47
+ end
48
+
49
+ # Searches for issues using JQL with reconciliation (POST)
50
+ #
51
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-post
52
+ #
53
+ # @param payload [Hash] Search payload (e.g. jql:, nextPageToken:, maxResults:, fields:)
54
+ # @return [Jira::CursorPaginatedResponse]
55
+ def search_issues_jql_post(payload = {})
56
+ post("/search/jql", body: payload)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,123 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jira
4
+ class Client
5
+ # Defines methods related to issue worklogs.
6
+ #
7
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/
8
+ module IssueWorklogs
9
+ # Returns worklogs for an issue
10
+ #
11
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-get
12
+ #
13
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
14
+ # @param options [Hash] Query parameters
15
+ # @return [Jira::PaginatedResponse]
16
+ def issue_worklogs(issue_id_or_key, options = {})
17
+ get("/issue/#{url_encode(issue_id_or_key)}/worklog", query: options)
18
+ end
19
+
20
+ # Adds a worklog to an issue
21
+ #
22
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-post
23
+ #
24
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
25
+ # @param payload [Hash] Worklog payload
26
+ # @param options [Hash] Query parameters
27
+ # @return [Hash]
28
+ def add_worklog(issue_id_or_key, payload = {}, options = {})
29
+ post("/issue/#{url_encode(issue_id_or_key)}/worklog", body: payload, query: options)
30
+ end
31
+
32
+ # Bulk deletes worklogs from an issue
33
+ #
34
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-delete
35
+ #
36
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
37
+ # @param payload [Hash] Worklog IDs payload
38
+ # @return [nil]
39
+ def bulk_delete_worklogs(issue_id_or_key, payload = {})
40
+ delete("/issue/#{url_encode(issue_id_or_key)}/worklog", body: payload)
41
+ end
42
+
43
+ # Bulk moves worklogs from an issue
44
+ #
45
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-move-post
46
+ #
47
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
48
+ # @param payload [Hash] Move worklogs payload
49
+ # @return [nil]
50
+ def bulk_move_worklogs(issue_id_or_key, payload = {})
51
+ post("/issue/#{url_encode(issue_id_or_key)}/worklog/move", body: payload)
52
+ end
53
+
54
+ # Returns a single worklog for an issue
55
+ #
56
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-id-get
57
+ #
58
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
59
+ # @param worklog_id [Integer, String] The ID of the worklog
60
+ # @param options [Hash] Query parameters
61
+ # @return [Hash]
62
+ def worklog(issue_id_or_key, worklog_id, options = {})
63
+ get("/issue/#{url_encode(issue_id_or_key)}/worklog/#{worklog_id}", query: options)
64
+ end
65
+
66
+ # Updates a worklog on an issue
67
+ #
68
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-id-put
69
+ #
70
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
71
+ # @param worklog_id [Integer, String] The ID of the worklog
72
+ # @param payload [Hash] Worklog payload
73
+ # @param options [Hash] Query parameters
74
+ # @return [Hash]
75
+ def update_worklog(issue_id_or_key, worklog_id, payload = {}, options = {})
76
+ put("/issue/#{url_encode(issue_id_or_key)}/worklog/#{worklog_id}", body: payload, query: options)
77
+ end
78
+
79
+ # Deletes a worklog from an issue
80
+ #
81
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-id-delete
82
+ #
83
+ # @param issue_id_or_key [Integer, String] The ID or key of an issue
84
+ # @param worklog_id [Integer, String] The ID of the worklog
85
+ # @param options [Hash] Query parameters
86
+ # @return [nil]
87
+ def delete_worklog(issue_id_or_key, worklog_id, options = {})
88
+ delete("/issue/#{url_encode(issue_id_or_key)}/worklog/#{worklog_id}", query: options)
89
+ end
90
+
91
+ # Returns IDs of worklogs deleted since a given time
92
+ #
93
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-worklog-deleted-get
94
+ #
95
+ # @param options [Hash] Query parameters (e.g. since:)
96
+ # @return [Jira::CursorPaginatedResponse]
97
+ def deleted_worklog_ids(options = {})
98
+ get("/worklog/deleted", query: options)
99
+ end
100
+
101
+ # Returns worklogs for a list of IDs
102
+ #
103
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-worklog-list-post
104
+ #
105
+ # @param payload [Hash] Worklog IDs payload
106
+ # @param options [Hash] Query parameters
107
+ # @return [Array<Hash>]
108
+ def worklogs_for_ids(payload = {}, options = {})
109
+ post("/worklog/list", body: payload, query: options)
110
+ end
111
+
112
+ # Returns IDs of worklogs updated since a given time
113
+ #
114
+ # @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-worklog-updated-get
115
+ #
116
+ # @param options [Hash] Query parameters (e.g. since:)
117
+ # @return [Jira::CursorPaginatedResponse]
118
+ def updated_worklog_ids(options = {})
119
+ get("/worklog/updated", query: options)
120
+ end
121
+ end
122
+ end
123
+ end