Skip to content

Commit f0945f3

Browse files
committed
deprecated jira api search endpoint replacement
1 parent 50a4ff6 commit f0945f3

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## [0.12.0] - 2025-09-16
10+
### Fixed
11+
- deprecated jira search endpoint replacement - https://developer.atlassian.com/changelog/#CHANGE-2046
12+
913
## [0.11.0] - 2025-01-20
1014
### Changed
1115
- Tempo API version from 3 to 4 due to incoming shutdown of the old version
@@ -133,7 +137,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
133137
### Added
134138
- Initial release of gojira
135139

136-
[Unreleased]: https://github.com/jzyinq/gojira/compare/0.11.0...master
140+
[Unreleased]: https://github.com/jzyinq/gojira/compare/0.12.0...master
141+
[0.12.0]: https://github.com/jzyinq/gojira/compare/0.11.0...0.12.0
137142
[0.11.0]: https://github.com/jzyinq/gojira/compare/0.10.2...0.11.0
138143
[0.10.2]: https://github.com/jzyinq/gojira/compare/0.10.1...0.10.2
139144
[0.10.1]: https://github.com/jzyinq/gojira/compare/0.10.0...0.10.1

gojira/dayview.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package gojira
33
import (
44
"errors"
55
"fmt"
6-
"github.com/gdamore/tcell/v2"
7-
"github.com/rivo/tview"
86
"strings"
97
"time"
8+
9+
"github.com/gdamore/tcell/v2"
10+
"github.com/rivo/tview"
1011
)
1112

1213
const IssueKeyColumn = 0
@@ -112,7 +113,9 @@ func NewDayView() *DayView { //nolint:funlen
112113
dayView.worklogList.SetInputCapture(controlCalendar)
113114
dayView.latestIssuesList.SetInputCapture(controlCalendar)
114115

115-
dayView.loadLatest()
116+
go func() {
117+
dayView.loadLatest()
118+
}()
116119

117120
return dayView
118121
}

gojira/jira.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/base64"
66
"encoding/json"
77
"fmt"
8+
"net/url"
89
"strconv"
910
"strings"
1011
"time"
@@ -91,6 +92,7 @@ type JiraWorklogUpdate struct {
9192
}
9293

9394
func (jc *JiraClient) GetIssuesByJQL(jql string, maxResults int) (JQLResponse, error) {
95+
requestUrl := fmt.Sprintf("%s/rest/api/3/search/jql", Config.JiraUrl)
9496
payload := &JQLSearch{
9597
Expand: []string{"names"},
9698
Jql: jql,
@@ -99,13 +101,17 @@ func (jc *JiraClient) GetIssuesByJQL(jql string, maxResults int) (JQLResponse, e
99101
Fields: []string{"summary", "status"},
100102
StartAt: 0,
101103
}
102-
payloadJson, err := json.Marshal(payload)
103-
if err != nil {
104-
return JQLResponse{}, err
105-
}
106-
requestBody := bytes.NewBuffer(payloadJson)
107-
requestUrl := fmt.Sprintf("%s/rest/api/2/search", Config.JiraUrl)
108-
response, err := SendHttpRequest("POST", requestUrl, requestBody, jc.getHttpHeaders(), 200)
104+
105+
q := url.Values{}
106+
q.Set("jql", payload.Jql)
107+
q.Set("maxResults", fmt.Sprintf("%d", payload.MaxResults))
108+
q.Set("startAt", fmt.Sprintf("%d", payload.StartAt))
109+
q.Set("fields", strings.Join(payload.Fields, ","))
110+
q.Set("expand", strings.Join(payload.Expand, ","))
111+
q.Set("fieldsByKeys", strconv.FormatBool(payload.FieldsByKeys))
112+
113+
fullUrl := requestUrl + "?" + q.Encode()
114+
response, err := SendHttpRequest("GET", fullUrl, nil, jc.getHttpHeaders(), 200)
109115
if err != nil {
110116
return JQLResponse{}, err
111117
}

gojira/ui.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ func newUi() {
1919
app.ui.app = tview.NewApplication()
2020
app.ui.pages = tview.NewPages()
2121

22+
app.ui.errorView = NewErrorView()
23+
app.ui.loaderView = NewLoaderView()
24+
2225
app.ui.calendar = NewCalendar()
2326
app.ui.summary = NewSummary()
2427
app.ui.dayView = NewDayView()
25-
app.ui.errorView = NewErrorView()
26-
app.ui.loaderView = NewLoaderView()
2728

2829
app.ui.grid = tview.NewGrid().
2930
SetRows(1, 0, 0).

0 commit comments

Comments
 (0)