useresponse 0.0.1 → 0.0.2

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 (42) hide show
  1. package/README.md +9 -4
  2. package/dist/Endpoints.d.ts +74 -0
  3. package/dist/Endpoints.js +173 -0
  4. package/dist/UseResponse.d.ts +11 -0
  5. package/dist/UseResponse.js +38 -0
  6. package/dist/api/AdditionalAPI.d.ts +8 -0
  7. package/dist/api/AdditionalAPI.js +33 -0
  8. package/dist/api/AuthAPI.d.ts +7 -0
  9. package/dist/api/AuthAPI.js +26 -0
  10. package/dist/api/CategoriesAPI.d.ts +13 -0
  11. package/dist/api/CategoriesAPI.js +33 -0
  12. package/dist/api/ChangelogAPI.d.ts +8 -0
  13. package/dist/api/ChangelogAPI.js +33 -0
  14. package/dist/api/ChatsAPI.d.ts +13 -0
  15. package/dist/api/ChatsAPI.js +40 -0
  16. package/dist/api/CommentsAPI.d.ts +14 -0
  17. package/dist/api/CommentsAPI.js +75 -0
  18. package/dist/api/CustomFieldsAPI.d.ts +8 -0
  19. package/dist/api/CustomFieldsAPI.js +33 -0
  20. package/dist/api/ModerationAPI.d.ts +10 -0
  21. package/dist/api/ModerationAPI.js +47 -0
  22. package/dist/api/ObjectsAPI.d.ts +19 -0
  23. package/dist/api/ObjectsAPI.js +110 -0
  24. package/dist/api/ReportsAPI.d.ts +8 -0
  25. package/dist/api/ReportsAPI.js +33 -0
  26. package/dist/api/UserNotesAPI.d.ts +10 -0
  27. package/dist/api/UserNotesAPI.js +47 -0
  28. package/dist/api/UsersAPI.d.ts +16 -0
  29. package/dist/api/UsersAPI.js +89 -0
  30. package/dist/api/index.d.ts +12 -0
  31. package/dist/api/index.js +28 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +18 -0
  34. package/dist/interfaces/API.d.ts +15 -0
  35. package/dist/interfaces/API.js +2 -0
  36. package/dist/interfaces/ClientOptions.d.ts +4 -0
  37. package/dist/interfaces/ClientOptions.js +2 -0
  38. package/dist/interfaces/UseResponseInterfaces.d.ts +723 -0
  39. package/dist/interfaces/UseResponseInterfaces.js +2 -0
  40. package/dist/interfaces/index.d.ts +3 -0
  41. package/dist/interfaces/index.js +19 -0
  42. package/package.json +16 -9
