@lorikeetai/node-sdk 0.13.2 → 1.0.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 (202) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/README.md +17 -32
  3. package/core.d.ts +7 -4
  4. package/core.d.ts.map +1 -1
  5. package/core.js +16 -9
  6. package/core.js.map +1 -1
  7. package/core.mjs +16 -9
  8. package/core.mjs.map +1 -1
  9. package/index.d.mts +21 -3
  10. package/index.d.ts +21 -3
  11. package/index.d.ts.map +1 -1
  12. package/index.js +31 -7
  13. package/index.js.map +1 -1
  14. package/index.mjs +32 -8
  15. package/index.mjs.map +1 -1
  16. package/internal/qs/formats.d.ts +6 -0
  17. package/internal/qs/formats.d.ts.map +1 -0
  18. package/internal/qs/formats.js +11 -0
  19. package/internal/qs/formats.js.map +1 -0
  20. package/internal/qs/formats.mjs +8 -0
  21. package/internal/qs/formats.mjs.map +1 -0
  22. package/internal/qs/index.d.ts +10 -0
  23. package/internal/qs/index.d.ts.map +1 -0
  24. package/internal/qs/index.js +14 -0
  25. package/internal/qs/index.js.map +1 -0
  26. package/internal/qs/index.mjs +10 -0
  27. package/internal/qs/index.mjs.map +1 -0
  28. package/internal/qs/stringify.d.ts +3 -0
  29. package/internal/qs/stringify.d.ts.map +1 -0
  30. package/internal/qs/stringify.js +279 -0
  31. package/internal/qs/stringify.js.map +1 -0
  32. package/internal/qs/stringify.mjs +276 -0
  33. package/internal/qs/stringify.mjs.map +1 -0
  34. package/internal/qs/types.d.ts +57 -0
  35. package/internal/qs/types.d.ts.map +1 -0
  36. package/internal/qs/types.js +3 -0
  37. package/internal/qs/types.js.map +1 -0
  38. package/internal/qs/types.mjs +2 -0
  39. package/internal/qs/types.mjs.map +1 -0
  40. package/internal/qs/utils.d.ts +14 -0
  41. package/internal/qs/utils.d.ts.map +1 -0
  42. package/internal/qs/utils.js +229 -0
  43. package/internal/qs/utils.js.map +1 -0
  44. package/internal/qs/utils.mjs +217 -0
  45. package/internal/qs/utils.mjs.map +1 -0
  46. package/package.json +1 -5
  47. package/resource.d.ts +1 -1
  48. package/resource.d.ts.map +1 -1
  49. package/resource.js.map +1 -1
  50. package/resource.mjs.map +1 -1
  51. package/resources/conversation/chat.d.ts +19 -164
  52. package/resources/conversation/chat.d.ts.map +1 -1
  53. package/resources/conversation/chat.js.map +1 -1
  54. package/resources/conversation/chat.mjs.map +1 -1
  55. package/resources/conversation/conversation.d.ts +116 -0
  56. package/resources/conversation/conversation.d.ts.map +1 -1
  57. package/resources/conversation/conversation.js +36 -0
  58. package/resources/conversation/conversation.js.map +1 -1
  59. package/resources/conversation/conversation.mjs +36 -0
  60. package/resources/conversation/conversation.mjs.map +1 -1
  61. package/resources/conversation/email.d.ts +19 -164
  62. package/resources/conversation/email.d.ts.map +1 -1
  63. package/resources/conversation/email.js.map +1 -1
  64. package/resources/conversation/email.mjs.map +1 -1
  65. package/resources/conversation/index.d.ts +1 -1
  66. package/resources/conversation/index.d.ts.map +1 -1
  67. package/resources/conversation/index.js.map +1 -1
  68. package/resources/conversation/index.mjs +1 -1
  69. package/resources/conversation/index.mjs.map +1 -1
  70. package/resources/customer/customer.d.ts +296 -0
  71. package/resources/customer/customer.d.ts.map +1 -0
  72. package/resources/customer/customer.js +79 -0
  73. package/resources/customer/customer.js.map +1 -0
  74. package/resources/customer/customer.mjs +52 -0
  75. package/resources/customer/customer.mjs.map +1 -0
  76. package/resources/customer/index.d.ts +3 -0
  77. package/resources/customer/index.d.ts.map +1 -0
  78. package/resources/customer/index.js +9 -0
  79. package/resources/customer/index.js.map +1 -0
  80. package/resources/customer/index.mjs +4 -0
  81. package/resources/customer/index.mjs.map +1 -0
  82. package/resources/customer/profile.d.ts +71 -0
  83. package/resources/customer/profile.d.ts.map +1 -0
  84. package/resources/customer/profile.js +21 -0
  85. package/resources/customer/profile.js.map +1 -0
  86. package/resources/customer/profile.mjs +17 -0
  87. package/resources/customer/profile.mjs.map +1 -0
  88. package/resources/customer.d.ts +1 -291
  89. package/resources/customer.d.ts.map +1 -1
  90. package/resources/customer.js +15 -45
  91. package/resources/customer.js.map +1 -1
  92. package/resources/customer.mjs +1 -43
  93. package/resources/customer.mjs.map +1 -1
  94. package/resources/file.d.ts +7 -0
  95. package/resources/file.d.ts.map +1 -0
  96. package/resources/file.js +21 -0
  97. package/resources/file.js.map +1 -0
  98. package/resources/file.mjs +17 -0
  99. package/resources/file.mjs.map +1 -0
  100. package/resources/index.d.ts +6 -2
  101. package/resources/index.d.ts.map +1 -1
  102. package/resources/index.js +10 -2
  103. package/resources/index.js.map +1 -1
  104. package/resources/index.mjs +6 -2
  105. package/resources/index.mjs.map +1 -1
  106. package/resources/ingest.d.ts +2 -0
  107. package/resources/ingest.d.ts.map +1 -1
  108. package/resources/ingest.js +9 -0
  109. package/resources/ingest.js.map +1 -1
  110. package/resources/ingest.mjs +9 -0
  111. package/resources/ingest.mjs.map +1 -1
  112. package/resources/oauth/authorization.d.ts +6 -0
  113. package/resources/oauth/authorization.d.ts.map +1 -0
  114. package/resources/oauth/authorization.js +15 -0
  115. package/resources/oauth/authorization.js.map +1 -0
  116. package/resources/oauth/authorization.mjs +11 -0
  117. package/resources/oauth/authorization.mjs.map +1 -0
  118. package/resources/oauth/index.d.ts +3 -0
  119. package/resources/oauth/index.d.ts.map +1 -0
  120. package/resources/oauth/index.js +9 -0
  121. package/resources/oauth/index.js.map +1 -0
  122. package/resources/oauth/index.mjs +4 -0
  123. package/resources/oauth/index.mjs.map +1 -0
  124. package/resources/oauth/oauth.d.ts +24 -0
  125. package/resources/oauth/oauth.d.ts.map +1 -0
  126. package/resources/oauth/oauth.js +65 -0
  127. package/resources/oauth/oauth.js.map +1 -0
  128. package/resources/oauth/oauth.mjs +38 -0
  129. package/resources/oauth/oauth.mjs.map +1 -0
  130. package/resources/oauth.d.ts +2 -0
  131. package/resources/oauth.d.ts.map +1 -0
  132. package/resources/oauth.js +19 -0
  133. package/resources/oauth.js.map +1 -0
  134. package/resources/oauth.mjs +3 -0
  135. package/resources/oauth.mjs.map +1 -0
  136. package/resources/suggestion.d.ts +7 -0
  137. package/resources/suggestion.d.ts.map +1 -0
  138. package/resources/suggestion.js +21 -0
  139. package/resources/suggestion.js.map +1 -0
  140. package/resources/suggestion.mjs +17 -0
  141. package/resources/suggestion.mjs.map +1 -0
  142. package/resources/ticket.d.ts +14 -0
  143. package/resources/ticket.d.ts.map +1 -0
  144. package/resources/ticket.js +16 -0
  145. package/resources/ticket.js.map +1 -0
  146. package/resources/ticket.mjs +12 -0
  147. package/resources/ticket.mjs.map +1 -0
  148. package/resources/top-level.d.ts +2 -0
  149. package/resources/top-level.d.ts.map +1 -0
  150. package/resources/top-level.js +4 -0
  151. package/resources/top-level.js.map +1 -0
  152. package/resources/top-level.mjs +3 -0
  153. package/resources/top-level.mjs.map +1 -0
  154. package/resources/webhooks.d.ts +6 -0
  155. package/resources/webhooks.d.ts.map +1 -0
  156. package/resources/webhooks.js +15 -0
  157. package/resources/webhooks.js.map +1 -0
  158. package/resources/webhooks.mjs +11 -0
  159. package/resources/webhooks.mjs.map +1 -0
  160. package/resources/workflow.d.ts +1 -0
  161. package/resources/workflow.d.ts.map +1 -1
  162. package/resources/workflow.js +3 -0
  163. package/resources/workflow.js.map +1 -1
  164. package/resources/workflow.mjs +3 -0
  165. package/resources/workflow.mjs.map +1 -1
  166. package/src/core.ts +17 -8
  167. package/src/index.ts +73 -10
  168. package/src/internal/qs/LICENSE.md +13 -0
  169. package/src/internal/qs/README.md +3 -0
  170. package/src/internal/qs/formats.ts +9 -0
  171. package/src/internal/qs/index.ts +13 -0
  172. package/src/internal/qs/stringify.ts +388 -0
  173. package/src/internal/qs/types.ts +71 -0
  174. package/src/internal/qs/utils.ts +265 -0
  175. package/src/resource.ts +1 -1
  176. package/src/resources/conversation/chat.ts +21 -217
  177. package/src/resources/conversation/conversation.ts +175 -0
  178. package/src/resources/conversation/email.ts +21 -217
  179. package/src/resources/conversation/index.ts +10 -1
  180. package/src/resources/customer/customer.ts +386 -0
  181. package/src/resources/customer/index.ts +13 -0
  182. package/src/resources/customer/profile.ts +89 -0
  183. package/src/resources/customer.ts +1 -372
  184. package/src/resources/file.ts +20 -0
  185. package/src/resources/index.ts +15 -2
  186. package/src/resources/ingest.ts +17 -0
  187. package/src/resources/oauth/authorization.ts +13 -0
  188. package/src/resources/oauth/index.ts +4 -0
  189. package/src/resources/oauth/oauth.ts +63 -0
  190. package/src/resources/oauth.ts +3 -0
  191. package/src/resources/suggestion.ts +20 -0
  192. package/src/resources/ticket.ts +30 -0
  193. package/src/resources/top-level.ts +3 -0
  194. package/src/resources/webhooks.ts +13 -0
  195. package/src/resources/workflow.ts +4 -0
  196. package/src/version.ts +1 -1
  197. package/version.d.ts +1 -1
  198. package/version.d.ts.map +1 -1
  199. package/version.js +1 -1
  200. package/version.js.map +1 -1
  201. package/version.mjs +1 -1
  202. package/version.mjs.map +1 -1
