-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduced TypeScript type definitions SearchJiraResponse and JiraQueryResults to represent Jira search responses and pagination details. #127
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: b646a74 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, But @anicke should probably take an extra look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be easier to create a new function that will return the complete jira response.
a8d893d
to
11e281e
Compare
Hi anicke |
c26a4a6
to
63aa902
Compare
e241ddb
to
5281b1c
Compare
…ons by introducing structured TypeScript type definitions and enhancing the searchJira function to return both search results and HTTP status codes Signed-off-by: enaysaa [email protected] Introduced TypeScript type definitions SearchJiraResponse and JiraQueryResults to represent Jira search responses and pagination details. Updated the searchJira function to return search results as a SearchJiraResponse, incorporating the new types. Enhanced error handling in the searchJira function by handling HTTP response errors and logging them appropriately. The JiraQueryResults type outlines the structure of a paginated Jira search response, facilitating better data handling. These changes streamline the Jira Dashboard plugin's codebase, improving error resilience and clarity in handling search operations.
5281b1c
to
b646a74
Compare
Hi anicke GLundh @fridajac Thanks |
'@axis-backstage/plugin-jira-dashboard-common': minor | ||
--- | ||
|
||
Introduced TypeScript type definitions SearchJiraResponse and JiraQueryResults to represent Jira search responses and pagination details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this changes the "searchJira" call in a breaking way please update this with code examples how it has changed and how to update any code that is using it.
* @public | ||
*/ | ||
export const searchJira = async ( | ||
config: Config, | ||
jqlQuery: string, | ||
options: SearchOptions, | ||
): Promise<Issue[]> => { | ||
): Promise<SearchJiraResponse> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the error handling a bit? I would prefer if this would return "JiraQueryResults" directly. What is the benefit of having the caller of this function have to check the response status? Maybe something like this?
const response = await fetch(`${resolveJiraBaseUrl(config)}search`, {
....
});
if (response.ok) {
return await response.json();
}
throw new Error(`${response.status}`)
Hi @anicke |
Introduced TypeScript type definitions SearchJiraResponse and JiraQueryResults to represent Jira search responses and pagination details. Updated the searchJira function to return search results as a SearchJiraResponse, incorporating the new types. Enhanced error handling in the searchJira function by handling HTTP response errors and logging them appropriately. The JiraQueryResults type outlines the structure of a paginated Jira search response, facilitating better data handling. These changes streamline the Jira Dashboard plugin's codebase, improving error resilience and clarity in handling search operations.
Describe your changes
Please include a summary of the change, a relevant motivation and context.
Issue ticket number and link
Checklist before requesting a review