Skip to content

Commit

Permalink
bulkFetchIssues returned back for version2 client
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRefactoring committed Feb 20, 2025
1 parent 6c234d1 commit 4826e55
Show file tree
Hide file tree
Showing 26 changed files with 498 additions and 368 deletions.
506 changes: 270 additions & 236 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@
"code:formatting": "npm run replace:all && npm run prettier && npm run lint:fix"
},
"devDependencies": {
"@types/node": "^18.19.75",
"@types/node": "^18.19.76",
"@types/sinon": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^8.23.0",
"@typescript-eslint/parser": "^8.23.0",
"@typescript-eslint/eslint-plugin": "^8.24.1",
"@typescript-eslint/parser": "^8.24.1",
"dotenv": "^16.4.7",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-import-resolver-typescript": "^3.8.3",
"eslint-plugin-import": "^2.31.0",
"prettier": "^3.5.0",
"prettier": "^3.5.1",
"prettier-plugin-jsdoc": "^1.3.2",
"sinon": "^18.0.1",
"typedoc": "^0.27.7",
"typescript": "^5.7.3",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.0.5"
"vitest": "^3.0.6"
},
"dependencies": {
"axios": "^1.7.9",
Expand Down
108 changes: 85 additions & 23 deletions src/version2/issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,44 +329,106 @@ export class Issues {
}

/**
* @deprecated
* Returns details of projects, issue types within projects, and, when requested, the create screen fields for each
* issue type for the user. Use the information to populate the requests in [ Create
* issue](#api-rest-api-2-issue-post) and [Create issues](#api-rest-api-2-issue-bulk-post).
* Returns the details for a set of requested issues. You can request up to 100 issues.
*
* Deprecated, see [Create Issue Meta Endpoint Deprecation
* Notice](https://developer.atlassian.com/cloud/jira/platform/changelog/#CHANGE-1304).
* Each 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 request can be restricted to specific projects or issue types using the query parameters. The response will
* contain information for the valid projects, issue types, or project and issue type combinations requested. Note
* that invalid project, issue type, or project and issue type combinations do not generate errors.
* Issues will be returned in ascending `id` order. If there are errors, Jira will return a list of issues which
* couldn't be fetched along with error messages.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** _Create
* issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) in the requested projects.
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Issues
* are included in the response where the user has:
*
* - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is
* in.
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
* to view the issue.
*/
async bulkFetchIssues<T = Models.BulkIssue>(
parameters: Parameters.BulkFetchIssues,
callback: Callback<T>,
): Promise<void>;
/**
* Returns the details for a set of requested issues. You can request up to 100 issues.
*
* Each 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.
*
* Issues will be returned in ascending `id` order. If there are errors, Jira will return a list of issues which
* couldn't be fetched along with error messages.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Issues
* are included in the response where the user has:
*
* - _Browse projects_ [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is
* in.
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
* to view the issue.
*/
async bulkFetchIssues<T = Models.BulkIssue>(parameters: Parameters.BulkFetchIssues, callback?: never): Promise<T>;
async bulkFetchIssues<T = Models.BulkIssue>(
parameters: Parameters.BulkFetchIssues,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/3/issue/bulkfetch',
method: 'POST',
data: {
expand: parameters.expand,
fields: parameters.fields,
fieldsByKeys: parameters.fieldsByKeys,
issueIdsOrKeys: parameters.issueIdsOrKeys,
properties: parameters.properties,
},
};

return this.client.sendRequest(config, callback);
}

