forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectTypes.ts
119 lines (108 loc) · 4.59 KB
/
projectTypes.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
import { Client } from '../clients';
import { RequestConfig } from '../requestConfig';
export class ProjectTypes {
constructor(private client: Client) {}
/**
* Returns all [project types](https://confluence.atlassian.com/x/Var1Nw), whether or not the instance has a valid
* license for each type.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None.
*/
async getAllProjectTypes<T = Models.ProjectType[]>(callback: Callback<T>): Promise<void>;
/**
* Returns all [project types](https://confluence.atlassian.com/x/Var1Nw), whether or not the instance has a valid
* license for each type.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None.
*/
async getAllProjectTypes<T = Models.ProjectType[]>(callback?: never): Promise<T>;
async getAllProjectTypes<T = Models.ProjectType[]>(callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/3/project/type',
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/** Returns all [project types](https://confluence.atlassian.com/x/Var1Nw) with a valid license. */
async getAllAccessibleProjectTypes<T = Models.ProjectType[]>(callback: Callback<T>): Promise<void>;
/** Returns all [project types](https://confluence.atlassian.com/x/Var1Nw) with a valid license. */
async getAllAccessibleProjectTypes<T = Models.ProjectType[]>(callback?: never): Promise<T>;
async getAllAccessibleProjectTypes<T = Models.ProjectType[]>(callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/3/project/type/accessible',
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/**
* Returns a [project type](https://confluence.atlassian.com/x/Var1Nw).
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None.
*/
async getProjectTypeByKey<T = Models.ProjectType>(
parameters: Parameters.GetProjectTypeByKey | string,
callback: Callback<T>,
): Promise<void>;
/**
* Returns a [project type](https://confluence.atlassian.com/x/Var1Nw).
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** None.
*/
async getProjectTypeByKey<T = Models.ProjectType>(
parameters: Parameters.GetProjectTypeByKey | string,
callback?: never,
): Promise<T>;
async getProjectTypeByKey<T = Models.ProjectType>(
parameters: Parameters.GetProjectTypeByKey | string,
callback?: Callback<T>,
): Promise<void | T> {
const projectTypeKey = typeof parameters === 'string' ? parameters : parameters.projectTypeKey;
const config: RequestConfig = {
url: `/rest/api/3/project/type/${projectTypeKey}`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/**
* Returns a [project type](https://confluence.atlassian.com/x/Var1Nw) if it is accessible to the user.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
* Permission to access Jira.
*/
async getAccessibleProjectTypeByKey<T = Models.ProjectType>(
parameters: Parameters.GetAccessibleProjectTypeByKey | string,
callback: Callback<T>,
): Promise<void>;
/**
* Returns a [project type](https://confluence.atlassian.com/x/Var1Nw) if it is accessible to the user.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
* Permission to access Jira.
*/
async getAccessibleProjectTypeByKey<T = Models.ProjectType>(
parameters: Parameters.GetAccessibleProjectTypeByKey | string,
callback?: never,
): Promise<T>;
async getAccessibleProjectTypeByKey<T = Models.ProjectType>(
parameters: Parameters.GetAccessibleProjectTypeByKey | string,
callback?: Callback<T>,
): Promise<void | T> {
const projectTypeKey = typeof parameters === 'string' ? parameters : parameters.projectTypeKey;
const config: RequestConfig = {
url: `/rest/api/3/project/type/${projectTypeKey}/accessible`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
}