Skip to content

Commit

Permalink
New endpoints added (#137)
Browse files Browse the repository at this point in the history
* New endpoints added

* lib version changed in baseClient
  • Loading branch information
MrRefactoring authored Jun 12, 2021
1 parent 8c1b61e commit 27ede89
Show file tree
Hide file tree
Showing 71 changed files with 1,730 additions and 806 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Jira.js changelog

### 2.3.1
### 2.4.0

- Some properties to some endpoints added :D
- [IssueCustomFieldConfigurationApps](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-configuration--apps-/#api-group-issue-custom-field-configuration--apps-) group added
- [#136](https://github.com/MrRefactoring/jira.js/pull/136) Fixed all URLs for Cloud Agile endpoint. Thanks [John Brunton](https://github.com/jbrunton)!
- Internal code styles improved

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ Available groups:
- [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-group-issues)
- [issueAttachments](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-group-issue-attachments)
- [issueComments](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-comments/#api-group-issue-comments)
- [issueCustomFieldConfigurationApps](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-custom-field-configuration--apps-/#api-group-issue-custom-field-configuration--apps-)
- [issueCommentProperties](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-comment-properties/#api-group-issue-comment-properties)
- [issueFields](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-fields/#api-group-issue-fields)
- [issueFieldConfigurations](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-field-configurations/#api-group-issue-field-configurations)
Expand Down Expand Up @@ -346,6 +347,7 @@ Available groups:
- [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-group-issues)
- [issueAttachments](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-group-issue-attachments)
- [issueComments](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-group-issue-comments)
- [issueCustomFieldConfigurationApps](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-configuration--apps-/#api-group-issue-custom-field-configuration--apps-)
- [issueCommentProperties](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comment-properties/#api-group-issue-comment-properties)
- [issueFields](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/#api-group-issue-fields)
- [issueFieldConfigurations](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-field-configurations/#api-group-issue-field-configurations)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jira.js",
"version": "2.3.0",
"version": "2.4.0",
"description": "jira.js is a powerful Node.JS/Browser module that allows you to interact with the Jira API very easily",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/clients/baseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export class BaseClient implements Client {
bodyExists: !!requestConfig.data,
callbackUsed: !!callback,
headersExists: !!requestConfig.headers,
libVersion: '2.3.0',
libVersionHash: 'ae14c21d807ec17e583ca3b6c2097de5',
libVersion: '2.4.0',
libVersionHash: '11e0eed8d3696c0a632f822df385ab3c',
methodName: telemetryData?.methodName || 'sendRequest',
onErrorMiddlewareUsed: !!this.config.middlewares?.onError,
onResponseMiddlewareUsed: !!this.config.middlewares?.onResponse,
Expand Down
2 changes: 2 additions & 0 deletions src/version2/client/version2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
IssueAttachments,
IssueCommentProperties,
IssueComments,
IssueCustomFieldConfigurationApps,
IssueCustomFieldContexts,
IssueCustomFieldOptions,
IssueCustomFieldOptionsApps,
Expand Down Expand Up @@ -96,6 +97,7 @@ export class Version2Client extends BaseClient {
issueAttachments = new IssueAttachments(this);
issueCommentProperties = new IssueCommentProperties(this);
issueComments = new IssueComments(this);
issueCustomFieldConfigurationApps = new IssueCustomFieldConfigurationApps(this);
issueCustomFieldContexts = new IssueCustomFieldContexts(this);
issueCustomFieldOptions = new IssueCustomFieldOptions(this);
issueCustomFieldOptionsApps = new IssueCustomFieldOptionsApps(this);
Expand Down
1 change: 1 addition & 0 deletions src/version2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from './instanceInformation';
export * from './issueAttachments';
export * from './issueCommentProperties';
export * from './issueComments';
export * from './issueCustomFieldConfigurationApps';
export * from './issueCustomFieldContexts';
export * from './issueCustomFieldOptions';
export * from './issueCustomFieldOptionsApps';
Expand Down
92 changes: 92 additions & 0 deletions src/version2/issueCustomFieldConfigurationApps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import * as Models from './models';
import * as Parameters from './parameters';
import { Client } from '../clients';
import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';

export class IssueCustomFieldConfigurationApps {
constructor(private client: Client) {}

/**
* Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#pagination) list of configurations for a custom field. The result can be filtered by
* `contextId` or `issueId`, otherwise all configurations are returned. Invalid IDs are ignored.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** *Administer Jira* [global
* permission](https://confluence.atlassian.com/x/x4dKLg). Jira permissions are not required for the app that created
* the custom field.
*/
async getCustomFieldConfiguration<T = Models.PageContextualConfiguration>(
parameters: Parameters.GetCustomFieldConfiguration,
callback: Callback<T>
): Promise<void>;
/**
* Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#pagination) list of configurations for a custom field. The result can be filtered by
* `contextId` or `issueId`, otherwise all configurations are returned. Invalid IDs are ignored.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** *Administer Jira* [global
* permission](https://confluence.atlassian.com/x/x4dKLg). Jira permissions are not required for the app that created
* the custom field.
*/
async getCustomFieldConfiguration<T = Models.PageContextualConfiguration>(
parameters: Parameters.GetCustomFieldConfiguration,
callback?: never
): Promise<T>;
async getCustomFieldConfiguration<T = Models.PageContextualConfiguration>(
parameters: Parameters.GetCustomFieldConfiguration,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/api/2/app/field/${parameters.fieldIdOrKey}/context/configuration`,
method: 'GET',
params: {
contextId: parameters.contextId,
issueId: parameters.issueId,
startAt: parameters.startAt,
maxResults: parameters.maxResults,
},
};

return this.client.sendRequest(config, callback, {
methodName: 'version2.issueCustomFieldConfigurationApps.getCustomFieldConfiguration',
});
}

/**
* Update the configuration for contexts of a custom field.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** *Administer Jira* [global
* permission](https://confluence.atlassian.com/x/x4dKLg). Jira permissions are not required for the app that created
* the custom field.
*/
async updateCustomFieldConfiguration<T = unknown>(
parameters: Parameters.UpdateCustomFieldConfiguration,
callback: Callback<T>
): Promise<void>;
/**
* Update the configuration for contexts of a custom field.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** *Administer Jira* [global
* permission](https://confluence.atlassian.com/x/x4dKLg). Jira permissions are not required for the app that created
* the custom field.
*/
async updateCustomFieldConfiguration<T = unknown>(
parameters: Parameters.UpdateCustomFieldConfiguration,
callback?: never
): Promise<T>;
async updateCustomFieldConfiguration<T = unknown>(
parameters: Parameters.UpdateCustomFieldConfiguration,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/api/2/app/field/${parameters.fieldIdOrKey}/context/configuration`,
method: 'PUT',
data: {
configurations: parameters.configurations,
},
};

return this.client.sendRequest(config, callback, {
methodName: 'version2.issueCustomFieldConfigurationApps.updateCustomFieldConfiguration',
});
}
}
42 changes: 42 additions & 0 deletions src/version2/issueTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,48 @@ export class IssueTypes {
return this.client.sendRequest(config, callback, { methodName: 'version2.issueTypes.createIssueType' });
}

/**
* Returns issue types for a project.
*
* This operation can be accessed anonymously.
*
* **[Permissions](#permissions) required:** *Browse projects* [project
* permission](https://confluence.atlassian.com/x/yodKLg) in the relevant project or *Administer Jira* [global
* permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async getIssueTypesForProject<T = Array<Models.IssueTypeDetails>>(
parameters: Parameters.GetIssueTypesForProject,
callback: Callback<T>
): Promise<void>;
/**
* Returns issue types for a project.
*
* This operation can be accessed anonymously.
*
* **[Permissions](#permissions) required:** *Browse projects* [project
* permission](https://confluence.atlassian.com/x/yodKLg) in the relevant project or *Administer Jira* [global
* permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async getIssueTypesForProject<T = Array<Models.IssueTypeDetails>>(
parameters: Parameters.GetIssueTypesForProject,
callback?: never
): Promise<T>;
async getIssueTypesForProject<T = Array<Models.IssueTypeDetails>>(
parameters: Parameters.GetIssueTypesForProject,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/issuetype/project',
method: 'GET',
params: {
projectId: parameters.projectId,
level: parameters.level,
},
};

return this.client.sendRequest(config, callback, { methodName: 'version2.issueTypes.getIssueTypesForProject' });
}

/**
* Returns an issue type.
*
Expand Down
7 changes: 7 additions & 0 deletions src/version2/models/contextualConfiguration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** Details of the contextual configuration for a custom field. */
export interface ContextualConfiguration {
/** The ID of the context the configuration is associated with. */
contextId: number;
/** The configuration associated with the context. */
configuration?: {};
}
87 changes: 87 additions & 0 deletions src/version2/models/createProjectDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/** Details about the project. */
export interface CreateProjectDetails {
/**
* Project keys must be unique and start with an uppercase letter followed by one or more uppercase alphanumeric
* characters. The maximum length is 10 characters.
*/
key: string;
/** The name of the project. */
name: string;
/** A brief description of the project. */
description?: string;
/**
* This parameter is deprecated because of privacy changes. Use `leadAccountId` instead. See the [migration
* guide](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/)
* for details. The user name of the project lead. Either `lead` or `leadAccountId` must be set when creating a
* project. Cannot be provided with `leadAccountId`.
*/
lead?: string;
/**
* The account ID of the project lead. Either `lead` or `leadAccountId` must be set when creating a project. Cannot
* be provided with `lead`.
*/
leadAccountId?: string;
/** A link to information about this project, such as project documentation */
url?: string;
/** The default assignee when creating issues for this project. */
assigneeType?: string;
/** An integer value for the project's avatar. */
avatarId?: number;
/**
* The ID of the issue security scheme for the project, which enables you to control who can and cannot view issues.
* Use the [Get issue security schemes](#api-rest-api-2-issuesecurityschemes-get) resource to get all issue security
* scheme IDs.
*/
issueSecurityScheme?: number;
/**
* The ID of the permission scheme for the project. Use the [Get all permission
* schemes](#api-rest-api-2-permissionscheme-get) resource to see a list of all permission scheme IDs.
*/
permissionScheme?: number;
/**
* The ID of the notification scheme for the project. Use the [Get notification
* schemes](#api-rest-api-2-notificationscheme-get) resource to get a list of notification scheme IDs.
*/
notificationScheme?: number;
/**
* The ID of the project's category. A complete list of category IDs is found using the [Get all project
* categories](#api-rest-api-2-projectCategory-get) operation.
*/
categoryId?: number;
/**
* The [project
* type](https://confluence.atlassian.com/x/GwiiLQ#Jiraapplicationsoverview-Productfeaturesandprojecttypes), which
* defines the application-specific feature set. If you don't specify the project template you have to specify the
* project type.
*/
projectTypeKey?: string;
/**
* A predefined configuration for a project. The type of the `projectTemplateKey` must match with the type of the
* `projectTypeKey`.
*/
projectTemplateKey?: string;
/**
* The ID of the workflow scheme for the project. Use the [Get all workflow
* schemes](#api-rest-api-2-workflowscheme-get) operation to get a list of workflow scheme IDs. If you specify the
* workflow scheme you cannot specify the project template key.
*/
workflowScheme?: number;
/**
* The ID of the issue type screen scheme for the project. Use the [Get all issue type screen
* schemes](#api-rest-api-2-issuetypescreenscheme-get) operation to get a list of issue type screen scheme IDs. If
* you specify the issue type screen scheme you cannot specify the project template key.
*/
issueTypeScreenScheme?: number;
/**
* The ID of the issue type scheme for the project. Use the [Get all issue type
* schemes](#api-rest-api-2-issuetypescheme-get) operation to get a list of issue type scheme IDs. If you specify
* the issue type scheme you cannot specify the project template key.
*/
issueTypeScheme?: number;
/**
* The ID of the field configuration scheme for the project. Use the [Get all field configuration
* schemes](#api-rest-api-2-fieldconfigurationscheme-get) operation to get a list of field configuration scheme IDs.
* If you specify the field configuration scheme you cannot specify the project template key.
*/
fieldConfigurationScheme?: number;
}
6 changes: 6 additions & 0 deletions src/version2/models/customFieldConfigurations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ContextualConfiguration } from './contextualConfiguration';

/** Details of configurations for a custom field. */
export interface CustomFieldConfigurations {
configurations: ContextualConfiguration[];
}
Loading

0 comments on commit 27ede89

Please sign in to comment.