Skip to content

Commit 5d2c460

Browse files
Endpoints updates (#167)
* - Version 2 and Version 3 - `mediaApiFileId` property added to `AttachmentMetadata` model. - [`getAvatarImageByType`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-avatars/#api-rest-api-2-universal-avatar-view-type-type-get) method added to `Avatar` group. - [`getAvatarImageByID`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-avatars/#api-rest-api-2-universal-avatar-view-type-type-avatar-id-get) method added to `Avatar` group. - [`getAvatarImageByOwner`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-avatars/#api-rest-api-2-universal-avatar-view-type-type-owner-entityid-get) method added to `Avatar` group. - `editPermissions` property added to `Filter` model. - [`getAttachmentContent`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-rest-api-2-attachment-content-id-get) method added to `IssueAttachments` group. - [`getAttachmentThumbnail`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-rest-api-2-attachment-thumbnail-id-get) method added to `IssueAttachments` group. - `overrideScreenSecurity` and `overrideEditableFlag` properties added to `replaceIssueFieldOption` method in `IssueCustomFieldOptionsApps` group. - [`updateMultipleCustomFieldValues`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-custom-field-values--apps-/#api-rest-api-2-app-field-value-post) method added to `IssueCustomFieldValuesApps` group. - [`createFieldConfiguration`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-field-configurations/#api-rest-api-2-fieldconfiguration-post) method added to `IssueFieldConfigurations` group. - [`updateFieldConfiguration`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-field-configurations/#api-rest-api-2-fieldconfiguration-id-put) method added to `IssueFieldConfigurations` group. - [`deleteFieldConfiguration`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-field-configurations/#api-rest-api-2-fieldconfiguration-id-delete) method added to `IssueFieldConfigurations` group. - `custom` property added to `JiraExpressionEvalContext` model. - `schemes` property added to `Workflow` model. * Version 3 updates
1 parent 2c05cc5 commit 5d2c460

File tree

107 files changed

+1660
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1660
-287
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Jira.js changelog
22

3+
### 2.8.0
4+
5+
- JSDoc improvements.
6+
- Version 2 and Version 3
7+
- `mediaApiFileId` property added to `AttachmentMetadata` model.
8+
- [`getAvatarImageByType`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-avatars/#api-rest-api-2-universal-avatar-view-type-type-get) method added to `Avatar` group.
9+
- [`getAvatarImageByID`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-avatars/#api-rest-api-2-universal-avatar-view-type-type-avatar-id-get) method added to `Avatar` group.
10+
- [`getAvatarImageByOwner`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-avatars/#api-rest-api-2-universal-avatar-view-type-type-owner-entityid-get) method added to `Avatar` group.
11+
- `editPermissions` property added to `Filter` model.
12+
- [`getAttachmentContent`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-rest-api-2-attachment-content-id-get) method added to `IssueAttachments` group.
13+
- [`getAttachmentThumbnail`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-rest-api-2-attachment-thumbnail-id-get) method added to `IssueAttachments` group.
14+
- `overrideScreenSecurity` and `overrideEditableFlag` properties added to `replaceIssueFieldOption` method in `IssueCustomFieldOptionsApps` group.
15+
- [`updateMultipleCustomFieldValues`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-custom-field-values--apps-/#api-rest-api-2-app-field-value-post) method added to `IssueCustomFieldValuesApps` group.
16+
- [`createFieldConfiguration`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-field-configurations/#api-rest-api-2-fieldconfiguration-post) method added to `IssueFieldConfigurations` group.
17+
- [`updateFieldConfiguration`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-field-configurations/#api-rest-api-2-fieldconfiguration-id-put) method added to `IssueFieldConfigurations` group.
18+
- [`deleteFieldConfiguration`](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-field-configurations/#api-rest-api-2-fieldconfiguration-id-delete) method added to `IssueFieldConfigurations` group.
19+
- `custom` property added to `JiraExpressionEvalContext` model.
20+
- `schemes` property added to `Workflow` model.
21+
322
### 2.7.0
423

524
- Version 2:

package-lock.json

Lines changed: 209 additions & 115 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jira.js",
3-
"version": "2.7.0",
3+
"version": "2.8.0",
44
"description": "jira.js is a powerful Node.JS/Browser module that allows you to interact with the Jira API very easily",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",
@@ -44,29 +44,29 @@
4444
"devDependencies": {
4545
"@types/express": "^4.17.13",
4646
"@types/jest": "^27.0.2",
47-
"@types/node": "^16.11.1",
47+
"@types/node": "^16.11.7",
4848
"@types/oauth": "^0.9.1",
49-
"@types/sinon": "^10.0.4",
50-
"@typescript-eslint/eslint-plugin": "^5.1.0",
51-
"@typescript-eslint/parser": "^5.1.0",
49+
"@types/sinon": "^10.0.6",
50+
"@typescript-eslint/eslint-plugin": "^5.3.1",
51+
"@typescript-eslint/parser": "^5.3.1",
5252
"dotenv": "^10.0.0",
53-
"eslint": "^8.0.1",
54-
"eslint-config-airbnb": "^18.2.1",
55-
"eslint-config-airbnb-typescript": "^14.0.1",
53+
"eslint": "^8.2.0",
54+
"eslint-config-airbnb": "^19.0.0",
55+
"eslint-config-airbnb-typescript": "^15.0.0",
5656
"eslint-import-resolver-typescript": "^2.5.0",
57-
"eslint-plugin-import": "^2.25.2",
57+
"eslint-plugin-import": "^2.25.3",
5858
"jest": "^27.3.1",
5959
"prettier": "^2.4.1",
60-
"prettier-plugin-jsdoc": "^0.3.24",
61-
"sinon": "^11.1.2",
60+
"prettier-plugin-jsdoc": "^0.3.30",
61+
"sinon": "^12.0.1",
6262
"ts-jest": "^27.0.7",
63-
"typedoc": "^0.22.6",
63+
"typedoc": "^0.22.9",
6464
"typedoc-plugin-extras": "^2.2.1",
6565
"typescript": "^4.4.4"
6666
},
6767
"dependencies": {
6868
"atlassian-jwt": "^2.0.2",
69-
"axios": "^0.23.0",
69+
"axios": "^0.24.0",
7070
"form-data": "^4.0.0",
7171
"oauth": "^0.9.15",
7272
"telemetry.jira.js": "<2",

src/clients/baseClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export class BaseClient implements Client {
8484
bodyExists: !!requestConfig.data,
8585
callbackUsed: !!callback,
8686
headersExists: !!requestConfig.headers,
87-
libVersion: '2.7.0',
88-
libVersionHash: '14230927309d90e1e375e50abbc7ec23',
87+
libVersion: '2.8.0',
88+
libVersionHash: '96f223040672ea79c655dceda08e0830',
8989
methodName: telemetryData?.methodName || 'sendRequest',
9090
onErrorMiddlewareUsed: !!this.config.middlewares?.onError,
9191
onResponseMiddlewareUsed: !!this.config.middlewares?.onResponse,

src/version2/avatars.ts

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,133 @@ export class Avatars {
184184

185185
return this.client.sendRequest(config, callback, { methodName: 'version2.avatars.deleteAvatar' });
186186
}
187+
188+
/**
189+
* Returns the default project or issue type avatar image.
190+
*
191+
* This operation can be accessed anonymously.
192+
*
193+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** None.
194+
*/
195+
async getAvatarImageByType<T = unknown>(
196+
parameters: Parameters.GetAvatarImageByType,
197+
callback: Callback<T>
198+
): Promise<void>;
199+
/**
200+
* Returns the default project or issue type avatar image.
201+
*
202+
* This operation can be accessed anonymously.
203+
*
204+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** None.
205+
*/
206+
async getAvatarImageByType<T = unknown>(parameters: Parameters.GetAvatarImageByType, callback?: never): Promise<T>;
207+
async getAvatarImageByType<T = unknown>(
208+
parameters: Parameters.GetAvatarImageByType,
209+
callback?: Callback<T>,
210+
): Promise<void | T> {
211+
const config: RequestConfig = {
212+
url: `/rest/api/2/universal_avatar/view/type/${parameters.type}`,
213+
method: 'GET',
214+
params: {
215+
size: parameters.size,
216+
format: parameters.format,
217+
},
218+
};
219+
220+
return this.client.sendRequest(config, callback, { methodName: 'version2.avatars.getAvatarImageByType' });
221+
}
222+
223+
/**
224+
* Returns a project or issue type avatar image by ID.
225+
*
226+
* This operation can be accessed anonymously.
227+
*
228+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
229+
*
230+
* - For system avatars, none.
231+
* - For custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for
232+
* the project the avatar belongs to.
233+
* - For custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg)
234+
* for at least one project the issue type is used in.
235+
*/
236+
async getAvatarImageByID<T = unknown>(
237+
parameters: Parameters.GetAvatarImageByID,
238+
callback: Callback<T>
239+
): Promise<void>;
240+
/**
241+
* Returns a project or issue type avatar image by ID.
242+
*
243+
* This operation can be accessed anonymously.
244+
*
245+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
246+
*
247+
* - For system avatars, none.
248+
* - For custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for
249+
* the project the avatar belongs to.
250+
* - For custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg)
251+
* for at least one project the issue type is used in.
252+
*/
253+
async getAvatarImageByID<T = unknown>(parameters: Parameters.GetAvatarImageByID, callback?: never): Promise<T>;
254+
async getAvatarImageByID<T = unknown>(
255+
parameters: Parameters.GetAvatarImageByID,
256+
callback?: Callback<T>,
257+
): Promise<void | T> {
258+
const config: RequestConfig = {
259+
url: `/rest/api/2/universal_avatar/view/type/${parameters.type}/avatar/${parameters.id}`,
260+
method: 'GET',
261+
params: {
262+
size: parameters.size,
263+
format: parameters.format,
264+
},
265+
};
266+
267+
return this.client.sendRequest(config, callback, { methodName: 'version2.avatars.getAvatarImageByID' });
268+
}
269+
270+
/**
271+
* Returns the avatar image for a project or issue type.
272+
*
273+
* This operation can be accessed anonymously.
274+
*
275+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
276+
*
277+
* - For system avatars, none.
278+
* - For custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for
279+
* the project the avatar belongs to.
280+
* - For custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg)
281+
* for at least one project the issue type is used in.
282+
*/
283+
async getAvatarImageByOwner<T = unknown>(
284+
parameters: Parameters.GetAvatarImageByOwner,
285+
callback: Callback<T>
286+
): Promise<void>;
287+
/**
288+
* Returns the avatar image for a project or issue type.
289+
*
290+
* This operation can be accessed anonymously.
291+
*
292+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
293+
*
294+
* - For system avatars, none.
295+
* - For custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for
296+
* the project the avatar belongs to.
297+
* - For custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg)
298+
* for at least one project the issue type is used in.
299+
*/
300+
async getAvatarImageByOwner<T = unknown>(parameters: Parameters.GetAvatarImageByOwner, callback?: never): Promise<T>;
301+
async getAvatarImageByOwner<T = unknown>(
302+
parameters: Parameters.GetAvatarImageByOwner,
303+
callback?: Callback<T>,
304+
): Promise<void | T> {
305+
const config: RequestConfig = {
306+
url: `/rest/api/2/universal_avatar/view/type/${parameters.type}/owner/${parameters.entityId}`,
307+
method: 'GET',
308+
params: {
309+
size: parameters.size,
310+
format: parameters.format,
311+
},
312+
};
313+
314+
return this.client.sendRequest(config, callback, { methodName: 'version2.avatars.getAvatarImageByOwner' });
315+
}
187316
}

src/version2/filters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class Filters {
9797
favourite: parameters?.favourite,
9898
favouritedCount: parameters?.favouritedCount,
9999
sharePermissions: parameters?.sharePermissions,
100+
editPermissions: parameters?.editPermissions,
100101
sharedUsers: parameters?.sharedUsers,
101102
subscriptions: parameters?.subscriptions,
102103
},

src/version2/groups.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ export class Groups {
110110
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** *Browse
111111
* users and groups* [global permission](https://confluence.atlassian.com/x/x4dKLg).
112112
*/
113-
async bulkGetGroups<T = Models.PageGroupDetails>(
114-
parameters?: Parameters.BulkGetGroups,
115-
callback?: never
116-
): Promise<T>;
113+
async bulkGetGroups<T = Models.PageGroupDetails>(parameters?: Parameters.BulkGetGroups, callback?: never): Promise<T>;
117114
async bulkGetGroups<T = Models.PageGroupDetails>(
118115
parameters?: Parameters.BulkGetGroups,
119116
callback?: Callback<T>,

src/version2/issueAttachments.ts

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,58 @@ import { RequestConfig } from '../requestConfig';
88
export class IssueAttachments {
99
constructor(private client: Client) {}
1010

11+
/**
12+
* Returns the contents of an attachment. A `Range` header can be set to define a range of bytes within the attachment
13+
* to download. See the [HTTP Range header standard](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range)
14+
* for details.
15+
*
16+
* To return a thumbnail of the attachment, use [Download attachment thumbnail](#api-rest-api-2-attachment-thumbnail-id-get).
17+
*
18+
* This operation can be accessed anonymously.
19+
*
20+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** For the
21+
* issue containing the attachment:
22+
*
23+
* - *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
24+
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
25+
* to view the issue.
26+
*/
27+
async getAttachmentContent<T = unknown>(
28+
parameters: Parameters.GetAttachmentContent,
29+
callback: Callback<T>
30+
): Promise<void>;
31+
/**
32+
* Returns the contents of an attachment. A `Range` header can be set to define a range of bytes within the attachment
33+
* to download. See the [HTTP Range header standard](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range)
34+
* for details.
35+
*
36+
* To return a thumbnail of the attachment, use [Download attachment thumbnail](#api-rest-api-2-attachment-thumbnail-id-get).
37+
*
38+
* This operation can be accessed anonymously.
39+
*
40+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** For the
41+
* issue containing the attachment:
42+
*
43+
* - *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
44+
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
45+
* to view the issue.
46+
*/
47+
async getAttachmentContent<T = unknown>(parameters: Parameters.GetAttachmentContent, callback?: never): Promise<T>;
48+
async getAttachmentContent<T = unknown>(
49+
parameters: Parameters.GetAttachmentContent,
50+
callback?: Callback<T>,
51+
): Promise<void | T> {
52+
const config: RequestConfig = {
53+
url: `/rest/api/2/attachment/content/${parameters.id}`,
54+
method: 'GET',
55+
params: {
56+
redirect: parameters.redirect,
57+
},
58+
};
59+
60+
return this.client.sendRequest(config, callback, { methodName: 'version2.issueAttachments.getAttachmentContent' });
61+
}
62+
1163
/**
1264
* Returns the attachment settings, that is, whether attachments are enabled and the maximum attachment size allowed.
1365
*
@@ -39,6 +91,62 @@ export class IssueAttachments {
3991
return this.client.sendRequest(config, callback, { methodName: 'version2.issueAttachments.getAttachmentMeta' });
4092
}
4193

94+
/**
95+
* Returns the thumbnail of an attachment.
96+
*
97+
* To return the attachment contents, use [Download attachment content](#api-rest-api-2-attachment-content-id-get).
98+
*
99+
* This operation can be accessed anonymously.
100+
*
101+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** For the
102+
* issue containing the attachment:
103+
*
104+
* - *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
105+
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
106+
* to view the issue.
107+
*/
108+
async getAttachmentThumbnail<T = unknown>(
109+
parameters: Parameters.GetAttachmentThumbnail,
110+
callback: Callback<T>
111+
): Promise<void>;
112+
/**
113+
* Returns the thumbnail of an attachment.
114+
*
115+
* To return the attachment contents, use [Download attachment content](#api-rest-api-2-attachment-content-id-get).
116+
*
117+
* This operation can be accessed anonymously.
118+
*
119+
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** For the
120+
* issue containing the attachment:
121+
*
122+
* - *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
123+
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
124+
* to view the issue.
125+
*/
126+
async getAttachmentThumbnail<T = unknown>(
127+
parameters: Parameters.GetAttachmentThumbnail,
128+
callback?: never
129+
): Promise<T>;
130+
async getAttachmentThumbnail<T = unknown>(
131+
parameters: Parameters.GetAttachmentThumbnail,
132+
callback?: Callback<T>,
133+
): Promise<void | T> {
134+
const config: RequestConfig = {
135+
url: `/rest/api/2/attachment/thumbnail/${parameters.id}`,
136+
method: 'GET',
137+
params: {
138+
redirect: parameters.redirect,
139+
fallbackToDefault: parameters.fallbackToDefault,
140+
width: parameters.width,
141+
height: parameters.height,
142+
},
143+
};
144+
145+
return this.client.sendRequest(config, callback, {
146+
methodName: 'version2.issueAttachments.getAttachmentThumbnail',
147+
});
148+
}
149+
42150
/**
43151
* Returns the metadata for an attachment. Note that the attachment itself is not returned.
44152
*

0 commit comments

Comments
 (0)