@ezpaarse-project/ezreeport-sdk-js 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +774 -0
  3. package/dist/browser/ezreeport-sdk-js.mjs +2263 -0
  4. package/dist/browser/ezreeport-sdk-js.mjs.map +1 -0
  5. package/dist/browser/ezreeport-sdk-js.umd.js +4 -0
  6. package/dist/browser/ezreeport-sdk-js.umd.js.map +1 -0
  7. package/dist/node/package.json +56 -0
  8. package/dist/types/index.d.ts +24 -0
  9. package/dist/types/lib/axios.d.ts +51 -0
  10. package/dist/types/lib/promises.d.ts +18 -0
  11. package/dist/types/lib/utils.d.ts +22 -0
  12. package/dist/types/modules/auth.d.ts +90 -0
  13. package/dist/types/modules/auth.public.d.ts +1 -0
  14. package/dist/types/modules/crons.d.ts +78 -0
  15. package/dist/types/modules/crons.public.d.ts +1 -0
  16. package/dist/types/modules/health.d.ts +53 -0
  17. package/dist/types/modules/health.public.d.ts +1 -0
  18. package/dist/types/modules/history.d.ts +38 -0
  19. package/dist/types/modules/history.public.d.ts +1 -0
  20. package/dist/types/modules/institutions.d.ts +56 -0
  21. package/dist/types/modules/namespaces.d.ts +19 -0
  22. package/dist/types/modules/namespaces.public.d.ts +1 -0
  23. package/dist/types/modules/queues.d.ts +93 -0
  24. package/dist/types/modules/queues.public.d.ts +1 -0
  25. package/dist/types/modules/reports.d.ts +194 -0
  26. package/dist/types/modules/reports.public.d.ts +1 -0
  27. package/dist/types/modules/setup.d.ts +17 -0
  28. package/dist/types/modules/setup.public.d.ts +2 -0
  29. package/dist/types/modules/tasks.base.d.ts +48 -0
  30. package/dist/types/modules/tasks.d.ts +124 -0
  31. package/dist/types/modules/tasks.public.d.ts +2 -0
  32. package/dist/types/modules/templates.d.ts +120 -0
  33. package/dist/types/modules/templates.public.d.ts +1 -0
  34. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,774 @@
