forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappProperties.ts
223 lines (209 loc) · 9.22 KB
/
appProperties.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
import { Client } from '../clients';
import { RequestConfig } from '../requestConfig';
export class AppProperties {
constructor(private client: Client) {}
/**
* Gets all the properties of an app.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the
* Marketplace can access properties of Connect apps they were [migrated
* from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/).
*/
async getAddonProperties<T = Models.PropertyKeys>(
parameters: Parameters.GetAddonProperties | string,
callback: Callback<T>,
): Promise<void>;
/**
* Gets all the properties of an app.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the
* Marketplace can access properties of Connect apps they were [migrated
* from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/).
*/
async getAddonProperties<T = Models.PropertyKeys>(
parameters: Parameters.GetAddonProperties | string,
callback?: never,
): Promise<T>;
async getAddonProperties<T = Models.PropertyKeys>(
parameters: Parameters.GetAddonProperties | string,
callback?: Callback<T>,
): Promise<void | T> {
const addonKey = typeof parameters === 'string' ? parameters : parameters.addonKey;
const config: RequestConfig = {
url: `/rest/atlassian-connect/1/addons/${addonKey}/properties`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/**
* Returns the key and value of an app's property.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the
* Marketplace can access properties of Connect apps they were [migrated
* from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/).
*/
async getAddonProperty<T = Models.EntityProperty>(
parameters: Parameters.GetAddonProperty,
callback: Callback<T>,
): Promise<void>;
/**
* Returns the key and value of an app's property.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request. Additionally, Forge apps published on the
* Marketplace can access properties of Connect apps they were [migrated
* from](https://developer.atlassian.com/platform/forge/build-a-connect-on-forge-app/).
*/
async getAddonProperty<T = Models.EntityProperty>(
parameters: Parameters.GetAddonProperty,
callback?: never,
): Promise<T>;
async getAddonProperty<T = Models.EntityProperty>(
parameters: Parameters.GetAddonProperty,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/atlassian-connect/1/addons/${parameters.addonKey}/properties/${parameters.propertyKey}`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/**
* Sets the value of an app's property. Use this resource to store custom data for your app.
*
* The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The
* maximum length is 32768 characters.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request.
*/
async putAddonProperty<T = Models.OperationMessage>(
parameters: Parameters.PutAddonProperty,
callback: Callback<T>,
): Promise<void>;
/**
* Sets the value of an app's property. Use this resource to store custom data for your app.
*
* The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The
* maximum length is 32768 characters.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request.
*/
async putAddonProperty<T = Models.OperationMessage>(
parameters: Parameters.PutAddonProperty,
callback?: never,
): Promise<T>;
async putAddonProperty<T = Models.OperationMessage>(
parameters: Parameters.PutAddonProperty,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/atlassian-connect/1/addons/${parameters.addonKey}/properties/${parameters.propertyKey}`,
method: 'PUT',
data: parameters.propertyValue,
};
return this.client.sendRequest(config, callback);
}
/**
* Deletes an app's property.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request.
*/
async deleteAddonProperty<T = void>(parameters: Parameters.DeleteAddonProperty, callback: Callback<T>): Promise<void>;
/**
* Deletes an app's property.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only a
* Connect app whose key matches `addonKey` can make this request.
*/
async deleteAddonProperty<T = void>(parameters: Parameters.DeleteAddonProperty, callback?: never): Promise<T>;
async deleteAddonProperty<T = void>(
parameters: Parameters.DeleteAddonProperty,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/atlassian-connect/1/addons/${parameters.addonKey}/properties/${parameters.propertyKey}`,
method: 'DELETE',
};
return this.client.sendRequest(config, callback);
}
/**
* Sets the value of a Forge app's property. These values can be retrieved in [Jira
* expressions](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/) through the `app` [context
* variable](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/#context-variables).
*
* For other use cases, use the [Storage
* API](https://developer.atlassian.com/platform/forge/runtime-reference/storage-api/).
*
* The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The
* maximum length is 32768 characters.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only
* Forge apps can make this request.
*/
async putAppProperty<T = Models.OperationMessage>(
parameters: Parameters.PutAppProperty,
callback: Callback<T>,
): Promise<void>;
/**
* Sets the value of a Forge app's property. These values can be retrieved in [Jira
* expressions](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/) through the `app` [context
* variable](https://developer.atlassian.com/cloud/jira/platform/jira-expressions/#context-variables).
*
* For other use cases, use the [Storage
* API](https://developer.atlassian.com/platform/forge/runtime-reference/storage-api/).
*
* The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The
* maximum length is 32768 characters.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only
* Forge apps can make this request.
*/
async putAppProperty<T = Models.OperationMessage>(
parameters: Parameters.PutAppProperty,
callback?: never,
): Promise<T>;
async putAppProperty<T = Models.OperationMessage>(
parameters: Parameters.PutAppProperty,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/forge/1/app/properties/${parameters.propertyKey}`,
method: 'PUT',
data: parameters.propertyValue,
};
return this.client.sendRequest(config, callback);
}
/**
* Deletes a Forge app's property.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only
* Forge apps can make this request.
*/
async deleteAppProperty<T = void>(parameters: Parameters.DeleteAppProperty, callback: Callback<T>): Promise<void>;
/**
* Deletes a Forge app's property.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** Only
* Forge apps can make this request.
*/
async deleteAppProperty<T = void>(parameters: Parameters.DeleteAppProperty, callback?: never): Promise<T>;
async deleteAppProperty<T = void>(
parameters: Parameters.DeleteAppProperty,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/forge/1/app/properties/${parameters.propertyKey}`,
method: 'DELETE',
};
return this.client.sendRequest(config, callback);
}
}