/**
* @deprecated Returns details of projects, issue types within projects, and, when requested, the create screen fields
* for each issue type for the user. Use the information to populate the requests in [ Create
* issue](#api-rest-api-2-issue-post) and [Create issues](#api-rest-api-2-issue-bulk-post).
*
* Deprecated, see [Create Issue Meta Endpoint Deprecation
* Notice](https://developer.atlassian.com/cloud/jira/platform/changelog/#CHANGE-1304).
*
* The request can be restricted to specific projects or issue types using the query parameters. The response will
* contain information for the valid projects, issue types, or project and issue type combinations requested. Note
* that invalid project, issue type, or project and issue type combinations do not generate errors.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** _Create
* issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) in the requested projects.
*/
async getCreateIssueMeta<T = Models.IssueCreateMetadata>(
parameters: Parameters.GetCreateIssueMeta | undefined,
callback: Callback<T>,
): Promise<void>;
/**
* @deprecated
* Returns details of projects, issue types within projects, and, when requested, the create screen fields for each
* issue type for the user. Use the information to populate the requests in [ Create
* issue](#api-rest-api-2-issue-post) and [Create issues](#api-rest-api-2-issue-bulk-post).
* @deprecated Returns details of projects, issue types within projects, and, when requested, the create screen fields
* for each issue type for the user. Use the information to populate the requests in [ Create
* issue](#api-rest-api-2-issue-post) and [Create issues](#api-rest-api-2-issue-bulk-post).
*
* Deprecated, see [Create Issue Meta Endpoint Deprecation
* Notice](https://developer.atlassian.com/cloud/jira/platform/changelog/#CHANGE-1304).
* Deprecated, see [Create Issue Meta Endpoint Deprecation
* Notice](https://developer.atlassian.com/cloud/jira/platform/changelog/#CHANGE-1304).
*
* The request can be restricted to specific projects or issue types using the query parameters. The response will
* contain information for the valid projects, issue types, or project and issue type combinations requested. Note
* that invalid project, issue type, or project and issue type combinations do not generate errors.
* The request can be restricted to specific projects or issue types using the query parameters. The response will
* contain information for the valid projects, issue types, or project and issue type combinations requested. Note
* that invalid project, issue type, or project and issue type combinations do not generate errors.
*
* This operation can be accessed anonymously.
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** _Create
* issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) in the requested projects.
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** _Create
* issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) in the requested projects.
*/
async getCreateIssueMeta<T = Models.IssueCreateMetadata>(
parameters?: Parameters.GetCreateIssueMeta,
Expand Down
5 changes: 2 additions & 3 deletions src/version2/models/approvalConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ export interface ApprovalConfiguration {
active: 'true' | 'false' | string;
/**
* How the required approval count is calculated. It may be configured to require a specific number of approvals, or
* approval by a percentage of approvers. If the approvers source field is Approver groups, you can configure how
* many approvals per group are required for the request to be approved. The number will be the same across all
* groups.
* approval by a percentage of approvers. If the approvers source field is Approver groups, you can configure how many
* approvals per group are required for the request to be approved. The number will be the same across all groups.
*/
conditionType: 'number' | 'percent' | 'numberPerPrincipal' | string;
/**
Expand Down
4 changes: 2 additions & 2 deletions src/version2/models/bulkChangelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export interface BulkChangelog {
/** The list of issues changelogs. */
issueChangeLogs?: IssueChangeLog[];
/**
* Continuation token to fetch the next page. If this result represents the last or the only page, this token will
* be null.
* Continuation token to fetch the next page. If this result represents the last or the only page, this token will be
* null.
*/
nextPageToken?: string;
}
43 changes: 0 additions & 43 deletions src/version2/models/bulkFetchIssueRequest.ts

This file was deleted.

14 changes: 14 additions & 0 deletions src/version2/models/bulkIssue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IssueError } from './issueError';
import { Issue } from './issue';

