Merge pull request #4675 from j0na1han/feature/jiraMaxResults

Feature/jira context provider added max result attribute
This commit is contained in:
Nate Sesti 2025-03-16 12:21:36 -07:00 • committed by GitHub
commit dbda686a0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 3 deletions

View file

@ -9,6 +9,7 @@ interface JiraClientOptions {
password: string;
issueQuery?: string;
apiVersion?: string;
maxResults?: string;
requestOptions?: RequestOptions;
}
@ -73,6 +74,7 @@ export class JiraClient {
"assignee = currentUser() AND resolution = Unresolved order by updated DESC",
apiVersion: "3",
requestOptions: {},
maxResults: "50",
...options,
};
this.baseUrl = `https://${this.options.domain}/rest/api/${this.options.apiVersion}`;
@ -146,7 +148,7 @@ export class JiraClient {
`/search?fields=summary&jql=${
this.options.issueQuery ??
"assignee = currentUser() AND resolution = Unresolved order by updated DESC"
}`,
}&maxResults=${this.options.maxResults ?? "50"}`,
),
{
method: "GET",

View file

@ -25,6 +25,7 @@ class JiraIssuesContextProvider extends BaseContextProvider {
issueQuery: this.options.issueQuery,
apiVersion: this.options.apiVersion,
requestOptions: this.options.requestOptions,
maxResults: this.options.maxResults
});
}
@ -32,8 +33,6 @@ class JiraIssuesContextProvider extends BaseContextProvider {
query: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
const issueId = query;
const api = this.getApi();
const issue = await api.issue(query, extras.fetch);

View file

@ -879,6 +879,11 @@ assignee = currentUser() AND resolution = Unresolved order by updated DESC
You can override this query by setting the `issueQuery` parameter.
#### Max results
You can set the `maxResults` parameter to limit the number of results returned. The default is `50`.
### `@Discord`
Reference the messages in a Discord channel.

View file

@ -2329,6 +2329,10 @@
"type": "string",
"description": "Customize the query used to find Jira issues"
},
"maxResults": {
"type": "string",
"description": "The maximum number of issues that will be returned. Defaults to 50."
},
"apiVersion": {
"type": "integer",
"markdownDescription": "This context provider supports both Jira API version 2 and 3. It will use version 3 by default since that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need to set the API Version to 2 using the `apiVersion` property.",