@great-detail/support-sdk 0.10.2 → 0.10.4

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.
@@ -65,6 +65,23 @@ declare class FetchTransport implements Transport {
65
65
  * @author Dom Webber <dom.webber@greatdetail.com>
66
66
  * @see https://greatdetail.com
67
67
  */
68
+ type CreatedAtResponseTimestamp = {
69
+ createdAt: string;
70
+ };
71
+ type UpdatedAtResponseTimestamp = {
72
+ updatedAt: string;
73
+ };
74
+ type ResponseTimestamp = CreatedAtResponseTimestamp & UpdatedAtResponseTimestamp;
75
+
76
+ /**
77
+ * Great Detail Support System.
78
+ *
79
+ * @copyright 2024 Great Detail Ltd
80
+ * @author Great Detail Ltd <info@greatdetail.com>
81
+ * @author Dom Webber <dom.webber@greatdetail.com>
82
+ * @see https://greatdetail.com
83
+ */
84
+
68
85
  type Action = {
69
86
  id: string;
70
87
  status: string;
@@ -74,9 +91,7 @@ type Action = {
74
91
  result?: string;
75
92
  startedAt?: string;
76
93
  endedAt?: string;
77
- createdAt: string;
78
- updatedAt: string;
79
- };
94
+ } & ResponseTimestamp;
80
95
 
81
96
  interface ListActionsOptions {
82
97
  request?: RequestInit;
@@ -114,15 +129,14 @@ type Authentication = RequestFilterable;
114
129
  * @author Dom Webber <dom.webber@greatdetail.com>
115
130
  * @see https://greatdetail.com
116
131
  */
132
+
117
133
  type Boilerplate = {
118
134
  id: string;
119
135
  title: string;
120
136
  content: string;
121
137
  account: string;
122
138
  boilerplateCategory: string;
123
- createdAt: string;
124
- updatedAt: string;
125
- };
139
+ } & ResponseTimestamp;
126
140
 
127
141
  type CreateBoilerplatePayload = {
128
142
  title: string;
@@ -230,14 +244,13 @@ declare class UpdateBoilerplate {
230
244
  * @author Dom Webber <dom.webber@greatdetail.com>
231
245
  * @see https://greatdetail.com
232
246
  */
247
+
233
248
  type BoilerplateCategory = {
234
249
  id: string;
235
250
  title: string;
236
251
  description?: string;
237
252
  account: string;
238
- createdAt: string;
239
- updatedAt: string;
240
- };
253
+ } & ResponseTimestamp;
241
254
 
242
255
  type CreateBoilerplateCategoryPayload = {
243
256
  title: string;
@@ -279,15 +292,15 @@ declare class GetBoilerplateCategory {
279
292
  };
280
293
  }
281
294
 
282
- interface IncludeOptions$5 {
295
+ interface IncludeOptions$6 {
283
296
  boilerplateCount?: boolean;
284
297
  [key: string]: boolean | undefined;
285
298
  }
286
- interface ListBoilerplateCategoriesOptions<C extends IncludeOptions$5> {
299
+ interface ListBoilerplateCategoriesOptions<C extends IncludeOptions$6> {
287
300
  include?: C;
288
301
  request?: RequestInit;
289
302
  }
290
- type ListBoilerplateCategoriesResponse<C extends IncludeOptions$5> = {
303
+ type ListBoilerplateCategoriesResponse<C extends IncludeOptions$6> = {
291
304
  data: {
292
305
  boilerplateCategory: BoilerplateCategory;
293
306
  boilerplateCount?: C extends {
@@ -298,7 +311,7 @@ type ListBoilerplateCategoriesResponse<C extends IncludeOptions$5> = {
298
311
  declare class ListBoilerplateCategories {
299
312
  protected _transport: FetchTransport;
300
313
  constructor(_transport: FetchTransport);
301
- send<C extends IncludeOptions$5>({ include, request, }?: ListBoilerplateCategoriesOptions<C>): {
314
+ send<C extends IncludeOptions$6>({ include, request, }?: ListBoilerplateCategoriesOptions<C>): {
302
315
  response: () => Promise<ky.KyResponse<ListBoilerplateCategoriesResponse<C>>>;
303
316
  json: () => Promise<ListBoilerplateCategoriesResponse<C>>;
304
317
  };
@@ -334,13 +347,12 @@ declare class UpdateBoilerplateCategory {
334
347
  * @author Dom Webber <dom.webber@greatdetail.com>
335
348
  * @see https://greatdetail.com
336
349
  */
350
+
337
351
  type Channel = {
338
352
  id: string;
339
353
  name?: string;
340
354
  status: "ActiveChannelStatus" | "PotentialChannelStatus";
341
355
  account: string;
342
- createdAt: string;
343
- updatedAt: string;
344
356
  } & ({
345
357
  source: "meta-whatsapp";
346
358
  metaWhatsapp: {
@@ -364,7 +376,7 @@ type Channel = {
364
376
  secretExcerpt: string;
365
377
  }[];
366
378
  };
367
- });
379
+ }) & ResponseTimestamp;
368
380
 
369
381
  type CreateChannelPayload = {
370
382
  name?: string;
@@ -500,15 +512,14 @@ declare class UpdateChannel {
500
512
  * @author Dom Webber <dom.webber@greatdetail.com>
501
513
  * @see https://greatdetail.com
502
514
  */
515
+
503
516
  type CompositionSection = {
504
517
  id: string;
505
518
  account: string;
506
519
  channel: string;
507
520
  location: "header" | "footer";
508
521
  content: string;
509
- createdAt: string;
510
- updatedAt: string;
511
- };
522
+ } & ResponseTimestamp;
512
523
 
513
524
  type CreateCompositionSectionPayload = {
514
525
  account: string;
@@ -635,15 +646,15 @@ declare class GetContactVCFURL {
635
646
  * @author Dom Webber <dom.webber@greatdetail.com>
636
647
  * @see https://greatdetail.com
637
648
  */
649
+
638
650
  type Contact = {
639
651
  id: string;
640
652
  name?: string;
641
653
  emailAddress?: string;
642
654
  telephoneNumber?: string;
655
+ metaWhatsappPhoneNumberID?: string;
643
656
  account: string;
644
- createdAt: string;
645
- updatedAt: string;
646
- };
657
+ } & ResponseTimestamp;
647
658
 
648
659
  type CreateContactPayload = {
649
660
  name: string;
@@ -669,16 +680,16 @@ declare class CreateContact {
669
680
  };
670
681
  }
671
682
 
672
- interface IncludeOptions$4 {
683
+ interface IncludeOptions$5 {
673
684
  messageCount?: boolean;
674
685
  conversationCount?: boolean;
675
686
  [key: string]: boolean | undefined;
676
687
  }
677
- interface GetContactOptions<C extends IncludeOptions$4> {
688
+ interface GetContactOptions<C extends IncludeOptions$5> {
678
689
  include?: C;
679
690
  request?: RequestInit;
680
691
  }
681
- type GetContactResponse<C extends IncludeOptions$4> = {
692
+ type GetContactResponse<C extends IncludeOptions$5> = {
682
693
  data: {
683
694
  contact: Contact;
684
695
  messageCount?: C extends {
@@ -692,7 +703,7 @@ type GetContactResponse<C extends IncludeOptions$4> = {
692
703
  declare class GetContact {
693
704
  protected _transport: FetchTransport;
694
705
  constructor(_transport: FetchTransport);
695
- send<C extends IncludeOptions$4>(id: string, { include, request }?: GetContactOptions<C>): {
706
+ send<C extends IncludeOptions$5>(id: string, { include, request }?: GetContactOptions<C>): {
696
707
  response: () => Promise<ky.KyResponse<GetContactResponse<C>>>;
697
708
  json: () => Promise<GetContactResponse<C>>;
698
709
  };
@@ -764,6 +775,7 @@ declare class UpdateContact {
764
775
  * @author Dom Webber <dom.webber@greatdetail.com>
765
776
  * @see https://greatdetail.com
766
777
  */
778
+
767
779
  type Conversation = {
768
780
  id: string;
769
781
  name?: string;
@@ -771,19 +783,17 @@ type Conversation = {
771
783
  contacts: string[];
772
784
  status: "AwaitingContactConversationStatus" | "AwaitingAgentConversationStatus" | "ResolvedConversationStatus" | "ClosedConversationStatus";
773
785
  channel: string;
774
- createdAt: string;
775
- updatedAt: string;
776
- };
786
+ } & ResponseTimestamp;
777
787
 
778
- interface IncludeOptions$3 {
788
+ interface IncludeOptions$4 {
779
789
  channel?: boolean;
780
790
  [key: string]: boolean | undefined;
781
791
  }
782
- interface GetConversationOptions<C extends IncludeOptions$3> {
792
+ interface GetConversationOptions<C extends IncludeOptions$4> {
783
793
  include?: C;
784
794
  request?: RequestInit;
785
795
  }
786
- type GetConversationResponse<C extends IncludeOptions$3> = {
796
+ type GetConversationResponse<C extends IncludeOptions$4> = {
787
797
  data: {
788
798
  conversation: Conversation;
789
799
  channel: C extends {
@@ -794,7 +804,7 @@ type GetConversationResponse<C extends IncludeOptions$3> = {
794
804
  declare class GetConversation {
795
805
  protected _transport: FetchTransport;
796
806
  constructor(_transport: FetchTransport);
797
- send<C extends IncludeOptions$3>(id: string, { include, request }?: GetConversationOptions<C>): {
807
+ send<C extends IncludeOptions$4>(id: string, { include, request }?: GetConversationOptions<C>): {
798
808
  response: () => Promise<ky.KyResponse<GetConversationResponse<C>>>;
799
809
  json: () => Promise<GetConversationResponse<C>>;
800
810
  };
@@ -825,6 +835,7 @@ declare class ListContactConversations {
825
835
  * @author Dom Webber <dom.webber@greatdetail.com>
826
836
  * @see https://greatdetail.com
827
837
  */
838
+
828
839
  type Message = {
829
840
  id: string;
830
841
  role: "user" | "assistant";
@@ -839,8 +850,6 @@ type Message = {
839
850
  createdAt: string;
840
851
  updatedAt?: string;
841
852
  }[];
842
- createdAt: string;
843
- updatedAt: string;
844
853
  } & ({
845
854
  type: "text";
846
855
  messageText: {
@@ -853,19 +862,19 @@ type Message = {
853
862
  };
854
863
  } | {
855
864
  type: "richtext";
856
- });
865
+ }) & ResponseTimestamp;
857
866
 
858
- interface IncludeOptions$2 {
867
+ interface IncludeOptions$3 {
859
868
  latestMessage?: boolean;
860
869
  [key: string]: boolean | undefined;
861
870
  }
862
871
  type FilterOptions = "unresolved" | "awaitingContact" | "awaitingAgent" | (string & NonNullable<unknown>);
863
- interface ListConversationOptions<C extends IncludeOptions$2> {
872
+ interface ListConversationOptions<C extends IncludeOptions$3> {
864
873
  filter?: FilterOptions;
865
874
  include?: C;
866
875
  request?: RequestInit;
867
876
  }
868
- type ListConversationsResponse<C extends IncludeOptions$2> = {
877
+ type ListConversationsResponse<C extends IncludeOptions$3> = {
869
878
  data: {
870
879
  conversation: Conversation;
871
880
  latestMessage?: C extends {
@@ -876,7 +885,7 @@ type ListConversationsResponse<C extends IncludeOptions$2> = {
876
885
  declare class ListConversations {
877
886
  protected _transport: FetchTransport;
878
887
  constructor(_transport: FetchTransport);
879
- send<C extends IncludeOptions$2>({ filter, include, request, }?: ListConversationOptions<C>): {
888
+ send<C extends IncludeOptions$3>({ filter, include, request, }?: ListConversationOptions<C>): {
880
889
  response: () => Promise<ky.KyResponse<ListConversationsResponse<C>>>;
881
890
  json: () => Promise<ListConversationsResponse<C>>;
882
891
  };
@@ -929,14 +938,13 @@ declare class UpdateConversation {
929
938
  * @author Dom Webber <dom.webber@greatdetail.com>
930
939
  * @see https://greatdetail.com
931
940
  */
941
+
932
942
  type Label = {
933
943
  id: string;
934
944
  title: string;
935
945
  description?: string;
936
946
  account: string;
937
- createdAt: string;
938
- updatedAt: string;
939
- };
947
+ } & ResponseTimestamp;
940
948
 
941
949
  type CreateLabelPayload = {
942
950
  title: string;
@@ -1008,17 +1016,17 @@ declare class ListConversationLabels {
1008
1016
  };
1009
1017
  }
1010
1018
 
1011
- interface IncludeOptions$1 {
1019
+ interface IncludeOptions$2 {
1012
1020
  contactCount?: boolean;
1013
1021
  conversationCount?: boolean;
1014
1022
  [key: string]: boolean | undefined;
1015
1023
  }
1016
- interface ListLabelsOptions<C extends IncludeOptions$1> {
1024
+ interface ListLabelsOptions<C extends IncludeOptions$2> {
1017
1025
  query?: string;
1018
1026
  include?: C;
1019
1027
  request?: RequestInit;
1020
1028
  }
1021
- type ListLabelsResponse<C extends IncludeOptions$1> = {
1029
+ type ListLabelsResponse<C extends IncludeOptions$2> = {
1022
1030
  data: {
1023
1031
  label: Label;
1024
1032
  contactCount?: C extends {
@@ -1032,7 +1040,7 @@ type ListLabelsResponse<C extends IncludeOptions$1> = {
1032
1040
  declare class ListLabels {
1033
1041
  protected _transport: FetchTransport;
1034
1042
  constructor(_transport: FetchTransport);
1035
- send<C extends IncludeOptions$1>({ query, include, request, }?: ListLabelsOptions<C>): {
1043
+ send<C extends IncludeOptions$2>({ query, include, request, }?: ListLabelsOptions<C>): {
1036
1044
  response: () => Promise<ky.KyResponse<ListLabelsResponse<C>>>;
1037
1045
  json: () => Promise<ListLabelsResponse<C>>;
1038
1046
  };
@@ -1077,15 +1085,15 @@ declare class ListChannelMessages {
1077
1085
  };
1078
1086
  }
1079
1087
 
1080
- interface IncludeOptions {
1088
+ interface IncludeOptions$1 {
1081
1089
  contact?: boolean;
1082
1090
  [key: string]: boolean | undefined;
1083
1091
  }
1084
- interface ListConversationMessagesOptions<C extends IncludeOptions> {
1092
+ interface ListConversationMessagesOptions<C extends IncludeOptions$1> {
1085
1093
  include?: C;
1086
1094
  request?: RequestInit;
1087
1095
  }
1088
- type ListConversationMessagesResponse<C extends IncludeOptions> = {
1096
+ type ListConversationMessagesResponse<C extends IncludeOptions$1> = {
1089
1097
  data: {
1090
1098
  message: Message;
1091
1099
  contact?: C extends {
@@ -1096,26 +1104,34 @@ type ListConversationMessagesResponse<C extends IncludeOptions> = {
1096
1104
  declare class ListConversationMessages {
1097
1105
  protected _transport: FetchTransport;
1098
1106
  constructor(_transport: FetchTransport);
1099
- send<C extends IncludeOptions>(id: string, { include, request }?: ListConversationMessagesOptions<C>): {
1107
+ send<C extends IncludeOptions$1>(id: string, { include, request }?: ListConversationMessagesOptions<C>): {
1100
1108
  response: () => Promise<ky.KyResponse<ListConversationMessagesResponse<C>>>;
1101
1109
  json: () => Promise<ListConversationMessagesResponse<C>>;
1102
1110
  };
1103
1111
  }
1104
1112
 
1105
- interface ListMessagesOptions {
1113
+ interface IncludeOptions {
1114
+ contact?: boolean;
1115
+ [key: string]: boolean | undefined;
1116
+ }
1117
+ interface ListMessagesOptions<C extends IncludeOptions> {
1118
+ include?: C;
1106
1119
  request?: RequestInit;
1107
1120
  }
1108
- type ListMessagesResponse = {
1121
+ type ListMessagesResponse<C extends IncludeOptions> = {
1109
1122
  data: {
1110
1123
  message: Message;
1124
+ contact?: C extends {
1125
+ contact: true;
1126
+ } ? Contact : never;
1111
1127
  }[];
1112
1128
  };
1113
1129
  declare class ListMessages {
1114
1130
  protected _transport: FetchTransport;
1115
1131
  constructor(_transport: FetchTransport);
1116
- send({ request }?: ListMessagesOptions): {
1117
- response: () => Promise<ky.KyResponse<ListMessagesResponse>>;
1118
- json: () => Promise<ListMessagesResponse>;
1132
+ send<C extends IncludeOptions>({ include, request, }?: ListMessagesOptions<C>): {
1133
+ response: () => Promise<ky.KyResponse<ListMessagesResponse<C>>>;
1134
+ json: () => Promise<ListMessagesResponse<C>>;
1119
1135
  };
1120
1136
  }
1121
1137
 
@@ -1220,12 +1236,11 @@ declare class CreateResponseModel {
1220
1236
  * @author Dom Webber <dom.webber@greatdetail.com>
1221
1237
  * @see https://greatdetail.com
1222
1238
  */
1239
+
1223
1240
  type Note = {
1224
1241
  id: string;
1225
1242
  content: string;
1226
- createdAt: string;
1227
- updatedAt: string;
1228
- };
1243
+ } & ResponseTimestamp;
1229
1244
 
1230
1245
  type CreateContactNotePayload = {
1231
1246
  content: string;
@@ -1349,11 +1364,10 @@ declare class UpdateNote {
1349
1364
  * @author Dom Webber <dom.webber@greatdetail.com>
1350
1365
  * @see https://greatdetail.com
1351
1366
  */
1367
+
1352
1368
  type NotificationSubscription = {
1353
1369
  id: string;
1354
- createdAt: string;
1355
- updatedAt: string;
1356
- };
1370
+ } & ResponseTimestamp;
1357
1371
 
1358
1372
  type CreateContactNotificationSubscriptionPayload = {
1359
1373
  type: "vapid";
@@ -1441,6 +1455,7 @@ declare class ListSources {
1441
1455
  * @author Dom Webber <dom.webber@greatdetail.com>
1442
1456
  * @see https://greatdetail.com
1443
1457
  */
1458
+
1444
1459
  type Upload = {
1445
1460
  id: string;
1446
1461
  name: string;
@@ -1448,7 +1463,7 @@ type Upload = {
1448
1463
  contentSize: number;
1449
1464
  encodingFormat: string;
1450
1465
  sha256: string;
1451
- };
1466
+ } & ResponseTimestamp;
1452
1467
 
1453
1468
  interface CreateUploadOptions {
1454
1469
  account: string;