-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathserviceDesk.ts
811 lines (766 loc) · 35.5 KB
/
serviceDesk.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
import { FormData, File } from 'formdata-node';
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
import { Client } from '../clients';
import { RequestConfig } from '../requestConfig';
export class ServiceDesk {
constructor(private client: Client) {}
/**
* This method returns all the service desks in the Jira Service Management instance that the user has permission to
* access. Use this method where you need a list of service desks or need to locate a service desk by name or
* keyword.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: Any
*/
async getServiceDesks<T = Models.PagedServiceDesk>(
parameters: Parameters.GetServiceDesks | undefined,
callback: Callback<T>,
): Promise<void>;
/**
* This method returns all the service desks in the Jira Service Management instance that the user has permission to
* access. Use this method where you need a list of service desks or need to locate a service desk by name or
* keyword.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: Any
*/
async getServiceDesks<T = Models.PagedServiceDesk>(
parameters?: Parameters.GetServiceDesks,
callback?: never,
): Promise<T>;
async getServiceDesks<T = Models.PagedServiceDesk>(
parameters?: Parameters.GetServiceDesks,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/servicedeskapi/servicedesk',
method: 'GET',
params: {
start: parameters?.start,
limit: parameters?.limit,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns a service desk. Use this method to get service desk details whenever your application component
* is passed a service desk ID but needs to display other service desk details.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the Service Desk. For example, being the Service Desk's Administrator or one of its Agents or
* Users.
*/
async getServiceDeskById<T = Models.ServiceDesk>(
parameters: Parameters.GetServiceDeskById,
callback: Callback<T>,
): Promise<void>;
/**
* This method returns a service desk. Use this method to get service desk details whenever your application component
* is passed a service desk ID but needs to display other service desk details.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the Service Desk. For example, being the Service Desk's Administrator or one of its Agents or
* Users.
*/
async getServiceDeskById<T = Models.ServiceDesk>(
parameters: Parameters.GetServiceDeskById,
callback?: never,
): Promise<T>;
async getServiceDeskById<T = Models.ServiceDesk>(
parameters: Parameters.GetServiceDeskById,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/**
* This method adds one or more temporary attachments to a service desk, which can then be permanently attached to a
* customer request using
* [servicedeskapi/request/{issueIdOrKey}/attachment](#api-request-issueIdOrKey-attachment-post).
*
* **Note**: It is possible for a service desk administrator to turn off the ability to add attachments to a service
* desk.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to add attachments in this Service Desk.
*/
async attachTemporaryFile<T = unknown>(
parameters: Parameters.AttachTemporaryFile,
callback: Callback<T>,
): Promise<void>;
/**
* This method adds one or more temporary attachments to a service desk, which can then be permanently attached to a
* customer request using
* [servicedeskapi/request/{issueIdOrKey}/attachment](#api-request-issueIdOrKey-attachment-post).
*
* **Note**: It is possible for a service desk administrator to turn off the ability to add attachments to a service
* desk.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to add attachments in this Service Desk.
*/
async attachTemporaryFile<T = unknown>(parameters: Parameters.AttachTemporaryFile, callback?: never): Promise<T>;
async attachTemporaryFile<T = unknown>(
parameters: Parameters.AttachTemporaryFile,
callback?: Callback<T>,
): Promise<void | T> {
const formData = new FormData();
const attachments = Array.isArray(parameters.attachment) ? parameters.attachment : [parameters.attachment];
const { default: mime } = await import('mime');
attachments.forEach(attachment => {
const mimeType = attachment.mimeType ?? (mime.getType(attachment.filename) || undefined);
const file = Buffer.isBuffer(attachment.file)
? new File([attachment.file], attachment.filename, { type: mimeType })
: attachment.file;
formData.append('file', file, attachment.filename);
});
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/attachTemporaryFile`,
method: 'POST',
headers: {
'X-Atlassian-Token': 'no-check',
'Content-Type': 'multipart/form-data',
},
data: formData,
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns a list of the customers on a service desk.
*
* The returned list of customers can be filtered using the `query` parameter. The parameter is matched against
* customers' `displayName`, `name`, or `email`. For example, searching for "John", "Jo", "Smi", or "Smith" will match
* a user with display name "John Smith".
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to view this Service Desk's customers.
*/
async getCustomers<T = Models.PagedUser>(parameters: Parameters.GetCustomers, callback: Callback<T>): Promise<void>;
/**
* This method returns a list of the customers on a service desk.
*
* The returned list of customers can be filtered using the `query` parameter. The parameter is matched against
* customers' `displayName`, `name`, or `email`. For example, searching for "John", "Jo", "Smi", or "Smith" will match
* a user with display name "John Smith".
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to view this Service Desk's customers.
*/
async getCustomers<T = Models.PagedUser>(parameters: Parameters.GetCustomers, callback?: never): Promise<T>;
async getCustomers<T = Models.PagedUser>(
parameters: Parameters.GetCustomers,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/customer`,
method: 'GET',
headers: {
'X-ExperimentalApi': 'opt-in',
},
params: {
query: parameters.query,
start: parameters.start,
limit: parameters.limit,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Adds one or more customers to a service desk. If any of the passed customers are associated with the service desk,
* no changes will be made for those customers and the resource returns a 204 success code.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk administrator
*/
async addCustomers<T = void>(parameters: Parameters.AddCustomers, callback: Callback<T>): Promise<void>;
/**
* Adds one or more customers to a service desk. If any of the passed customers are associated with the service desk,
* no changes will be made for those customers and the resource returns a 204 success code.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk administrator
*/
async addCustomers<T = void>(parameters: Parameters.AddCustomers, callback?: never): Promise<T>;
async addCustomers<T = void>(parameters: Parameters.AddCustomers, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/customer`,
method: 'POST',
data: {
usernames: parameters.usernames,
accountIds: parameters.accountIds,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method removes one or more customers from a service desk. The service desk must have closed access. If any of
* the passed customers are not associated with the service desk, no changes will be made for those customers and the
* resource returns a 204 success code.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Services desk administrator
*/
async removeCustomers<T = void>(parameters: Parameters.RemoveCustomers, callback: Callback<T>): Promise<void>;
/**
* This method removes one or more customers from a service desk. The service desk must have closed access. If any of
* the passed customers are not associated with the service desk, no changes will be made for those customers and the
* resource returns a 204 success code.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Services desk administrator
*/
async removeCustomers<T = void>(parameters: Parameters.RemoveCustomers, callback?: never): Promise<T>;
async removeCustomers<T = void>(parameters: Parameters.RemoveCustomers, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/customer`,
method: 'DELETE',
headers: {
'X-ExperimentalApi': 'opt-in',
},
data: {
usernames: parameters.usernames,
accountIds: parameters.accountIds,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Returns articles which match the given query and belong to the knowledge base linked to the service desk.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the service desk.
*/
async getArticles<T = Models.PagedArticle>(parameters: Parameters.GetArticles, callback: Callback<T>): Promise<void>;
/**
* Returns articles which match the given query and belong to the knowledge base linked to the service desk.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the service desk.
*/
async getArticles<T = Models.PagedArticle>(parameters: Parameters.GetArticles, callback?: never): Promise<T>;
async getArticles<T = Models.PagedArticle>(
parameters: Parameters.GetArticles,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/knowledgebase/article`,
method: 'GET',
headers: {
'X-ExperimentalApi': 'opt-in',
},
params: {
query: parameters.query,
highlight: parameters.highlight,
start: parameters.start,
limit: parameters.limit,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns the queues in a service desk. To include a customer request count for each queue (in the
* `issueCount` field) in the response, set the query parameter `includeCount` to true (its default is false).
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* service desk's Agent.
*/
async getQueues<T = Models.PagedQueue>(parameters: Parameters.GetQueues, callback: Callback<T>): Promise<void>;
/**
* This method returns the queues in a service desk. To include a customer request count for each queue (in the
* `issueCount` field) in the response, set the query parameter `includeCount` to true (its default is false).
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* service desk's Agent.
*/
async getQueues<T = Models.PagedQueue>(parameters: Parameters.GetQueues, callback?: never): Promise<T>;
async getQueues<T = Models.PagedQueue>(parameters: Parameters.GetQueues, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/queue`,
method: 'GET',
params: {
includeCount: parameters.includeCount,
start: parameters.start,
limit: parameters.limit,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns a specific queues in a service desk. To include a customer request count for the queue (in the
* `issueCount` field) in the response, set the query parameter `includeCount` to true (its default is false).
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* service desk's Agent.
*/
async getQueue<T = Models.Queue>(parameters: Parameters.GetQueue, callback: Callback<T>): Promise<void>;
/**
* This method returns a specific queues in a service desk. To include a customer request count for the queue (in the
* `issueCount` field) in the response, set the query parameter `includeCount` to true (its default is false).
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* service desk's Agent.
*/
async getQueue<T = Models.Queue>(parameters: Parameters.GetQueue, callback?: never): Promise<T>;
async getQueue<T = Models.Queue>(parameters: Parameters.GetQueue, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/queue/${parameters.queueId}`,
method: 'GET',
params: {
includeCount: parameters.includeCount,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns the customer requests in a queue. Only fields that the queue is configured to show are
* returned. For example, if a queue is configured to show description and due date, then only those two fields are
* returned for each customer request in the queue.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk's agent.
*/
async getIssuesInQueue<T = Models.PagedIssue>(
parameters: Parameters.GetIssuesInQueue,
callback: Callback<T>,
): Promise<void>;
/**
* This method returns the customer requests in a queue. Only fields that the queue is configured to show are
* returned. For example, if a queue is configured to show description and due date, then only those two fields are
* returned for each customer request in the queue.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk's agent.
*/
async getIssuesInQueue<T = Models.PagedIssue>(parameters: Parameters.GetIssuesInQueue, callback?: never): Promise<T>;
async getIssuesInQueue<T = Models.PagedIssue>(
parameters: Parameters.GetIssuesInQueue,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/queue/${parameters.queueId}/issue`,
method: 'GET',
params: {
start: parameters.start,
limit: parameters.limit,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns all customer request types from a service desk. There are two parameters for filtering the
* returned list:
*
* - `groupId` which filters the results to items in the customer request type group.
* - `searchQuery` which is matched against request types' `name` or `description`. For example, the strings "Install",
* "Inst", "Equi", or "Equipment" will match a request type with the _name_ "Equipment Installation Request".
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the service desk.
*/
async getRequestTypes<T = Models.PagedRequestType>(
parameters: Parameters.GetRequestTypes,
callback: Callback<T>,
): Promise<void>;
/**
* This method returns all customer request types from a service desk. There are two parameters for filtering the
* returned list:
*
* - `groupId` which filters the results to items in the customer request type group.
* - `searchQuery` which is matched against request types' `name` or `description`. For example, the strings "Install",
* "Inst", "Equi", or "Equipment" will match a request type with the _name_ "Equipment Installation Request".
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the service desk.
*/
async getRequestTypes<T = Models.PagedRequestType>(
parameters: Parameters.GetRequestTypes,
callback?: never,
): Promise<T>;
async getRequestTypes<T = Models.PagedRequestType>(
parameters: Parameters.GetRequestTypes,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype`,
method: 'GET',
params: {
groupId: parameters.groupId,
expand: parameters.expand,
searchQuery: parameters.searchQuery,
start: parameters.start,
limit: parameters.limit,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method enables a customer request type to be added to a service desk based on an issue type. Note that not all
* customer request type fields can be specified in the request and these fields are given the following default
* values:
*
* - Request type icon is given the headset icon.
* - Request type groups is left empty, which means this customer request type will not be visible on the [customer
* portal](https://confluence.atlassian.com/servicedeskcloud/configuring-the-customer-portal-732528918.html).
* - Request type status mapping is left empty, so the request type has no custom status mapping but inherits the status
* map from the issue type upon which it is based.
* - Request type field mapping is set to show the required fields as specified by the issue type used to create the
* customer request type.
*
* These fields can be updated by a service desk administrator using the **Request types** option in **Project
* settings**.\
* Request Types are created in next-gen projects by creating Issue Types. Please use the Jira Cloud Platform Create
* issue type endpoint instead.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk's administrator
*/
async createRequestType<T = Models.RequestType>(
parameters: Parameters.CreateRequestType,
callback: Callback<T>,
): Promise<void>;
/**
* This method enables a customer request type to be added to a service desk based on an issue type. Note that not all
* customer request type fields can be specified in the request and these fields are given the following default
* values:
*
* - Request type icon is given the headset icon.
* - Request type groups is left empty, which means this customer request type will not be visible on the [customer
* portal](https://confluence.atlassian.com/servicedeskcloud/configuring-the-customer-portal-732528918.html).
* - Request type status mapping is left empty, so the request type has no custom status mapping but inherits the status
* map from the issue type upon which it is based.
* - Request type field mapping is set to show the required fields as specified by the issue type used to create the
* customer request type.
*
* These fields can be updated by a service desk administrator using the **Request types** option in **Project
* settings**.\
* Request Types are created in next-gen projects by creating Issue Types. Please use the Jira Cloud Platform Create
* issue type endpoint instead.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk's administrator
*/
async createRequestType<T = Models.RequestType>(
parameters: Parameters.CreateRequestType,
callback?: never,
): Promise<T>;
async createRequestType<T = Models.RequestType>(
parameters: Parameters.CreateRequestType,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype`,
method: 'POST',
headers: {
'X-ExperimentalApi': 'opt-in',
},
data: {
issueTypeId: parameters.issueTypeId,
name: parameters.name,
description: parameters.description,
helpText: parameters.helpText,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns a customer request type from a service desk.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the service desk.
*/
async getRequestTypeById<T = Models.RequestType>(
parameters: Parameters.GetRequestTypeById,
callback: Callback<T>,
): Promise<void>;
/**
* This method returns a customer request type from a service desk.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to access the service desk.
*/
async getRequestTypeById<T = Models.RequestType>(
parameters: Parameters.GetRequestTypeById,
callback?: never,
): Promise<T>;
async getRequestTypeById<T = Models.RequestType>(
parameters: Parameters.GetRequestTypeById,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype/${parameters.requestTypeId}`,
method: 'GET',
params: {
expand: parameters.expand,
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method deletes a customer request type from a service desk, and removes it from all customer requests.\
* This only supports classic projects.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk administrator.
*/
async deleteRequestType<T = void>(parameters: Parameters.DeleteRequestType, callback: Callback<T>): Promise<void>;
/**
* This method deletes a customer request type from a service desk, and removes it from all customer requests.\
* This only supports classic projects.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Service desk administrator.
*/
async deleteRequestType<T = void>(parameters: Parameters.DeleteRequestType, callback?: never): Promise<T>;
async deleteRequestType<T = void>(
parameters: Parameters.DeleteRequestType,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype/${parameters.requestTypeId}`,
method: 'DELETE',
headers: {
'X-ExperimentalApi': 'opt-in',
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns the fields for a service desk's customer request type.
*
* Also, the following information about the user's permissions for the request type is returned:
*
* - `canRaiseOnBehalfOf` returns `true` if the user has permission to raise customer requests on behalf of other
* customers. Otherwise, returns `false`.
* - `canAddRequestParticipants` returns `true` if the user can add customer request participants. Otherwise, returns
* `false`.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to view the Service Desk. However, hidden fields would be visible to only Service desk's Administrator.
*/
async getRequestTypeFields<T = Models.CustomerRequestCreateMeta>(
parameters: Parameters.GetRequestTypeFields,
callback: Callback<T>,
): Promise<void>;
/**
* This method returns the fields for a service desk's customer request type.
*
* Also, the following information about the user's permissions for the request type is returned:
*
* - `canRaiseOnBehalfOf` returns `true` if the user has permission to raise customer requests on behalf of other
* customers. Otherwise, returns `false`.
* - `canAddRequestParticipants` returns `true` if the user can add customer request participants. Otherwise, returns
* `false`.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to view the Service Desk. However, hidden fields would be visible to only Service desk's Administrator.
*/
async getRequestTypeFields<T = Models.CustomerRequestCreateMeta>(
parameters: Parameters.GetRequestTypeFields,
callback?: never,
): Promise<T>;
async getRequestTypeFields<T = Models.CustomerRequestCreateMeta>(
parameters: Parameters.GetRequestTypeFields,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype/${parameters.requestTypeId}/field`,
method: 'GET',
params: {
expand: parameters.expand,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Returns the keys of all properties for a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore the keys of all
* properties for a request type are also available by calling the Jira Cloud Platform [Get issue type property
* keys](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-get)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: The
* user must have permission to view the request type.
*/
async getPropertiesKeys<T = Models.PropertyKeys>(
parameters: Parameters.GetPropertiesKeys,
callback: Callback<T>,
): Promise<void>;
/**
* Returns the keys of all properties for a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore the keys of all
* properties for a request type are also available by calling the Jira Cloud Platform [Get issue type property
* keys](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-get)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: The
* user must have permission to view the request type.
*/
async getPropertiesKeys<T = Models.PropertyKeys>(
parameters: Parameters.GetPropertiesKeys,
callback?: never,
): Promise<T>;
async getPropertiesKeys<T = Models.PropertyKeys>(
parameters: Parameters.GetPropertiesKeys,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype/${parameters.requestTypeId}/property`,
method: 'GET',
headers: {
'X-ExperimentalApi': 'opt-in',
},
};
return this.client.sendRequest(config, callback);
}
/**
* Returns the value of the property from a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore also available by
* calling the Jira Cloud Platform [Get issue type
* property](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-propertyKey-get)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: User
* must have permission to view the request type.
*/
async getProperty<T = Models.EntityProperty>(
parameters: Parameters.GetProperty,
callback: Callback<T>,
): Promise<void>;
/**
* Returns the value of the property from a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore also available by
* calling the Jira Cloud Platform [Get issue type
* property](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-propertyKey-get)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: User
* must have permission to view the request type.
*/
async getProperty<T = Models.EntityProperty>(parameters: Parameters.GetProperty, callback?: never): Promise<T>;
async getProperty<T = Models.EntityProperty>(
parameters: Parameters.GetProperty,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype/${parameters.requestTypeId}/property/${parameters.propertyKey}`,
method: 'GET',
headers: {
'X-ExperimentalApi': 'opt-in',
},
};
return this.client.sendRequest(config, callback);
}
/**
* Sets the value of a request type property. Use this resource to store custom data against a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore can also be set by
* calling the Jira Cloud Platform [Set issue type
* property](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-propertyKey-put)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: Jira
* project administrator with a Jira Service Management agent license.
*/
async setProperty<T = unknown>(parameters: Parameters.SetProperty, callback: Callback<T>): Promise<void>;
/**
* Sets the value of a request type property. Use this resource to store custom data against a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore can also be set by
* calling the Jira Cloud Platform [Set issue type
* property](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-propertyKey-put)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: Jira
* project administrator with a Jira Service Management agent license.
*/
async setProperty<T = unknown>(parameters: Parameters.SetProperty, callback?: never): Promise<T>;
async setProperty<T = unknown>(parameters: Parameters.SetProperty, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype/${parameters.requestTypeId}/property/${parameters.propertyKey}`,
method: 'PUT',
headers: {
'X-ExperimentalApi': 'opt-in',
},
};
return this.client.sendRequest(config, callback);
}
/**
* Removes a property from a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore can also be deleted by
* calling the Jira Cloud Platform [Delete issue type
* property](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-propertyKey-delete)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: Jira
* project administrator with a Jira Service Management agent license.
*/
async deleteProperty<T = void>(parameters: Parameters.DeleteProperty, callback: Callback<T>): Promise<void>;
/**
* Removes a property from a request type.
*
* Properties for a Request Type in next-gen are stored as Issue Type properties and therefore can also be deleted by
* calling the Jira Cloud Platform [Delete issue type
* property](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issuetype-issueTypeId-properties-propertyKey-delete)
* endpoint.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**: Jira
* project administrator with a Jira Service Management agent license.
*/
async deleteProperty<T = void>(parameters: Parameters.DeleteProperty, callback?: never): Promise<T>;
async deleteProperty<T = void>(parameters: Parameters.DeleteProperty, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttype/${parameters.requestTypeId}/property/${parameters.propertyKey}`,
method: 'DELETE',
headers: {
'X-ExperimentalApi': 'opt-in',
},
};
return this.client.sendRequest(config, callback);
}
/**
* This method returns a service desk's customer request type groups. Jira Service Management administrators can
* arrange the customer request type groups in an arbitrary order for display on the customer portal; the groups are
* returned in this order.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to view the service desk.
*/
async getRequestTypeGroups<T = Models.PagedRequestTypeGroup>(
parameters: Parameters.GetRequestTypeGroups,
callback: Callback<T>,
): Promise<void>;
/**
* This method returns a service desk's customer request type groups. Jira Service Management administrators can
* arrange the customer request type groups in an arbitrary order for display on the customer portal; the groups are
* returned in this order.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#permissions) required**:
* Permission to view the service desk.
*/
async getRequestTypeGroups<T = Models.PagedRequestTypeGroup>(
parameters: Parameters.GetRequestTypeGroups,
callback?: never,
): Promise<T>;
async getRequestTypeGroups<T = Models.PagedRequestTypeGroup>(
parameters: Parameters.GetRequestTypeGroups,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/servicedeskapi/servicedesk/${parameters.serviceDeskId}/requesttypegroup`,
method: 'GET',
params: {
start: parameters.start,
limit: parameters.limit,
},
};
return this.client.sendRequest(config, callback);
}
}