@@ -0,0 +1,265 @@
1
+ import { RFC1738 } from './formats';
2
+ import type { DefaultEncoder, Format } from './types';
3
+
4
+ const has = Object.prototype.hasOwnProperty;
5
+ const is_array = Array.isArray;
6
+
7
+ const hex_table = (() => {
8
+ const array = [];
9
+ for (let i = 0; i < 256; ++i) {
10
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
11
+ }
12
+
13
+ return array;
14
+ })();
15
+
16
+ function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
17
+ while (queue.length > 1) {
18
+ const item = queue.pop();
19
+ if (!item) continue;
20
+
21
+ const obj = item.obj[item.prop];
22
+
23
+ if (is_array(obj)) {
24
+ const compacted: unknown[] = [];
25
+
26
+ for (let j = 0; j < obj.length; ++j) {
27
+ if (typeof obj[j] !== 'undefined') {
28
+ compacted.push(obj[j]);
29
+ }
30
+ }
31
+
32
+ // @ts-ignore
33
+ item.obj[item.prop] = compacted;
34
+ }
35
+ }
36
+ }
37
+
38
+ function array_to_object(source: any[], options: { plainObjects: boolean }) {
39
+ const obj = options && options.plainObjects ? Object.create(null) : {};
40
+ for (let i = 0; i < source.length; ++i) {
41
+ if (typeof source[i] !== 'undefined') {
42
+ obj[i] = source[i];
43
+ }
44
+ }
45
+
46
+ return obj;
47
+ }
48
+
49
+ export function merge(
50
+ target: any,
51
+ source: any,
52
+ options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
53
+ ) {
54
+ if (!source) {
55
+ return target;
56
+ }
57
+
58
+ if (typeof source !== 'object') {
59
+ if (is_array(target)) {
60
+ target.push(source);
61
+ } else if (target && typeof target === 'object') {
62
+ if (
63
+ (options && (options.plainObjects || options.allowPrototypes)) ||
64
+ !has.call(Object.prototype, source)
65
+ ) {
66
+ target[source] = true;
67
+ }
68
+ } else {
69
+ return [target, source];
70
+ }
71
+
72
+ return target;
73
+ }
74
+
75
+ if (!target || typeof target !== 'object') {
76
+ return [target].concat(source);
77
+ }
78
+
79
+ let mergeTarget = target;
80
+ if (is_array(target) && !is_array(source)) {
81
+ // @ts-ignore
82
+ mergeTarget = array_to_object(target, options);
83
+ }
84
+
85
+ if (is_array(target) && is_array(source)) {
86
+ source.forEach(function (item, i) {
87
+ if (has.call(target, i)) {
88
+ const targetItem = target[i];
89
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
90
+ target[i] = merge(targetItem, item, options);
91
+ } else {
92
+ target.push(item);
93
+ }
94
+ } else {
95
+ target[i] = item;
96
+ }
97
+ });
98
+ return target;
99
+ }
100
+
101
+ return Object.keys(source).reduce(function (acc, key) {
102
+ const value = source[key];
103
+
104
+ if (has.call(acc, key)) {
105
+ acc[key] = merge(acc[key], value, options);
106
+ } else {
107
+ acc[key] = value;
108
+ }
109
+ return acc;
110
+ }, mergeTarget);
111
+ }
112
+
113
+ export function assign_single_source(target: any, source: any) {
114
+ return Object.keys(source).reduce(function (acc, key) {
115
+ acc[key] = source[key];
116
+ return acc;
117
+ }, target);
118
+ }
119
+
120
+ export function decode(str: string, _: any, charset: string) {
121
+ const strWithoutPlus = str.replace(/\+/g, ' ');
122
+ if (charset === 'iso-8859-1') {
123
+ // unescape never throws, no try...catch needed:
124
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
125
+ }
126
+ // utf-8
127
+ try {
128
+ return decodeURIComponent(strWithoutPlus);
129
+ } catch (e) {
130
+ return strWithoutPlus;
131
+ }
132
+ }
133
+
134
+ const limit = 1024;
135
+
136
+ export const encode: (
137
+ str: any,
138
+ defaultEncoder: DefaultEncoder,
139
+ charset: string,
140
+ type: 'key' | 'value',
141
+ format: Format,
142
+ ) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
143
+ // This code was originally written by Brian White for the io.js core querystring library.
144
+ // It has been adapted here for stricter adherence to RFC 3986
145
+ if (str.length === 0) {
146
+ return str;
147
+ }
148
+
149
+ let string = str;
150
+ if (typeof str === 'symbol') {
151
+ string = Symbol.prototype.toString.call(str);
152
+ } else if (typeof str !== 'string') {
153
+ string = String(str);
154
+ }
155
+
156
+ if (charset === 'iso-8859-1') {
157
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
158
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
159
+ });
160
+ }
161
+
162
+ let out = '';
163
+ for (let j = 0; j < string.length; j += limit) {
164
+ const segment = string.length >= limit ? string.slice(j, j + limit) : string;
165
+ const arr = [];
166
+
167
+ for (let i = 0; i < segment.length; ++i) {
168
+ let c = segment.charCodeAt(i);
169
+ if (
170
+ c === 0x2d || // -
171
+ c === 0x2e || // .
172
+ c === 0x5f || // _
173
+ c === 0x7e || // ~
174
+ (c >= 0x30 && c <= 0x39) || // 0-9
175
+ (c >= 0x41 && c <= 0x5a) || // a-z
176
+ (c >= 0x61 && c <= 0x7a) || // A-Z
177
+ (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
178
+ ) {
179
+ arr[arr.length] = segment.charAt(i);
180
+ continue;
181
+ }
182
+
183
+ if (c < 0x80) {
184
+ arr[arr.length] = hex_table[c];
185
+ continue;
186
+ }
187
+
188
+ if (c < 0x800) {
189
+ arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
190
+ continue;
191
+ }
192
+
193
+ if (c < 0xd800 || c >= 0xe000) {
194
+ arr[arr.length] =
195
+ hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
196
+ continue;
197
+ }
198
+
199
+ i += 1;
200
+ c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
201
+
202
+ arr[arr.length] =
203
+ hex_table[0xf0 | (c >> 18)]! +
204
+ hex_table[0x80 | ((c >> 12) & 0x3f)] +
205
+ hex_table[0x80 | ((c >> 6) & 0x3f)] +
206
+ hex_table[0x80 | (c & 0x3f)];
207
+ }
208
+
209
+ out += arr.join('');
210
+ }
211
+
212
+ return out;
213
+ };
214
+
215
+ export function compact(value: any) {
216
+ const queue = [{ obj: { o: value }, prop: 'o' }];
217
+ const refs = [];
218
+
219
+ for (let i = 0; i < queue.length; ++i) {
220
+ const item = queue[i];
221
+ // @ts-ignore
222
+ const obj = item.obj[item.prop];
223
+
224
+ const keys = Object.keys(obj);
225
+ for (let j = 0; j < keys.length; ++j) {
226
+ const key = keys[j]!;
227
+ const val = obj[key];
228
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
229
+ queue.push({ obj: obj, prop: key });
230
+ refs.push(val);
231
+ }
232
+ }
233
+ }
234
+
235
+ compact_queue(queue);
236
+
237
+ return value;
238
+ }
239
+
240
+ export function is_regexp(obj: any) {
241
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
242
+ }
243
+
244
+ export function is_buffer(obj: any) {
245
+ if (!obj || typeof obj !== 'object') {
246
+ return false;
247
+ }
248
+
249
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
250
+ }
251
+
252
+ export function combine(a: any, b: any) {
253
+ return [].concat(a, b);
254
+ }
255
+
256
+ export function maybe_map<T>(val: T[], fn: (v: T) => T) {
257
+ if (is_array(val)) {
258
+ const mapped = [];
259
+ for (let i = 0; i < val.length; i += 1) {
260
+ mapped.push(fn(val[i]!));
261
+ }
262
+ return mapped;
263
+ }
264
+ return fn(val);
265
+ }
package/src/resource.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import type { Lorikeet } from './index';
4
4
 