/** The list of requested issues & fields. */
export interface BulkIssue {
/**
* When Jira can't return an issue enumerated in a request due to a retriable error or payload constraint, we'll
* return the respective issue ID with a corresponding error message. This list is empty when there are no errors
* Issues which aren't found or that the user doesn't have permission to view won't be returned in this list.
*/
issueErrors?: IssueError[];
/** The list of issues. */
issues?: Issue[];
}
4 changes: 2 additions & 2 deletions src/version2/models/createIssueSourceRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export interface CreateIssueSourceRequest {
/** The issue source type. This must be "Board", "Project" or "Filter". */
type: 'Board' | 'Project' | 'Filter' | string;
/**
* The issue source value. This must be a board ID if the type is "Board", a project ID if the type is "Project" or
* a filter ID if the type is "Filter".
* The issue source value. This must be a board ID if the type is "Board", a project ID if the type is "Project" or a
* filter ID if the type is "Filter".
*/
value: number;
}
4 changes: 2 additions & 2 deletions src/version2/models/detailedErrorCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export interface DetailedErrorCollection {
/** The list of error messages produced by this operation. For example, "input parameter 'key' must be provided" */
errorMessages?: string[];
/**
* The list of errors by parameter returned by the operation. For example,"projectKey": "Project keys must start
* with an uppercase letter, followed by one or more uppercase alphanumeric characters."
* The list of errors by parameter returned by the operation. For example,"projectKey": "Project keys must start with
* an uppercase letter, followed by one or more uppercase alphanumeric characters."
*/
errors?: {};
}
4 changes: 2 additions & 2 deletions src/version2/models/evaluatedJiraExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export interface EvaluatedJiraExpression {
/**
* The value of the evaluated expression. It may be a primitive JSON value or a Jira REST API object. (Some
* expressions do not produce any meaningful results—for example, an expression that returns a lambda function—if
* that's the case a simple string representation is returned. These string representations should not be relied
* upon and may change without notice.)
* that's the case a simple string representation is returned. These string representations should not be relied upon
* and may change without notice.)
*/
value: {};
}
2 changes: 1 addition & 1 deletion src/version2/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export * from './bulkChangeOwnerDetails';
export * from './bulkCustomFieldOptionCreateRequest';
export * from './bulkCustomFieldOptionUpdateRequest';
export * from './bulkEditShareableEntity';
export * from './bulkFetchIssueRequest';
export * from './bulkIssue';
export * from './bulkIssueIsWatching';
export * from './bulkIssuePropertyUpdateRequest';
export * from './bulkOperationErrorResult';
Expand Down
4 changes: 2 additions & 2 deletions src/version2/models/issueLimitReportRequest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface IssueLimitReportRequest {
/**
* A list of fields and their respective approaching limit threshold. Required for querying issues approaching
* limits. Optional for querying issues breaching limits. Accepted fields are: `comment`, `worklog`, `attachment`,
* A list of fields and their respective approaching limit threshold. Required for querying issues approaching limits.
* Optional for querying issues breaching limits. Accepted fields are: `comment`, `worklog`, `attachment`,
* `remoteIssueLinks`, and `issuelinks`. Example: `{"issuesApproachingLimitParams": {"comment": 4500, "attachment":
* 1800}}`
*/
Expand Down
4 changes: 2 additions & 2 deletions src/version2/models/jqlFunctionPrecomputationUpdateBean.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** Precomputation id and its new value. */
export interface JqlFunctionPrecomputationUpdateBean {
/**
* The error message to be displayed to the user if the given function clause is no longer valid during
* recalculation of the precomputation.
* The error message to be displayed to the user if the given function clause is no longer valid during recalculation
* of the precomputation.
*/
error?: string;
/** The id of the precomputation to update. */
Expand Down
21 changes: 10 additions & 11 deletions src/version2/models/searchAndReconcileRequest.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export interface SearchAndReconcileRequest {
/**
* Use [expand](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#expansion) to include additional
* information about issues in the response. Note that, unlike the majority of instances where `expand` is
* specified, `expand` is defined as a comma-delimited string of values. The expand options are:
* information about issues in the response. Note that, unlike the majority of instances where `expand` is specified,
* `expand` is defined as a comma-delimited string of values. The expand options are:
*
* `renderedFields` Returns field values rendered in HTML format. `names` Returns the display name of each field.
* `schema` Returns the schema describing a field type. `transitions` Returns all possible transitions for the
* issue. `operations` Returns all possible operations for the issue. `editmeta` Returns information about how each
* field can be edited. `changelog` Returns a list of recent updates to an issue, sorted by date, starting from the
* most recent. `versionedRepresentations` Instead of `fields`, returns `versionedRepresentations` a JSON array
* containing each version of a field's value, with the highest numbered item representing the most recent version.
* `schema` Returns the schema describing a field type. `transitions` Returns all possible transitions for the issue.
* `operations` Returns all possible operations for the issue. `editmeta` Returns information about how each field can
* be edited. `changelog` Returns a list of recent updates to an issue, sorted by date, starting from the most recent.
* `versionedRepresentations` Instead of `fields`, returns `versionedRepresentations` a JSON array containing each
* version of a field's value, with the highest numbered item representing the most recent version.
*
* Examples: `"names,changelog"` Returns the display name of each field as well as a list of recent updates to an issue.
*/
Expand All @@ -25,8 +25,7 @@ export interface SearchAndReconcileRequest {
*
* Examples:
*
* `summary,comment` Returns the summary and comments fields only. `*all,-comment` Returns all fields except
* comments.
* `summary,comment` Returns the summary and comments fields only. `*all,-comment` Returns all fields except comments.
*
* Multiple `fields` parameters can be included in a request.
*
Expand All @@ -39,8 +38,8 @@ export interface SearchAndReconcileRequest {
* A [JQL](https://confluence.atlassian.com/x/egORLQ) expression. For performance reasons, this parameter requires a
* bounded query. A bounded query is a query with a search restriction.
*
* Example of an unbounded query: `order by key desc`. Example of a bounded query: `assignee = currentUser() order
* by key`.
* Example of an unbounded query: `order by key desc`. Example of a bounded query: `assignee = currentUser() order by
* key`.
*
* Additionally, `orderBy` clause can contain a maximum of 7 fields.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/version2/models/simpleErrorCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export interface SimpleErrorCollection {
/** The list of error messages produced by this operation. For example, "input parameter 'key' must be provided" */
errorMessages?: string[];
/**
* The list of errors by parameter returned by the operation. For example,"projectKey": "Project keys must start
* with an uppercase letter, followed by one or more uppercase alphanumeric characters."
* The list of errors by parameter returned by the operation. For example,"projectKey": "Project keys must start with
* an uppercase letter, followed by one or more uppercase alphanumeric characters."
*/
errors?: {};
httpStatusCode?: number;
Expand Down
Loading

0 comments on commit 4826e55

Please sign in to comment.