1
+ # ezREEPORT-sdk-js
2
+
3
+ > SDK used to interact with ezREEPORT API
4
+
5
+ ## Features
6
+
7
+ - ✅ User requests
8
+ - ✅ Follow generation of report
9
+ - ✅ Automatic parsing (dates, enums, etc.)
10
+ - ❌ Admin requests (the ones that need API key)
11
+
12
+ ---
13
+ ---
14
+
15
+ ## Modules
16
+
17
+ - [auth](#auth)
18
+ - [setup](#setup)
19
+ - [health](#health)
20
+ - [tasks](#tasks)
21
+ - [reports](#reports)
22
+ - [templates](#templates)
23
+ - [history](#history)
24
+ - [crons](#crons)
25
+ - [queues](#queues)
26
+ - [namespaces](#namespaces)
27
+
28
+ All responses use the `ApiResponse` or `PaginatedApiResponse` types which refer to this :
29
+
30
+ ```ts
31
+ interface ApiResponse<T> {
32
+ /**
33
+ * HTTP Status
34
+ */
35
+ status: {
36
+ code: number,
37
+ message: string,
38
+ },
39
+ /**
40
+ * Content of the response
41
+ */
42
+ content: T
43
+ }
44
+
45
+ interface PaginatedApiResponse<T> extends ApiResponse<T> {
46
+ meta: {
47
+ /**
48
+ * Count of items in response
49
+ */
50
+ count: number,
51
+ /**
52
+ * Count of items wanted
53
+ */
54
+ size: number,
55
+ /**
56
+ * Count of items available
57
+ */
58
+ total: number,
59
+ /**
60
+ * Id of last item in response
61
+ */
62
+ lastId?: unknown
63
+ }
64
+ }
65
+
66
+ ```
67
+
68
+ ---
69
+
70
+ ### auth
71
+
72
+ Methods used to interact with current user
73
+
74
+ #### login
75
+
76
+ ```ts
77
+ login(token: string): void
78
+ ```
79
+
80
+ Set the given token into axios
81
+
82
+ #### logout
83
+
84
+ ```ts
85
+ logout(): void
86
+ ```
87
+
88
+ Unset any token from axios
89
+
90
+ #### isLogged
91
+
92
+ ```ts
93
+ isLogged(): boolean
94
+ ```
95
+
96
+ Check if any token is in axios. **DOESN'T CHECK IF TOKEN IS VALID !**
97
+
98
+ #### getCurrentUser
99
+
100
+ ```ts
101
+ getCurrentUser(): Promise<ApiResponse<auth.User>>
102
+ ```
103
+
104
+ Get info about logged user
105
+
106
+ #### getCurrentPermissions
107
+
108
+ ```ts
109
+ getCurrentPermissions(): Promise<ApiResponse<auth.Permissions>>
110
+ ```
111
+
112
+ Get permissions of logged user.
113
+
114
+ There a 2 types of permissions :
115
+
116
+ - Namespaced: Those ones depends from a namespace to another. If a namespace is not in the list, then the current user doesn't have access to this namespace.
117
+ - General: Those ones are global to ezREEPORT and doesn't depends on namespace.
118
+
119
+ #### getCurrentNamespaces
120
+
121
+ ```ts
122
+ getCurrentNamespaces(): Promise<ApiResponse<namespaces.Namespace[]>>
123
+ ```
124
+
125
+ Get accessible namespaces by logged user. It should returns the same namespaces as [auth::getCurrentPermissions](#getcurrentpermissions) but with more info about namespaces.
126
+
127
+ ---
128
+
129
+ ### crons
130
+
131
+ Methods used to manage crons, it should be only available to admins of ezREEPORT.
132
+
133
+ #### getAllCrons
134
+
135
+ ```ts
136
+ getAllCrons(): Promise<ApiResponse<crons.Cron[]>>
137
+ ```
138
+
139
+ Get all available crons and their statuses.
140
+
141
+ Needs `general.crons-get` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
142
+
143
+ #### getCron
144
+
145
+ ```ts
146
+ getCron(name: string): Promise<ApiResponse<crons.Cron>>
147
+ ```
148
+
149
+ Get more info about specific cron
150
+
151
+ Needs `general.crons-get-cron` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
152
+
153
+ __Params__:
154
+
155
+ - `name`: The name of the cron
156
+
157
+ #### startCron
158
+
159
+ ```ts
160
+ startCron(name: string): Promise<ApiResponse<crons.Cron>>
161
+ ```
162
+
163
+ Start cron
164
+
165
+ Needs `general.crons-put-cron-start` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
166
+
167
+ __Params__:
168
+
169
+ - `name`: The name of the cron
170
+
171
+ #### stopCron
172
+
173
+ ```ts
174
+ stopCron(name: string): Promise<ApiResponse<crons.Cron>>
175
+ ```
176
+
177
+ Stop cron
178
+
179
+ Needs `general.crons-put-cron-stop` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
180
+
181
+ __Params__:
182
+
183
+ - `name`: The name of the cron
184
+
185
+ #### forceCron
186
+
187
+ ```ts
188
+ forceCron(name: string): Promise<ApiResponse<crons.Cron>>
189
+ ```
190
+
191
+ Force run of a cron
192
+
193
+ Needs `general.crons-post-cron-force` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
194
+
195
+ __Params__:
196
+
197
+ - `name`: The name of the cron
198
+
199
+ ---
200
+
201
+ ### health
202
+
203
+ Methods used to monitor health of ezREEPORT.
204
+
205
+ #### getAllConnectedServices
206
+
207
+ ```ts
208
+ type R = {
209
+ current: string;
210
+ currentVersion: string;
211
+ services: health.PingResult['name'][];
212
+ };
213
+
214
+ getAllConnectedServices(): Promise<ApiResponse<R>>
215
+ ```
216
+
217
+ Get all services connected to current service.
218
+
219
+ #### checkAllConnectedService
220
+
221
+ ```ts
222
+ checkAllConnectedService(service: string): Promise<ApiResponse<health.PingResult>>
223
+ ```
224
+
225
+ Check connection for all connected service from current service
226
+
227
+ __Params__:
228
+
229
+ - `service`: The name of the service
230
+
231
+ #### checkConnectedService
232
+
233
+ ```ts
234
+ checkConnectedService(service: string): Promise<ApiResponse<health.PingResult>>
235
+ ```
236
+
237
+ Check connection of a specific service from current service
238
+
239
+ __Params__:
240
+
241
+ - `service`: The name of the service
242
+
243
+ #### checkCurrentService
244
+
245
+ ```ts
246
+ checkCurrentService(): Promise<ApiResponse<health.PingResult>>
247
+ ```
248
+
249
+ Check connection of current service
250
+
251
+ It's useful when the app will have limited connection, or if you just want the processing time.
252
+
253
+ ---
254
+
255
+ ### namespaces
256
+
257
+ Only used for types.
258
+
259
+ ---
260
+
261
+ ### queues
262
+
263
+ Methods used to manage queues
264
+
265
+ #### getAllQueues
266
+
267
+ ```ts
268
+ getAllQueues(): Promise<ApiResponse<queues.Queue[]>>
269
+ ```
270
+
271
+ Get all available queues
272
+
273
+ Needs `general.queues-get` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
274
+
275
+ #### pauseQueue
276
+
277
+ ```ts
278
+ pauseQueue(name: string): Promise<ApiResponse<queues.Queue>>
279
+ ```
280
+
281
+ Pause specific queue
282
+
283
+ Needs `general.queues-put-queue-pause` permission(see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
284
+
285
+ __Params__:
286
+
287
+ - `name`: Name of the queue
288
+
289
+ #### resumeQueue
290
+
291
+ ```ts
292
+ resumeQueue(name: string): Promise<ApiResponse<queues.Queue>>
293
+ ```
294
+
295
+
296
+ Restart specific queue
297
+
298
+ Needs `general.queues-put-queue-resume` permission(see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
299
+
300
+ __Params__:
301
+
302
+ - `name`: Name of the queue
303
+
304
+ #### getQueueJobs
305
+
306
+ ```ts
307
+ getQueueJobs<Data, Result>(name: string): Promise<PaginatedApiResponse<queues.FullJob<Data, Result>[]>>
308
+ ```
309
+
310
+ Get specific queue info
311
+
312
+ Needs `general.queues-get-queue-jobs` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
313
+
314
+ __Type Params__:
315
+
316
+ - `Data`: Data passed to the job (accessible with the `data` property)
317
+ - `Result`: Result returned by the job (accessible with the `result` property)
318
+
319
+ __Params__:
320
+
321
+ - `name`: Name of the queue
322
+
323
+ #### getJob
324
+
325
+ ```ts
326
+ getJob<Data, Result>(name: string, jobId: string | number, namespaces?: string[]): Promise<ApiResponse<FullJob<Data, Result>>>
327
+ ```
328
+
329
+ Get specific job info
330
+
331
+ Needs `namespaces[namespaceId].queues-get-queue-jobs-jobId` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
332
+
333
+ __Type Params__:
334
+
335
+ - `Data`: Data passed to the job (accessible with the `data` property)
336
+ - `Result`: Result returned by the job (accessible with the `result` property)
337
+
338
+ __Params__:
339
+
340
+ - `name`: Name of the queue
341
+ - `jobId`: Id of the job
342
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
343
+
344
+ #### retryJob
345
+
346
+ ```ts
347
+ retryJob(): void
348
+ ```
349
+
350
+ Retry job that failed
351
+
352
+ Needs `namespaces[namespaceId].queues-post-queue-jobs-jobId-retry` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
353
+
354
+
355
+ __Type Params__:
356
+
357
+ - `Data`: Data passed to the job (accessible with the `data` property)
358
+ - `Result`: Result returned by the job (accessible with the `result` property)
359
+
360
+ __Params__:
361
+
362
+ - `name`: Name of the queue
363
+ - `jobId`: Id of the job
364
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
365
+
366
+ ---
367
+
368
+ ### reports
369
+
370
+ Methods to start generation of reports and to get results
371
+
372
+ #### startGeneration
373
+
374
+ ```ts
375
+ type P = {
376
+ /**
377
+ * Override targets of task. Also enable first level of debugging
378
+ * (disable generation history)
379
+ */
380
+ testEmails?: string[],
381
+ /**
382
+ * Override period, must match task's recurrence
383
+ */
384
+ period?: Period,
385
+ }
386
+
387
+ startGeneration(taskId: string, params: P, namespaces?: string[]): Promise<ApiResponse<queues.Job>>
388
+ ```
389
+
390
+ Start generation of a report. Returns the job info in order to track progress.
391
+
392
+ Needs `namespaces[namespaceId].tasks-post-task-run` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
393
+
394
+ __Params__:
395
+
396
+ - `taskId`: Id of the task
397
+ - `params`: Other params for overriding default
398
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
399
+
400
+ #### startAndListenGeneration
401
+
402
+ ```ts
403
+ type P = {
404
+ /**
405
+ * Override targets of task. Also enable first level of debugging
406
+ * (disable generation history)
407
+ */
408
+ testEmails?: string[],
409
+ /**
410
+ * Override period, must match task's recurrence
411
+ */
412
+ period?: Period,
413
+ }
414
+
415
+ startAndListenGeneration(taskId: string, params: P, namespaces?: string[]): EventfulPromise<ReportResult>
416
+ ```
417
+
418
+ Start generation of a report and track progress. Returns the detail when generation ends as an `EventfulPromise` (a promise that can send events so you can still use async/await while tracking progress).
419
+
420
+ Needs `namespaces[namespaceId].tasks-post-task-run` & `namespaces[namespaceId].queues-get-queue-jobs-jobId` permissions permissions (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
421
+
422
+ > **Note**
423
+ > If job's fails it will throws an error but __not if generation fails !__
424
+
425
+ __Params__:
426
+
427
+ - `taskId`: Id of the task
428
+ - `params`: Other params for overriding default
429
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
430
+
431
+ __Fires__:
432
+
433
+ - `started` When generation started. Type: `reports.GenerationStartedEvent`.
434
+ - `progress` When generation started. Job's progress is between 0 and 1. Type: `reports.GenerationStartedEvent`.
435
+
436
+ #### getReportFileByName
437
+
438
+ ```ts
439
+ // Parameter to give to have...
440
+ type ResultTypes = "arraybuffer" | "blob" | "json" | "text" | "stream"
441
+ // ...matching return type
442
+ type Result = ArrayBuffer | Blob | object | string | Stream
443
+
444
+ getReportFileByName(pathName: string, namespaces?: string[], responseType: ResultTypes = 'text'): Promise<Result>
445
+ ```
446
+
447
+ Get report main file (the result) by giving the report's name
448
+
449
+ Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
450
+
451
+ __Params__:
452
+
453
+ - `pathName`: Path to the file
454
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
455
+ - `responseType`: Wanted response type
456
+
457
+ #### getReportFileByJob
458
+
459
+ ```ts
460
+ type ResultTypes = "arraybuffer" | "blob" | "json" | "text" | "stream"
461
+ type Result = ArrayBuffer | Blob | object | string | Stream
462
+
463
+ getReportFileByJob(queueName: string, jobId: string | number, namespaces?: string[], responseType: Result = 'text'): Promise<Result>
464
+ ```
465
+
466
+ Get report main file (the result) by giving job's info
467
+
468
+ Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` & `namespaces[namespaceId].queues-get-queue-jobs-jobId ` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
469
+
470
+ __Params__:
471
+
472
+ - `name`: Name of the queue
473
+ - `jobId`: Id of the job
474
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
475
+ - `responseType`: Wanted response type
476
+
477
+ #### getReportDetailByName
478
+
479
+ ```ts
480
+ type ResultTypes = "arraybuffer" | "blob" | "json" | "text" | "stream"
481
+
482
+ getReportDetailByName(pathName: string, namespaces?: string[], responseType: ResultTypes = 'json'): Promise<reports.ReportResult>
483
+ ```
484
+
485
+ Get report detail by giving the report's name
486
+
487
+ Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
488
+
489
+ __Params__:
490
+
491
+ - `pathName`: Path to the file
492
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
493
+ - `responseType`: Wanted response type. **If provided with anything but `json` you will have to cast in your type to avoid auto-completion issues.**
494
+
495
+ #### getReportDetailByJob
496
+
497
+ ```ts
498
+ type ResultTypes = "arraybuffer" | "blob" | "json" | "text" | "stream"
499
+
500
+ getReportDetailByJob(queueName: string, jobId: string | number, namespaces?: string[], responseType: ResultTypes = 'json'): Promise<reports.ReportResult>
501
+ ```
502
+
503
+ Get report detail by giving job's info
504
+
505
+ Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename`
506
+ * & `namespaces[namespaceId].queues-get-queue-jobs-jobId ` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
507
+
508
+ __Params__:
509
+
510
+ - `name`: Name of the queue
511
+ - `jobId`: Id of the job
512
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
513
+ - `responseType`: Wanted response type. **If provided with anything but `json` you will have to cast in your type to avoid auto-completion issues.**
514
+
515
+ #### getReportDebugByName
516
+
517
+ ```ts
518
+ type ResultTypes = "arraybuffer" | "blob" | "json" | "text" | "stream"
519
+ type Result = ArrayBuffer | Blob | object | string | Stream
520
+
521
+ getReportDebugByName(pathName: string, namespaces?: string[], responseType: ResultTypes = 'text'): Promise<Result>
522
+ ```
523
+
524
+ Get report debug file by giving the report's name
525
+
526
+ Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
527
+
528
+ __Params__:
529
+
530
+ - `pathName`: Path to the file
531
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
532
+ - `responseType`: Wanted response type
533
+
534
+ #### getReportDebugByJob
535
+
536
+ ```ts
537
+ type ResultTypes = "arraybuffer" | "blob" | "json" | "text" | "stream"
538
+ type Result = ArrayBuffer | Blob | object | string | Stream
539
+
540
+ getReportDebugByJob(queueName: string, jobId: string | number, namespaces?: string[], responseType: ResultTypes = 'json'): Promise<Result>
541
+ ```
542
+
543
+ Get report debug file by giving job's info
544
+
545
+ Needs `namespaces[namespaceId].reports-get-year-yearMonth-filename`
546
+ * & `namespaces[namespaceId].queues-get-queue-jobs-jobId ` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
547
+
548
+ __Params__:
549
+
550
+ - `name`: Name of the queue
551
+ - `jobId`: Id of the job
552
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
553
+ - `responseType`: Wanted response type
554
+
555
+ ---
556
+
557
+ ### setup
558
+
559
+ Methods to setup SDK before using it
560
+
561
+ #### setURL
562
+
563
+ ```ts
564
+ setURL(url: string): void
565
+ ```
566
+
567
+ Set API url to axios
568
+
569
+ __Params__:
570
+
571
+ - `url`: The base URL to ezREEPORT API
572
+
573
+ #### unsetURL
574
+
575
+ ```ts
576
+ unsetURL(): void
577
+ ```
578
+
579
+ Unset API url from axios
580
+
581
+ #### isURLset
582
+
583
+ ```ts
584
+ isURLset(): void
585
+ ```
586
+ Check if API url is setup in axios
587
+
588
+ #### login
589
+
590
+ Same as in [auth module](#login)
591
+
592
+ #### logout
593
+
594
+ Same as in [auth module](#logout)
595
+
596
+ #### isLogged
597
+
598
+ Same as in [auth module](#isLogged)
599
+
600
+ ---
601
+
602
+ ### tasks
603
+
604
+ #### getAllTasks
605
+
606
+ ```ts
607
+ type P = {
608
+ /**
609
+ * Previous id
610
+ */
611
+ previous?: string,
612
+ /**
613
+ * Wanted count of items
614
+ */
615
+ count?: number
616
+ }
617
+
618
+ getAllTasks(paginationOpts: P, namespaces?: string[]): Promise<PaginatedApiResponse<tasks.Task[]>>
619
+ ```
620
+
621
+ Get all available tasks
622
+
623
+ Needs `namespaces[namespaceId].tasks-get` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
624
+
625
+ __Params__:
626
+
627
+ - `paginationOpts`: Options for pagination
628
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
629
+
630
+ #### getTask
631
+
632
+ ```ts
633
+ getTask(id: string, namespaces?: string[]): Promise<ApiResponse<tasks.Task>>
634
+ ```
635
+
636
+ Get specific task info
637
+
638
+ Needs `namespaces[namespaceId].tasks-get-task` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
639
+
640
+ __Params__:
641
+
642
+ - `id`: Task's id
643
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
644
+
645
+ #### createTask
646
+
647
+ ```ts
648
+ createTask(data: tasks.InputTask, namespaces?: string[]): Promise<ApiResponse<tasks.FullTask>>
649
+ ```
650
+
651
+ Create a new task with a random UUID
652
+
653
+ Needs `namespaces[namespaceId].tasks-post-task` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
654
+
655
+ __Params__:
656
+
657
+ - `data`: Task's data
658
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
659
+
660
+ #### upsertTask
661
+
662
+ ```ts
663
+ upsertTask(id: string, data: tasks.InputTask, namespaces?: string[]): Promise<ApiResponse<tasks.FullTask>>
664
+ ```
665
+
666
+ Update or create a task
667
+
668
+ Needs `namespaces[namespaceId].tasks-put-task` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
669
+
670
+ __Params__:
671
+
672
+ - `id`: Task's id
673
+ - `data`: Task's data
674
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
675
+
676
+ #### deleteTask
677
+
678
+ ```ts
679
+ deleteTask(id: string, namespaces?: string[]): Promise<void>
680
+ ```
681
+
682
+ Delete specific task
683
+
684
+ Needs `namespaces[namespaceId].tasks-delete-task` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
685
+
686
+ __Params__:
687
+
688
+ - `id`: Task's id
689
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
690
+
691
+ #### enableTask
692
+
693
+ ```ts
694
+ enableTask(id: string, namespaces?: string[]): Promise<ApiResponse<FullTask>>
695
+ ```
696
+
697
+ Shorthand to enable a task
698
+
699
+ Needs `namespaces[namespaceId].tasks-put-task-enable` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
700
+
701
+ __Params__:
702
+
703
+ - `id`: Task's id
704
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
705
+
706
+ #### disableTask
707
+
708
+ ```ts
709
+ disableTask(id: string, namespaces?: string[]): Promise<ApiResponse<FullTask>>
710
+ ```
711
+
712
+ Shorthand to disable a task
713
+
714
+ Needs `namespaces[namespaceId].tasks-put-task-disable` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
715
+
716
+ __Params__:
717
+
718
+ - `id`: Task's id
719
+ - `namespaces`: Select which namespaces are concerned by the request. Default to all possible namespaces.
720
+
721
+ ---
722
+
723
+ ### templates
724
+
725
+ #### getAllTemplates
726
+
727
+ ```ts
728
+ getAllTemplates(): Promise<ApiResponse<templates.Template[]>>
729
+ ```
730
+
731
+ Get all available templates
732
+
733
+ Needs `general.templates-get` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
734
+
735
+ #### getTemplate
736
+
737
+ ```ts
738
+ getTemplate(name: string): Promise<ApiResponse<templates.Template>>
739
+ ```
740
+
741
+ Needs `general.templates-get-name(*)` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
742
+
743
+ __Params__:
744
+
745
+ - `id`: Task's id
746
+ - `data`: Task's data
747
+
748
+ #### upsertTemplate
749
+
750
+ ```ts
751
+ upsertTemplate(name: string, data: templates.InputTemplate): Promise<ApiResponse<templates.Template>>
752
+ ```
753
+
754
+ Update or create a template
755
+
756
+ Needs `general.templates-put-name(*)` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
757
+
758
+ __Params__:
759
+
760
+ - `name`: Template's name
761
+ - `data`: Template's data
762
+
763
+ #### deleteTemplate
764
+
765
+ ```ts
766
+ deleteTemplate(name: string): Promise<void>
767
+ ```
768
+ Delete a template
769
+
770
+ Needs `general.templates-delete-name(*)` permission (see [auth::getCurrentPermissions](#getcurrentpermissions) for more info)
771
+
772
+ __Params__:
773
+
774
+ - `name`: Template's name