Skip to content

Commit

Permalink
Few increment improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRefactoring committed Feb 1, 2025
1 parent 67bca1e commit b02760d
Show file tree
Hide file tree
Showing 44 changed files with 455 additions and 153 deletions.
24 changes: 20 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@
- `JQL.parseJqlQueries`
- `TimeTracking.setSharedTimeTrackingConfiguration`
- `WorkflowSchemeProjectAssociations.assignSchemeToProject`
- `IssueTypes.createIssueType`
- **Improvement:** Changed the return type of `ProjectKeyAndNameValidation.getValidProjectKey` and `ProjectKeyAndNameValidation.getValidProjectName` from `unknown` to `string` for improved type safety and usability.
- **Fix:** Improved the `Avatars.storeAvatar` method:
- Added the `contentType` parameter to specify the type of the uploaded avatar.
- Updated the type of the `avatar` parameter from `any` to `Buffer | ArrayBuffer | Uint8Array | any` for better type safety.
- Set the default value of the `size` parameter to `0`.
- **Fix:** Improved the `IssueTypes.createIssueTypeAvatar` method:
- Added the `contentType` parameter to specify the type of the uploaded avatar.
- Added the avatar parameter with the type Buffer | ArrayBuffer | Uint8Array.
- Set the default value of the `size` parameter to `0`.
- **New APIs:** Added the following classes to support additional Jira APIs:
- **`AppDataPolicies`**: Manage app access rule data policies, allowing developers to set and retrieve rules controlling app access ([documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-app-data-policies/#api-group-app-data-policies)).
- **`ClassificationLevels`**: Define and manage classification levels for sensitive information in Jira ([documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-classification-levels/#api-group-classification-levels)).
Expand All @@ -25,10 +34,17 @@
- **`ProjectClassificationLevels`**: View and manage classification levels within individual projects to ensure compliance with organizational standards ([documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-classification-levels/#api-group-project-classification-levels)).
- **`ServiceRegistry`**: Access and manage attributes related to Jira Service Management’s service registry, which helps organize and maintain services ([documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-service-registry/#api-group-service-registry)).
- **`TeamsInPlan`**: Configure settings for Atlassian and custom teams within advanced roadmaps plans, including creating, updating, and deleting team configurations ([documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-teams-in-plan/#api-group-teams-in-plan)).
- **Fix:** Improved the `Avatars.storeAvatar` method:
- Added the `contentType` parameter to specify the type of the uploaded avatar.
- Updated the type of the `avatar` parameter from `any` to `Buffer | ArrayBuffer | Uint8Array | any` for better type safety.
- Set the default value of the `size` parameter to `0`.
- **Improvement:** Added the `extendAdminPermissions` parameter to the following methods in the `Dashboard` class:
- `Dashboard.createDashboard`
- `Dashboard.updateDashboard`
- `Dashboard.copyDashboard`
- **Improvement:** Added the `approximateLastUsed` parameter to the `Filters.createFilter` method.
- **Improvement:** Added the `isSubstringMatch` parameter to the `Filters.getFiltersPaginated` method.
- **Improvement:** Updated the `IssueComments.updateComment` method to allow passing a plain string for the comment instead of requiring a specific object format.
- **Improvement:** Added the `parentId` parameter to the `IssueComments.deleteComment` method.
- **Deprecation:** Marked the `InstanceInformation.getLicense` method as deprecated.
- **New Method:** Added the `getCustomFieldsConfigurations` method to the `IssueCustomFieldConfigurationApps` class.
- **New Method:** Added the `replaceCustomFieldOption` method to the `IssueCustomFieldOptions` class.

---

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"test": "npm run test:unit && npm run test:integration",
"test:unit": "vitest run tests/unit --maxWorkers=8 --sequence.concurrent",
"test:integration": "vitest run tests/integration --bail=1 --no-file-parallelism --max-concurrency 1 -c vitest.config.mts --hookTimeout 100000 --testTimeout 100000",
"replace:all": "npm run replace:permissions:version2 && npm run replace:permissions:version3 && npm run replace:pagination:version2 && npm run replace:pagination:version3 && npm run replace:async:version2 && npm run replace:async:version3 && npm run replace:expansion:version2 && npm run replace:expansion:version3 && npm run replace:ordering:version2 && npm run replace:ordering:version3 && npm run replace:groupMember:version2 && npm run replace:workflowPaginated:version2 && npm run replace:attachment:serviceDesk",
"replace:all": "npm run replace:permissions:version2 && npm run replace:permissions:version3 && npm run replace:pagination:version2 && npm run replace:pagination:version3 && npm run replace:async:version2 && npm run replace:async:version3 && npm run replace:expansion:version2 && npm run replace:expansion:version3 && npm run replace:ordering:version2 && npm run replace:ordering:version3 && npm run replace:groupMember:version2 && npm run replace:workflowPaginated:version2 && npm run replace:attachment:serviceDesk && npm run replace:priority:version3 && npm run replace:projectAvatar:version3 && npm run replace:issueType:version3",
"replace:permissions:version2": "grep -rl \"(#permissions)\" ./src/version2 | xargs sed -i '' 's/(#permissions)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v2\\/intro\\/#permissions)/g'",
"replace:permissions:version3": "grep -rl \"(#permissions)\" ./src/version3 | xargs sed -i '' 's/(#permissions)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v3\\/intro\\/#permissions)/g'",
"replace:pagination:version2": "grep -rl \"(#pagination)\" ./src/version2 | xargs sed -i '' 's/(#pagination)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v2\\/intro\\/#pagination)/g'",
Expand All @@ -51,6 +51,9 @@
"replace:groupMember:version2": "grep -rl \"(#api-rest-api-2-group-member-get)\" ./src/version2 | xargs sed -i '' 's/(#api-rest-api-2-group-member-get)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v2\\/api-group-groups\\/#api-rest-api-2-group-member-get)/g'",
"replace:workflowPaginated:version2": "grep -rl \"(#api-rest-api-2-workflow-search-get)\" ./src/version2 | xargs sed -i '' 's/(#api-rest-api-2-workflow-search-get)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v2\\/api-group-workflows\\/#api-rest-api-2-workflow-search-get)/g'",
"replace:attachment:serviceDesk": "grep -rl \"(#api-request-issueIdOrKey-attachment-post)\" ./src/serviceDesk | xargs sed -i '' 's/(#api-request-issueIdOrKey-attachment-post)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/service-desk\\/rest\\/api-group-servicedesk\\/#api-rest-servicedeskapi-servicedesk-servicedeskid-attachtemporaryfile-post)/g'",
"replace:priority:version3": "grep -rl \"(#api-rest-api-3-priority-id-put)\" ./src/version3 | xargs sed -i '' 's/(#api-rest-api-3-priority-id-put)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v3\\/api-group-issue-priorities\\/#api-rest-api-3-priority-id-put)/g'",
"replace:projectAvatar:version3": "grep -rl \"(#api-rest-api-3-project-projectIdOrKey-avatar-put)\" ./src/version3 | xargs sed -i '' 's/(#api-rest-api-3-project-projectIdOrKey-avatar-put)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v3\\/api-group-project-avatars\\/#api-rest-api-3-project-projectidorkey-avatar-put)/g'",
"replace:issueType:version3": "grep -rl \"(#api-rest-api-3-issuetype-id-put)\" ./src/version3 | xargs sed -i '' 's/(#api-rest-api-3-issuetype-id-put)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v3\\/api-group-issue-types\\/#api-rest-api-3-issuetype-id-put)/g'",
"code:formatting": "npm run replace:all && npm run prettier && npm run lint:fix"
},
"devDependencies": {
Expand Down
12 changes: 0 additions & 12 deletions src/version2/avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ export class Avatars {
/**
* Loads a custom avatar for a project or issue type.
*
* Specify the avatar's local file location in the body of the request. Also, include the following headers:
*
* - `X-Atlassian-Token: no-check` To prevent XSRF protection blocking the request, for more information see [Special
* Headers](#special-request-headers).
* - `Content-Type: image/image type` Valid image types are JPEG, GIF, or PNG.
*
* The avatar is cropped to a square. If no crop parameters are specified, the square originates at the top left of
* the image. The length of the square's sides is set to the smaller of the height or width of the image.
*
Expand All @@ -107,12 +101,6 @@ export class Avatars {
/**
* Loads a custom avatar for a project or issue type.
*
* Specify the avatar's local file location in the body of the request. Also, include the following headers:
*
* - `X-Atlassian-Token: no-check` To prevent XSRF protection blocking the request, for more information see [Special
* Headers](#special-request-headers).
* - `Content-Type: image/image type` Valid image types are JPEG, GIF, or PNG.
*
* The avatar is cropped to a square. If no crop parameters are specified, the square originates at the top left of
* the image. The length of the square's sides is set to the smaller of the height or width of the image.
*
Expand Down
17 changes: 11 additions & 6 deletions src/version2/issueTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class IssueTypes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createIssueType<T = Models.IssueTypeDetails>(
parameters: Parameters.CreateIssueType | undefined,
parameters: Parameters.CreateIssueType,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -61,20 +61,20 @@ export class IssueTypes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createIssueType<T = Models.IssueTypeDetails>(
parameters?: Parameters.CreateIssueType,
parameters: Parameters.CreateIssueType,
callback?: never,
): Promise<T>;
async createIssueType<T = Models.IssueTypeDetails>(
parameters?: Parameters.CreateIssueType,
parameters: Parameters.CreateIssueType,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/issuetype',
method: 'POST',
data: {
name: parameters?.name,
description: parameters?.description,
hierarchyLevel: parameters?.hierarchyLevel,
name: parameters.name,
description: parameters.description,
hierarchyLevel: parameters.hierarchyLevel,
},
};

Expand Down Expand Up @@ -339,6 +339,11 @@ export class IssueTypes {
const config: RequestConfig = {
url: `/rest/api/2/issuetype/${parameters.id}/avatar2`,
method: 'POST',
// todo
headers: {
'X-Atlassian-Token': 'no-check',
'Content-Type': parameters.contentType,

Check failure on line 345 in src/version2/issueTypes.ts

View workflow job for this annotation

GitHub Actions / Build (18.x)

Property 'contentType' does not exist on type 'CreateIssueTypeAvatar'.

Check failure on line 345 in src/version2/issueTypes.ts

View workflow job for this annotation

GitHub Actions / Build (20.x)

Property 'contentType' does not exist on type 'CreateIssueTypeAvatar'.
},
params: {
x: parameters.x,
y: parameters.y,
Expand Down
10 changes: 6 additions & 4 deletions src/version2/models/avatar.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { AvatarUrls } from './avatarUrls';

/** Details of an avatar. */
export interface Avatar {
/** The file name of the avatar icon. Returned for system avatars. */
fileName?: string;
/** The ID of the avatar. */
id: string;
/** Whether the avatar can be deleted. */
isDeletable?: boolean;
isDeletable: boolean;
/** Whether the avatar is used in Jira. For example, shown as a project's avatar. */
isSelected?: boolean;
isSelected: boolean;
/** Whether the avatar is a system avatar. */
isSystemAvatar?: boolean;
isSystemAvatar: boolean;
/**
* The owner of the avatar. For a system avatar the owner is null (and nothing is returned). For non-system avatars
* this is the appropriate identifier, such as the ID for a project or the account ID for a user.
*/
owner?: string;
/** The list of avatar icon URLs. */
urls?: {};
urls: AvatarUrls;
}
2 changes: 1 addition & 1 deletion src/version2/models/avatarWithDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export interface AvatarWithDetails {
/** The content type of the avatar. Expected values include 'image/png', 'image/svg+xml', or any other valid MIME type. */
contentType: 'image/png' | 'image/svg+xml' | string;
/** The binary representation of the avatar image. */
avatar: ArrayBuffer;
avatar: Uint8Array;
}
4 changes: 2 additions & 2 deletions src/version2/models/avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Avatar } from './avatar';
/** Details about system and custom avatars. */
export interface Avatars {
/** Custom avatars list. */
custom?: Avatar[];
custom: Avatar[];
/** System avatars list. */
system?: Avatar[];
system: Avatar[];
}
2 changes: 1 addition & 1 deletion src/version2/models/systemAvatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { Avatar } from './avatar';
/** List of system avatars. */
export interface SystemAvatars {
/** A list of avatar details. */
system?: Avatar[];
system: Omit<Avatar, 'fileName' | 'owner'>[];
}
16 changes: 8 additions & 8 deletions src/version3/appMigration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ export class AppMigration {
}

/**
* Updates the values of multiple entity properties for an object, up to 50 updates per request. This operation is
* for use by Connect apps during app migration.
* Updates the values of multiple entity properties for an object, up to 50 updates per request. This operation is for
* use by Connect apps during app migration.
*/
async updateEntityPropertiesValue<T = unknown>(
parameters: Parameters.UpdateEntityPropertiesValue,
callback: Callback<T>,
): Promise<void>;
/**
* Updates the values of multiple entity properties for an object, up to 50 updates per request. This operation is
* for use by Connect apps during app migration.
* Updates the values of multiple entity properties for an object, up to 50 updates per request. This operation is for
* use by Connect apps during app migration.
*/
async updateEntityPropertiesValue<T = unknown>(
parameters: Parameters.UpdateEntityPropertiesValue,
Expand All @@ -77,16 +77,16 @@ export class AppMigration {
}

/**
* Returns configurations for workflow transition rules migrated from server to cloud and owned by the calling
* Connect app.
* Returns configurations for workflow transition rules migrated from server to cloud and owned by the calling Connect
* app.
*/
async workflowRuleSearch<T = Models.WorkflowRulesSearchDetails>(
parameters: Parameters.WorkflowRuleSearch,
callback: Callback<T>,
): Promise<void>;
/**
* Returns configurations for workflow transition rules migrated from server to cloud and owned by the calling
* Connect app.
* Returns configurations for workflow transition rules migrated from server to cloud and owned by the calling Connect
* app.
*/
async workflowRuleSearch<T = Models.WorkflowRulesSearchDetails>(
parameters: Parameters.WorkflowRuleSearch,
Expand Down
24 changes: 6 additions & 18 deletions src/version3/avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,17 @@ export class Avatars {
/**
* Loads a custom avatar for a project, issue type or priority.
*
* Specify the avatar's local file location in the body of the request. Also, include the following headers:
*
* - `X-Atlassian-Token: no-check` To prevent XSRF protection blocking the request, for more information see [Special
* Headers](#special-request-headers).
* - `Content-Type: image/image type` Valid image types are JPEG, GIF, or PNG.
*
* The avatar is cropped to a square. If no crop parameters are specified, the square originates at the top left of
* the image. The length of the square's sides is set to the smaller of the height or width of the image.
*
* The cropped image is then used to create avatars of 16x16, 24x24, 32x32, and 48x48 in size.
*
* After creating the avatar use:
*
* - [Update issue type](#api-rest-api-3-issuetype-id-put) to set it as the issue type's displayed avatar.
* - [Set project avatar](#api-rest-api-3-project-projectIdOrKey-avatar-put) to set it as the project's displayed
* - [Update issue type](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-types/#api-rest-api-3-issuetype-id-put) to set it as the issue type's displayed avatar.
* - [Set project avatar](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-avatars/#api-rest-api-3-project-projectidorkey-avatar-put) to set it as the project's displayed
* avatar.
* - [Update priority](#api-rest-api-3-priority-id-put) to set it as the priority's displayed avatar.
* - [Update priority](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-priorities/#api-rest-api-3-priority-id-put) to set it as the priority's displayed avatar.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
Expand All @@ -112,23 +106,17 @@ export class Avatars {
/**
* Loads a custom avatar for a project, issue type or priority.
*
* Specify the avatar's local file location in the body of the request. Also, include the following headers:
*
* - `X-Atlassian-Token: no-check` To prevent XSRF protection blocking the request, for more information see [Special
* Headers](#special-request-headers).
* - `Content-Type: image/image type` Valid image types are JPEG, GIF, or PNG.
*
* The avatar is cropped to a square. If no crop parameters are specified, the square originates at the top left of
* the image. The length of the square's sides is set to the smaller of the height or width of the image.
*
* The cropped image is then used to create avatars of 16x16, 24x24, 32x32, and 48x48 in size.
*
* After creating the avatar use:
*
* - [Update issue type](#api-rest-api-3-issuetype-id-put) to set it as the issue type's displayed avatar.
* - [Set project avatar](#api-rest-api-3-project-projectIdOrKey-avatar-put) to set it as the project's displayed
* - [Update issue type](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-types/#api-rest-api-3-issuetype-id-put) to set it as the issue type's displayed avatar.
* - [Set project avatar](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-avatars/#api-rest-api-3-project-projectidorkey-avatar-put) to set it as the project's displayed
* avatar.
* - [Update priority](#api-rest-api-3-priority-id-put) to set it as the priority's displayed avatar.
* - [Update priority](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-priorities/#api-rest-api-3-priority-id-put) to set it as the priority's displayed avatar.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
Expand Down
11 changes: 10 additions & 1 deletion src/version3/dashboards.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
import { Client } from '../clients';
import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';

export class Dashboards {
Expand Down Expand Up @@ -70,6 +70,9 @@ export class Dashboards {
const config: RequestConfig = {
url: '/rest/api/3/dashboard',
method: 'POST',
params: {
extendAdminPermissions: parameters.extendAdminPermissions,
},
data: {
description: parameters.description,
editPermissions: parameters.editPermissions,
Expand Down Expand Up @@ -648,6 +651,9 @@ export class Dashboards {
const config: RequestConfig = {
url: `/rest/api/3/dashboard/${parameters.id}`,
method: 'PUT',
params: {
extendAdminPermissions: parameters.extendAdminPermissions,
},
data: {
description: parameters.description,
editPermissions: parameters.editPermissions,
Expand Down Expand Up @@ -715,6 +721,9 @@ export class Dashboards {
const config: RequestConfig = {
url: `/rest/api/3/dashboard/${parameters.id}/copy`,
method: 'POST',
params: {
extendAdminPermissions: parameters.extendAdminPermissions,
},
data: {
description: parameters.description,
editPermissions: parameters.editPermissions,
Expand Down
Loading

0 comments on commit b02760d

Please sign in to comment.