@@ -0,0 +1,723 @@
1
+ export interface APIResult<T> {
2
+ currentPage?: number;
3
+ data: T;
4
+ firstPage: number;
5
+ lastPage: number;
6
+ nextPage: number;
7
+ objectsPerPage: number;
8
+ totalObjects: number;
9
+ totalPages: number;
10
+ }
11
+ export interface Attachment {
12
+ directUrl?: string;
13
+ icon?: string;
14
+ id?: number;
15
+ name?: AttachmentName;
16
+ url?: string;
17
+ }
18
+ export interface Avatar {
19
+ big?: string;
20
+ medium?: string;
21
+ small?: string;
22
+ tiny?: string;
23
+ }
24
+ export interface BanUserParams {
25
+ /**
26
+ * @description Duration of the ban in days (ignored if permanent)
27
+ * @example 30
28
+ */
29
+ ban_duration_days?: number;
30
+ /**
31
+ * @description Reason for banning the user
32
+ * @example Fraudulent activity detected
33
+ */
34
+ ban_reason?: string;
35
+ /**
36
+ * @description Whether to delete user's related objects (tickets, comments, etc.)
37
+ * @example true
38
+ */
39
+ delete_related_objects?: boolean;
40
+ /**
41
+ * @description If true, the ban is permanent
42
+ * @example false
43
+ */
44
+ permanent?: boolean;
45
+ }
46
+ export interface BanUserResponse {
47
+ success?: User;
48
+ }
49
+ export interface Category {
50
+ description?: null | string;
51
+ forum?: Forum;
52
+ id?: number;
53
+ image?: {
54
+ big?: string;
55
+ medium?: string;
56
+ small?: string;
57
+ };
58
+ isPrivate?: boolean;
59
+ name?: string;
60
+ order?: number;
61
+ ownership?: null | string;
62
+ parent_id?: number;
63
+ slug?: string;
64
+ type?: null | unknown;
65
+ }
66
+ export interface Changelog {
67
+ actions?: ChangelogAction[];
68
+ createdAtPosix?: number;
69
+ createdBy?: User;
70
+ source?: string;
71
+ }
72
+ export interface ChangelogAction {
73
+ change_id?: string;
74
+ field?: string;
75
+ previous?: string;
76
+ value?: string;
77
+ }
78
+ export interface ChangePasswordParams {
79
+ /**
80
+ * @description New valid password value
81
+ * @example securestring12345
82
+ */
83
+ password: string;
84
+ }
85
+ export interface Chat {
86
+ author?: User;
87
+ completedAt?: string;
88
+ completedAtPosix?: number;
89
+ createdAt?: string;
90
+ createdAtPosix?: number;
91
+ externalId?: number;
92
+ id?: number;
93
+ lastMessage?: Message;
94
+ responsible?: User;
95
+ score?: number;
96
+ seenByClient?: boolean;
97
+ source?: string;
98
+ title?: string;
99
+ token?: string;
100
+ updatedAt?: string;
101
+ updatedAtPosix?: number;
102
+ }
103
+ export interface ChatMessagesPaginator {
104
+ success?: Message[];
105
+ }
106
+ export interface ChatsPaginator {
107
+ currentPage?: number;
108
+ data?: Chat[];
109
+ firstPage?: number;
110
+ lastPage?: number;
111
+ nextPage?: number;
112
+ objectsPerPage?: number;
113
+ totalObjects?: number;
114
+ totalPages?: number;
115
+ }
116
+ export interface ChatsResponse {
117
+ success?: ChatsPaginator;
118
+ }
119
+ export interface Comment {
120
+ attachments?: Attachment[];
121
+ author?: User;
122
+ content?: string;
123
+ createdAgo?: string;
124
+ createdAt?: string;
125
+ createdAtPosix?: number;
126
+ id?: number;
127
+ is_best?: number;
128
+ objectId?: number;
129
+ ownership?: string;
130
+ replyToId?: number;
131
+ updatedAt?: string;
132
+ votes?: Vote;
133
+ }
134
+ export interface CommentActionResponse {
135
+ success?: Comment;
136
+ }
137
+ export interface CommentAddParams {
138
+ /**
139
+ * @description The content of a new object.
140
+ * Supports BBcode, but HTML tags are not allowed
141
+ * ##### Max content length: 12000 chars
142
+ * @example My first comment
143
+ */
144
+ content: string;
145
+ /**
146
+ * @description If 1 specified, comment will be saved as private note. To add private note you should have agent’s or admin’s privileges
147
+ * ##### Valid values: 0, 1
148
+ * @example 0
149
+ */
150
+ is_private?: number;
151
+ /**
152
+ * @description Valid object(ticket/topic) id
153
+ * @example 38
154
+ */
155
+ object_id?: number;
156
+ /**
157
+ * @description Valid comment id to make reply to comment
158
+ * @example 10
159
+ */
160
+ reply_to?: number;
161
+ /**
162
+ * @description API would accept “content” parameter in HTML format. Overrides “Accept HTML Content” global setting for one request
163
+ * ##### Valid values: 0, 1
164
+ * @example 0
165
+ */
166
+ treat_as_html?: number;
167
+ }
168
+ export interface CommentEditParams {
169
+ /**
170
+ * @description The content of a new object.
171
+ * Supports BBcode, but HTML tags are not allowed
172
+ * ##### Max content length: 12000 chars
173
+ * @example My first comment
174
+ */
175
+ content?: string;
176
+ /**
177
+ * @description API would accept “content” parameter in HTML format. Overrides “Accept HTML Content” global setting for one request
178
+ * ##### Valid values: 0, 1
179
+ * @example 0
180
+ */
181
+ treat_as_html?: number;
182
+ }
183
+ export interface CommentModerateResponse {
184
+ success?: Comment;
185
+ }
186
+ export interface CommentsListResponse {
187
+ success?: Comment[];
188
+ }
189
+ export interface CreateObjectResponse {
190
+ success?: Object;
191
+ }
192
+ export interface CreateUserParams {
193
+ /**
194
+ * @description New valid “email” value
195
+ * @example test@test.com
196
+ */
197
+ email: string;
198
+ /**
199
+ * @description Not empty string containing user’s name
200
+ * @example John Edwards
201
+ */
202
+ full_name: string;
203
+ /**
204
+ * @description User’s password
205
+ * @example securestring12345
206
+ */
207
+ password?: string;
208
+ /**
209
+ * @description Specify the name for the custom field
210
+ * @example Support
211
+ */
212
+ property_1?: string;
213
+ tags?: string;
214
+ /**
215
+ * @description Valid team numeric identifier
216
+ * @example 1
217
+ */
218
+ team_id?: number;
219
+ }
220
+ export interface CustomField {
221
+ description?: unknown;
222
+ field_type?: string;
223
+ id?: number;
224
+ is_active?: number;
225
+ is_private?: number;
226
+ is_required?: number;
227
+ label?: string;
228
+ module?: string;
229
+ name?: string;
230
+ options?: Record<string, never>;
231
+ type?: string;
232
+ }
233
+ export interface CustomFieldValue {
234
+ id?: number;
235
+ label?: string;
236
+ name?: string;
237
+ textValue?: unknown[];
238
+ value?: unknown[];
239
+ }
240
+ export interface DeclineParams {
241
+ /**
242
+ * @description In case a comment or topic is declined you can specify decline reason
243
+ * @example Too little information provided
244
+ */
245
+ reason?: string;
246
+ }
247
+ export interface EditObjectResponse {
248
+ success?: Object;
249
+ }
250
+ export interface EditUserParams {
251
+ /**
252
+ * @description New valid “email” value.
253
+ * @example test@test.com
254
+ */
255
+ email?: string;
256
+ /**
257
+ * @description Not empty string containing user’s name.
258
+ * @example John Edwards
259
+ */
260
+ full_name?: string;
261
+ /**
262
+ * @description User phone number.
263
+ * @example +447777444445
264
+ */
265
+ phone?: string;
266
+ /**
267
+ * @description Specify the name for the custom field
268
+ * @example Support
269
+ */
270
+ property_1?: string;
271
+ tags?: string;
272
+ /**
273
+ * @description Valid team numeric identifier
274
+ * @example 1
275
+ */
276
+ team_id?: number;
277
+ }
278
+ export interface ErrorInvalidParamsResponse {
279
+ error?: {
280
+ /** @default 400 */
281
+ code: number;
282
+ /** @default ownership or/and object_type parameters are missed */
283
+ context: string;
284
+ /** @default Invalid request and/or request parameters */
285
+ message: string;
286
+ };
287
+ }
288
+ export interface ErrorNotFoundResponse {
289
+ error?: {
290
+ /** @default 404 */
291
+ code: number;
292
+ /** @default Resource is not found */
293
+ message: string;
294
+ };
295
+ }
296
+ export interface ErrorUnauthorizedResponse {
297
+ error?: {
298
+ /** @default 401 */
299
+ code: number;
300
+ /** @default Authentication is required */
301
+ message: string;
302
+ };
303
+ }
304
+ export interface Forum {
305
+ id?: string;
306
+ name?: string;
307
+ }
308
+ export interface GetChatResponse {
309
+ success?: Chat;
310
+ }
311
+ export interface LoginData {
312
+ password: string;
313
+ username: string;
314
+ }
315
+ export interface LoginParams {
316
+ /** @example support@useresponse.com */
317
+ email: string;
318
+ /** @example 123456 */
319
+ password: string;
320
+ }
321
+ export interface ManageUserNoteParams {
322
+ /**
323
+ * @description The content of a new comment.
324
+ * Supports BBcode, but HTML tags are not allowed
325
+ * ##### Max content length: 12000 chars
326
+ * @example My first note
327
+ */
328
+ content: string;
329
+ /**
330
+ * @description Not empty string containing user’s name
331
+ * @example 2017-10-13 18:29:00
332
+ */
333
+ remind_at?: string;
334
+ }
335
+ export interface Message {
336
+ author?: User;
337
+ content?: string;
338
+ createdAtPosix?: number;
339
+ fileName?: string;
340
+ id?: number;
341
+ isSystem?: boolean;
342
+ parentId?: number;
343
+ token?: string;
344
+ type?: string;
345
+ }
346
+ export interface Object {
347
+ attachments?: Attachment[];
348
+ author?: User;
349
+ bestComment?: Comment;
350
+ canBeCommented?: boolean;
351
+ category?: Category;
352
+ commentedAt?: string;
353
+ commentsNum?: number;
354
+ completedBy?: User;
355
+ completedOn?: string;
356
+ content?: string;
357
+ createdAt?: string;
358
+ createdAtPosix?: number;
359
+ custom_fields?: CustomFieldValue[];
360
+ forum?: Forum;
361
+ id?: number;
362
+ isAbused?: boolean;
363
+ isFeatured?: boolean;
364
+ isPrivate?: boolean;
365
+ isSubscribed?: number;
366
+ language?: string;
367
+ latestActivityPosix?: number;
368
+ links?: Link[];
369
+ ownership?: string;
370
+ parentObject?: unknown;
371
+ recipients?: string[];
372
+ responsible?: User;
373
+ score?: number;
374
+ scoreComment?: string;
375
+ scoreReason?: string;
376
+ slaDatePosix?: number;
377
+ slug?: string;
378
+ source?: Source;
379
+ state?: State;
380
+ status?: Status;
381
+ tags?: string[];
382
+ team?: Team;
383
+ title?: string;
384
+ type?: ObjectType;
385
+ url?: string;
386
+ views?: number;
387
+ votes?: Votes;
388
+ }
389
+ export interface ObjectAddParams {
390
+ /** @description Array of attachments */
391
+ attachments?: NewAttachment[];
392
+ /**
393
+ * @description Valid category id to assign new object to
394
+ * Value 0 means no category
395
+ * @example 0
396
+ */
397
+ category_id?: number;
398
+ /**
399
+ * @description The content of a new object.
400
+ * Supports BBcode, but HTML tags are not allowed
401
+ * ##### Max content length: 12000 chars
402
+ * ##### Required for feedback, announcements
403
+ * @example Here is the sense of my problem
404
+ */
405
+ content?: string;
406
+ /**
407
+ * @description Allows to use object expiration date
408
+ * Value never means that announcement has no expiration date
409
+ * ##### Valid only for announcements. Valid values: never, on_date
410
+ * @example never
411
+ */
412
+ expire_select?: string;
413
+ /**
414
+ * @description Valid only for announcements and date should be in format dd.mm.yyyy
415
+ * ##### required when expire_select parameter value is set to on_date
416
+ * @example 15.06.2020
417
+ */
418
+ expires_at?: string;
419
+ /**
420
+ * @description Allows to set object author manually
421
+ * Requires appropriate privilege
422
+ * Valid user id or any email address
423
+ * @example support@useresponse.com
424
+ */
425
+ force_author?: string;
426
+ /**
427
+ * @description Allows to define object privacy
428
+ * ##### Only for feedback and announcements
429
+ * ##### Valid values: 0, 1
430
+ * @example 0
431
+ */
432
+ is_private?: number;
433
+ /**
434
+ * @description Valid object type
435
+ * @example ticket
436
+ * @enum {string}
437
+ */
438
+ object_type: 'idea' | 'problem' | 'question' | 'ticket';
439
+ /**
440
+ * @description Object belongs to a logical group
441
+ * @example helpdesk
442
+ * @enum {string}
443
+ */
444
+ ownership: 'feedback' | 'helpdesk';
445
+ /**
446
+ * @description Specify the name for the custom field
447
+ * @example Support
448
+ */
449
+ property_1?: string;
450
+ /**
451
+ * @description Valid agent or administrator user id
452
+ * Value 0 means nobody
453
+ * @example 10
454
+ */
455
+ responsible_id?: number;
456
+ /** @description Array of tags */
457
+ tags?: string[];
458
+ /**
459
+ * @description Valid team numeric identifier
460
+ * @example 5
461
+ */
462
+ team_id?: number;
463
+ /**
464
+ * @description The title of a new object
465
+ * ##### Max title length: 100 chars
466
+ * @example My first helpdesk record
467
+ */
468
+ title: string;
469
+ }
470
+ export interface ObjectEditParams {
471
+ /** @description Array of attachments */
472
+ attachments?: NewAttachment[];
473
+ /**
474
+ * @description Valid category id to assign new object to
475
+ * Value 0 means no category
476
+ * @example 0
477
+ */
478
+ category_id?: number;
479
+ /**
480
+ * @description The content of a new object.
481
+ * Supports BBcode, but HTML tags are not allowed
482
+ * ##### Max content length: 12000 chars
483
+ * ##### Required for feedback, announcements
484
+ * @example Here is the sense of my problem
485
+ */
486
+ content?: string;
487
+ /**
488
+ * @description Allows to use object expiration date
489
+ * Value never means that announcement has no expiration date
490
+ * ##### Valid only for announcements. Valid values: never, on_date
491
+ * @example never
492
+ */
493
+ expire_select?: string;
494
+ /**
495
+ * @description Valid only for announcements and date should be in format dd.mm.yyyy
496
+ * ##### required when expire_select parameter value is set to on_date
497
+ * @example 15.06.2020
498
+ */
499
+ expires_at?: string;
500
+ /**
501
+ * @description Allows to set object author manually
502
+ * Requires appropriate privilege
503
+ * Valid user id or any email address
504
+ * @example support@useresponse.com
505
+ */
506
+ force_author?: string;
507
+ /**
508
+ * @description Allows to define object privacy
509
+ * ##### Only for feedback and announcements
510
+ * ##### Valid values: 0, 1
511
+ * @example 0
512
+ */
513
+ is_private?: number;
514
+ /**
515
+ * @description Valid object type
516
+ * @example ticket
517
+ */
518
+ object_type?: string;
519
+ /**
520
+ * @description Specify the name for the custom field
521
+ * @example Support
522
+ */
523
+ property_1?: string;
524
+ /**
525
+ * @description Valid agent or administrator user id
526
+ * Value 0 means nobody
527
+ * @example 10
528
+ */
529
+ responsible_id?: number;
530
+ /**
531
+ * @description Valid status id. Id can be taken from statuses.json
532
+ * @example 1
533
+ */
534
+ status_id?: number;
535
+ /** @description Array of tags */
536
+ tags?: string[];
537
+ /**
538
+ * @description Valid team numeric identifier
539
+ * @example 5
540
+ */
541
+ team_id?: number;
542
+ /**
543
+ * @description The title of a new object
544
+ * ##### Max title length: 100 chars
545
+ * @example My first helpdesk record
546
+ */
547
+ title?: string;
548
+ }
549
+ export interface ObjectType {
550
+ icon?: {
551
+ big?: string;
552
+ small?: string;
553
+ };
554
+ order?: number;
555
+ slug?: string;
556
+ supports?: {
557
+ comments?: boolean;
558
+ negativeVote?: boolean;
559
+ votes?: boolean;
560
+ };
561
+ title?: {
562
+ plural?: string;
563
+ single?: string;
564
+ };
565
+ }
566
+ export interface Paginator {
567
+ currentPage?: number;
568
+ data?: Object[];
569
+ firstPage?: number;
570
+ lastPage?: number;
571
+ nextPage?: number;
572
+ objectsPerPage?: number;
573
+ totalObjects?: number;
574
+ totalPages?: number;
575
+ }
576
+ export interface Report {
577
+ /** @default 4 */
578
+ id: number;
579
+ /** @default Inbox */
580
+ name: string;
581
+ }
582
+ export interface ReportGroup {
583
+ count?: number;
584
+ id?: string;
585
+ name?: string;
586
+ }
587
+ export interface ReportPaginator {
588
+ activeGroup?: string;
589
+ currentPage?: number;
590
+ data?: Object[];
591
+ firstPage?: number;
592
+ groups?: ReportGroup[];
593
+ lastPage?: number;
594
+ nextPage?: number;
595
+ objectsPerPage?: number;
596
+ totalObjects?: number;
597
+ totalPages?: number;
598
+ }
599
+ export interface SearchResponse {
600
+ success?: Paginator;
601
+ }
602
+ export interface Source {
603
+ identifier?: string;
604
+ name?: string;
605
+ }
606
+ export interface State {
607
+ identifier?: number;
608
+ name?: string;
609
+ }
610
+ export interface Status {
611
+ color?: {
612
+ background?: string;
613
+ text?: string;
614
+ };
615
+ id?: number;
616
+ isClosed?: boolean;
617
+ isDefault?: boolean;
618
+ isSystem?: boolean;
619
+ order?: number;
620
+ ownership?: string;
621
+ slug?: string;
622
+ title?: string;
623
+ type?: string;
624
+ }
625
+ export interface TopicModerateResponse {
626
+ success?: Object;
627
+ }
628
+ export interface User {
629
+ apiKey?: string;
630
+ avatar?: Avatar;
631
+ custom_fields?: CustomFieldValue[];
632
+ gravatarEmail?: null | string;
633
+ id?: number;
634
+ isDefaultAvatar?: boolean;
635
+ lastVisitAt?: string;
636
+ name?: string;
637
+ profileUrl?: string;
638
+ registrationDate?: string;
639
+ role?: {
640
+ alias?: string;
641
+ id?: number;
642
+ };
643
+ shortName?: string;
644
+ tags?: string;
645
+ team?: {
646
+ id?: number;
647
+ name?: string;
648
+ };
649
+ }
650
+ export interface UserActionResponse {
651
+ success?: User;
652
+ }
653
+ export interface UserNote {
654
+ author?: User;
655
+ content?: string;
656
+ createdAgo?: string;
657
+ createdAt?: string;
658
+ createdAtPosix?: number;
659
+ id?: number;
660
+ updatedAt?: string;
661
+ }
662
+ export interface UserNotesResponse {
663
+ success?: UserNote[];
664
+ }
665
+ export interface UsersActivityResponse {
666
+ currentPage?: number;
667
+ data?: Object[];
668
+ firstPage?: number;
669
+ lastPage?: number;
670
+ nextPage?: number;
671
+ objectsPerPage?: number;
672
+ totalObjects?: number;
673
+ totalPages?: number;
674
+ }
675
+ export interface UsersSearchResponse {
676
+ currentPage?: number;
677
+ data?: User[];
678
+ firstPage?: number;
679
+ lastPage?: number;
680
+ nextPage?: number;
681
+ objectsPerPage?: number;
682
+ totalObjects?: number;
683
+ totalPages?: number;
684
+ }
685
+ export interface Vote {
686
+ amount?: number;
687
+ canVote?: boolean;
688
+ isVoted?: boolean;
689
+ plural?: string;
690
+ }
691
+ interface AttachmentName {
692
+ ext?: string;
693
+ full?: string;
694
+ short?: string;
695
+ }
696
+ interface Link {
697
+ object_id?: string;
698
+ title?: string;
699
+ type?: string;
700
+ url?: string;
701
+ }
702
+ interface NewAttachment {
703
+ /**
704
+ * @description Should be in base64 format
705
+ * @example iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAA.....==
706
+ */
707
+ body?: string;
708
+ /** @example call.png */
709
+ name?: string;
710
+ }
711
+ interface Team {
712
+ id?: number;
713
+ name?: string;
714
+ }
715
+ interface Votes {
716
+ all?: number;
717
+ canVote?: boolean;
718
+ isVoted?: boolean;
719
+ negative?: number;
720
+ plural?: string;
721
+ positive?: number;
722
+ }
723
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './API';
2
+ export * from './ClientOptions';
3
+ export * from './UseResponseInterfaces';