forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkflowSchemeProjectAssociations.ts
91 lines (86 loc) · 3.94 KB
/
workflowSchemeProjectAssociations.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
import { Client } from '../clients';
import { RequestConfig } from '../requestConfig';
export class WorkflowSchemeProjectAssociations {
constructor(private client: Client) {}
/**
* Returns a list of the workflow schemes associated with a list of projects. Each returned workflow scheme includes a
* list of the requested projects associated with it. Any team-managed or non-existent projects in the request are
* ignored and no errors are returned.
*
* If the project is associated with the `Default Workflow Scheme` no ID is returned. This is because the way the
* `Default Workflow Scheme` is stored means it has no ID.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async getWorkflowSchemeProjectAssociations<T = Models.ContainerOfWorkflowSchemeAssociations>(
parameters: Parameters.GetWorkflowSchemeProjectAssociations,
callback: Callback<T>,
): Promise<void>;
/**
* Returns a list of the workflow schemes associated with a list of projects. Each returned workflow scheme includes a
* list of the requested projects associated with it. Any team-managed or non-existent projects in the request are
* ignored and no errors are returned.
*
* If the project is associated with the `Default Workflow Scheme` no ID is returned. This is because the way the
* `Default Workflow Scheme` is stored means it has no ID.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async getWorkflowSchemeProjectAssociations<T = Models.ContainerOfWorkflowSchemeAssociations>(
parameters: Parameters.GetWorkflowSchemeProjectAssociations,
callback?: never,
): Promise<T>;
async getWorkflowSchemeProjectAssociations<T = Models.ContainerOfWorkflowSchemeAssociations>(
parameters: Parameters.GetWorkflowSchemeProjectAssociations,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/workflowscheme/project',
method: 'GET',
params: {
projectId: parameters.projectId,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Assigns a workflow scheme to a project. This operation is performed only when there are no issues in the project.
*
* Workflow schemes can only be assigned to classic projects.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignSchemeToProject<T = void>(
parameters: Parameters.AssignSchemeToProject | undefined,
callback: Callback<T>,
): Promise<void>;
/**
* Assigns a workflow scheme to a project. This operation is performed only when there are no issues in the project.
*
* Workflow schemes can only be assigned to classic projects.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignSchemeToProject<T = void>(parameters?: Parameters.AssignSchemeToProject, callback?: never): Promise<T>;
async assignSchemeToProject<T = void>(
parameters?: Parameters.AssignSchemeToProject,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/workflowscheme/project',
method: 'PUT',
data: {
workflowSchemeId: parameters?.workflowSchemeId,
projectId: parameters?.projectId,
},
};
return this.client.sendRequest(config, callback);
}
}