5
- export class APIResource {
5
+ export abstract class APIResource {
6
6
  protected _client: Lorikeet;
7
7
 
8
8
  constructor(client: Lorikeet) {
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../resource';
4
4
  import * as Core from '../../core';
5
5
  import { pollUntil } from "../../lib/poll-until";
6
+ import * as ConversationAPI from './conversation';
6
7
 
7
8
  export class Chat extends APIResource {
8
9
  /**
@@ -140,7 +141,7 @@ export interface ChatGenerateResponse {
140
141
  * The events that have occurred in the conversation. Can be used for deriving more
141
142
  * information about the conversation.
142
143
  */
143
- events: Array<ChatGenerateResponse.Event>;
144
+ events: Array<ConversationAPI.TicketEvent>;
144
145
 
145
146
  /**
146
147
  * The latest message type - useful for polling
@@ -155,101 +156,24 @@ export interface ChatGenerateResponse {
155
156
  /**
156
157
  * The full list of messages. This endpoint supports markdown.
157
158
  */
158
- messages: Array<ChatGenerateResponse.Message>;
159
+ messages: Array<ConversationAPI.TicketMessageDto>;
159
160
 
160
161
  /**
161
162
  * The status of the conversation
162
163
  */
163
164
  status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
164
165
 
166
+ /**
167
+ * The tags of the conversation
168
+ */
169
+ tags: Array<string>;
170
+
165
171
  /**
166
172
  * The timestamp of when the ticket was last updated in our system.
167
173
  */
168
174
  updatedAt: string;
169
175
  }
170
176
 
171
- export namespace ChatGenerateResponse {
172
- export interface Event {
173
- /**
174
- * The ID of the event
175
- */
176
- id: string;
177
-
178
- /**
179
- * The timestamp of the event
180
- */
181
- createdAt: string;
182
-
183
- /**
184
- * Any specific data associated with the event
185
- */
186
- data: unknown;
187
-
188
- /**
189
- * The type of the event
190
- */
191
- type:
192
- | 'ASSIGNED'
193
- | 'CLOSED'
194
- | 'ESCALATED'
195
- | 'ESCALATION_REQUEST'
196
- | 'PROCESSING_CANCELLED'
197
- | 'HOSTILE_MESSAGE'
198
- | 'NEW_TICKET';
199
- }
200
-
201
- export interface Message {
202
- /**
203
- * The ID of the conversation message
204
- */
205
- id: string;
206
-
207
- /**
208
- * Attachments that were attached to the message
209
- */
210
- attachments: Array<Message.Attachment>;
211
-
212
- /**
213
- * The content of the message. Markdown on plain text.
214
- */
215
- content: string;
216
-
217
- /**
218
- * The timestamp of the message.
219
- */
220
- createdAt: string;
221
-
222
- /**
223
- * The raw content of the message. Usually HTML.
224
- */
225
- rawContent: string;
226
-
227
- /**
228
- * The type of the message
229
- */
230
- type: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
231
- }
232
-
233
- export namespace Message {
234
- export interface Attachment {
235
- /**
236
- * The name of the attachment
237
- */
238
- name: string;
239
-
240
- /**
241
- * The type of the attachment
242
- */
243
- type: string;
244
-
245
- /**
246
- * The URL of the attachment
247
- */
248
- url: string;
249
- }
250
- }
251
- }
252
-
253
177
  export interface ChatGetResponse {
254
178
  /**
255
179
  * The ID of the conversation
@@ -265,7 +189,7 @@ export interface ChatGetResponse {
265
189
  * The events that have occurred in the conversation. Can be used for deriving more
266
190
  * information about the conversation.
267
191
  */
268
- events: Array<ChatGetResponse.Event>;
192
+ events: Array<ConversationAPI.TicketEvent>;
269
193
 
270
194
  /**
271
195
  * The latest message type - useful for polling
@@ -280,101 +204,24 @@ export interface ChatGetResponse {
280
204
  /**
281
205
  * The full list of messages. This endpoint supports markdown.
282
206
  */
283
- messages: Array<ChatGetResponse.Message>;
207
+ messages: Array<ConversationAPI.TicketMessageDto>;
284
208
 
285
209
  /**
286
210
  * The status of the conversation
287
211
  */
288
212
  status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
289
213
 
214
+ /**
215
+ * The tags of the conversation
216
+ */
217
+ tags: Array<string>;
218
+
290
219
  /**
291
220
  * The timestamp of when the ticket was last updated in our system.
292
221
  */
293
222
  updatedAt: string;
294
223
  }
295
224
 
296
- export namespace ChatGetResponse {
297
- export interface Event {
298
- /**
299
- * The ID of the event
300
- */
301
- id: string;
302
-
303
- /**
304
- * The timestamp of the event
305
- */
306
- createdAt: string;
307
-
308
- /**
309
- * Any specific data associated with the event
310
- */
311
- data: unknown;
312
-
313
- /**
314
- * The type of the event
315
- */
316
- type:
317
- | 'ASSIGNED'
318
- | 'CLOSED'
319
- | 'ESCALATED'
320
- | 'ESCALATION_REQUEST'
321
- | 'PROCESSING_CANCELLED'
322
- | 'HOSTILE_MESSAGE'
323
- | 'NEW_TICKET';
324
- }
325
-
326
- export interface Message {
327
- /**
328
- * The ID of the conversation message
329
- */
330
- id: string;
331
-
332
- /**
333
- * Attachments that were attached to the message
334
- */
335
- attachments: Array<Message.Attachment>;
336
-
337
- /**
338
- * The content of the message. Markdown on plain text.
339
- */
340
- content: string;
341
-
342
- /**
343
- * The timestamp of the message.
344
- */
345
- createdAt: string;
346
-
347
- /**
348
- * The raw content of the message. Usually HTML.
349
- */
350
- rawContent: string;
351
-
352
- /**
353
- * The type of the message
354
- */
355
- type: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
356
- }
357
-
358
- export namespace Message {
359
- export interface Attachment {
360
- /**
361
- * The name of the attachment
362
- */
363
- name: string;
364
-
365
- /**
366
- * The type of the attachment
367
- */
368
- type: string;
369
-
370
- /**
371
- * The URL of the attachment
372
- */
373
- url: string;
374
- }
375
- }
376
- }
377
-
378
225
  export interface ChatStartResponse {
379
226
  /**
380
227
  * The ID of the conversation
@@ -390,7 +237,7 @@ export interface ChatStartResponse {
390
237
  * The events that have occurred in the conversation. Can be used for deriving more
391
238
  * information about the conversation.
392
239
  */
393
- events: Array<ChatStartResponse.Event>;
240
+ events: Array<ConversationAPI.TicketEvent>;
394
241
 
395
242
  /**
396
243
  * The url of the conversation in the Lorikeet dashboard
@@ -401,44 +248,18 @@ export interface ChatStartResponse {
401
248
  * The status of the conversation
402
249
  */
403
250
  status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
404
- }
405
-
406
- export namespace ChatStartResponse {
407
- export interface Event {
408
- /**
409
- * The ID of the event
410
- */
411
- id: string;
412
-
413
- /**
414
- * The timestamp of the event
415
- */
416
- createdAt: string;
417
251
 
418
- /**
419
- * Any specific data associated with the event
420
- */
421
- data: unknown;
422
-
423
- /**
424
- * The type of the event
425
- */
426
- type:
427
- | 'ASSIGNED'
428
- | 'CLOSED'
429
- | 'ESCALATED'
430
- | 'ESCALATION_REQUEST'
431
- | 'PROCESSING_CANCELLED'
432
- | 'HOSTILE_MESSAGE'
433
- | 'NEW_TICKET';
434
- }
252
+ /**
253
+ * The tags of the conversation
254
+ */
255
+ tags: Array<string>;
435
256
  }
436
257
 
437
258
  export interface ChatGenerateParams {
438
259
  /**
439
260
  * Attachments to be sent with the message
440
261
  */
441
- attachments: Array<ChatGenerateParams.Attachment>;
262
+ attachments: Array<ConversationAPI.AttachmentDto>;
442
263
 
443
264
  /**
444
265
  * The ID of the conversation
@@ -458,23 +279,6 @@ export interface ChatGenerateParams {
458
279
  }
459
280
 
460
281
  export namespace ChatGenerateParams {
461
- export interface Attachment {
462
- /**
463
- * The name of the attachment
464
- */
465
- name: string;
466
-
467
- /**
468
- * The type of the attachment
469
- */
470
- type: string;
471
-
472
- /**
473
- * The URL of the attachment
474
- */
475
- url: string;
476
- }
477
-
478
282
  /**
479
283
  * Any additional customer information, that has changed in the course of the
480
284
  * conversation.