@lorikeetai/node-sdk 0.1.0-alpha.2 → 0.1.0-alpha.7

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 (211) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +26 -21
  3. package/_shims/MultipartBody.js.map +1 -1
  4. package/_shims/MultipartBody.mjs.map +1 -1
  5. package/_shims/auto/runtime-bun.d.ts.map +1 -1
  6. package/_shims/auto/runtime-bun.js.map +1 -1
  7. package/_shims/auto/runtime-node.d.ts.map +1 -1
  8. package/_shims/auto/runtime-node.js.map +1 -1
  9. package/_shims/auto/runtime.d.ts.map +1 -1
  10. package/_shims/auto/runtime.js.map +1 -1
  11. package/_shims/auto/types-node.d.ts.map +1 -1
  12. package/_shims/auto/types-node.js.map +1 -1
  13. package/_shims/auto/types.d.ts +52 -52
  14. package/_shims/bun-runtime.d.ts.map +1 -1
  15. package/_shims/bun-runtime.js +1 -2
  16. package/_shims/bun-runtime.js.map +1 -1
  17. package/_shims/bun-runtime.mjs.map +1 -1
  18. package/_shims/index.d.ts +36 -36
  19. package/_shims/index.js +5 -5
  20. package/_shims/index.mjs +4 -4
  21. package/_shims/node-runtime.d.ts.map +1 -1
  22. package/_shims/node-runtime.js +1 -2
  23. package/_shims/node-runtime.js.map +1 -1
  24. package/_shims/node-runtime.mjs.map +1 -1
  25. package/_shims/node-types.d.ts +27 -27
  26. package/_shims/registry.d.ts.map +1 -1
  27. package/_shims/registry.js +2 -2
  28. package/_shims/registry.js.map +1 -1
  29. package/_shims/registry.mjs.map +1 -1
  30. package/_shims/web-runtime.d.ts.map +1 -1
  31. package/_shims/web-runtime.js +1 -2
  32. package/_shims/web-runtime.js.map +1 -1
  33. package/_shims/web-runtime.mjs.map +1 -1
  34. package/_shims/web-types.d.ts +52 -52
  35. package/core.d.ts +2 -4
  36. package/core.d.ts.map +1 -1
  37. package/core.js +7 -6
  38. package/core.js.map +1 -1
  39. package/core.mjs +2 -1
  40. package/core.mjs.map +1 -1
  41. package/error.d.ts.map +1 -1
  42. package/error.js.map +1 -1
  43. package/error.mjs.map +1 -1
  44. package/index.d.mts +1 -5
  45. package/index.d.ts +1 -5
  46. package/index.d.ts.map +1 -1
  47. package/index.js +4 -14
  48. package/index.js.map +1 -1
  49. package/index.mjs +3 -13
  50. package/index.mjs.map +1 -1
  51. package/internal/qs/formats.d.ts.map +1 -1
  52. package/internal/qs/formats.js.map +1 -1
  53. package/internal/qs/formats.mjs.map +1 -1
  54. package/internal/qs/index.d.ts.map +1 -1
  55. package/internal/qs/index.js.map +1 -1
  56. package/internal/qs/index.mjs.map +1 -1
  57. package/internal/qs/stringify.d.ts.map +1 -1
  58. package/internal/qs/stringify.js +1 -2
  59. package/internal/qs/stringify.js.map +1 -1
  60. package/internal/qs/stringify.mjs.map +1 -1
  61. package/internal/qs/types.d.ts.map +1 -1
  62. package/internal/qs/utils.d.ts.map +1 -1
  63. package/internal/qs/utils.js +9 -9
  64. package/internal/qs/utils.js.map +1 -1
  65. package/internal/qs/utils.mjs.map +1 -1
  66. package/lib/generate-signature.d.ts +5 -0
  67. package/lib/generate-signature.d.ts.map +1 -0
  68. package/lib/generate-signature.js +19 -0
  69. package/lib/generate-signature.js.map +1 -0
  70. package/lib/generate-signature.mjs +13 -0
  71. package/lib/generate-signature.mjs.map +1 -0
  72. package/package.json +15 -13
  73. package/resource.d.ts.map +1 -1
  74. package/resource.js.map +1 -1
  75. package/resource.mjs.map +1 -1
  76. package/resources/conversation/chat.d.ts +53 -33
  77. package/resources/conversation/chat.d.ts.map +1 -1
  78. package/resources/conversation/chat.js +6 -15
  79. package/resources/conversation/chat.js.map +1 -1
  80. package/resources/conversation/chat.mjs +5 -14
  81. package/resources/conversation/chat.mjs.map +1 -1
  82. package/resources/conversation/conversation.d.ts +3 -1
  83. package/resources/conversation/conversation.d.ts.map +1 -1
  84. package/resources/conversation/conversation.js +1 -1
  85. package/resources/conversation/conversation.js.map +1 -1
  86. package/resources/conversation/conversation.mjs.map +1 -1
  87. package/resources/conversation/index.d.ts +1 -1
  88. package/resources/conversation/index.d.ts.map +1 -1
  89. package/resources/conversation/index.js +3 -3
  90. package/resources/conversation/index.js.map +1 -1
  91. package/resources/conversation/index.mjs +1 -1
  92. package/resources/conversation/index.mjs.map +1 -1
  93. package/resources/conversation.d.ts.map +1 -1
  94. package/resources/conversation.js.map +1 -1
  95. package/resources/index.d.ts +1 -1
  96. package/resources/index.d.ts.map +1 -1
  97. package/resources/index.js.map +1 -1
  98. package/resources/index.mjs.map +1 -1
  99. package/resources/ingest.d.ts +1 -34
  100. package/resources/ingest.d.ts.map +1 -1
  101. package/resources/ingest.js +2 -15
  102. package/resources/ingest.js.map +1 -1
  103. package/resources/ingest.mjs +2 -15
  104. package/resources/ingest.mjs.map +1 -1
  105. package/resources/token.d.ts +0 -4
  106. package/resources/token.d.ts.map +1 -1
  107. package/resources/token.js +1 -5
  108. package/resources/token.js.map +1 -1
  109. package/resources/token.mjs +0 -4
  110. package/resources/token.mjs.map +1 -1
  111. package/shims/node.d.ts +0 -4
  112. package/shims/node.d.ts.map +1 -1
  113. package/shims/node.js +0 -25
  114. package/shims/node.js.map +1 -1
  115. package/shims/node.mjs +0 -1
  116. package/shims/node.mjs.map +1 -1
  117. package/shims/web.d.ts.map +1 -1
  118. package/shims/web.js +0 -25
  119. package/shims/web.js.map +1 -1
  120. package/shims/web.mjs +0 -1
  121. package/shims/web.mjs.map +1 -1
  122. package/src/_shims/MultipartBody.ts +1 -1
  123. package/src/_shims/auto/runtime-bun.ts +1 -1
  124. package/src/_shims/auto/runtime-node.ts +1 -1
  125. package/src/_shims/auto/runtime.ts +1 -1
  126. package/src/_shims/auto/types-node.ts +1 -1
  127. package/src/_shims/auto/types.d.ts +52 -52
  128. package/src/_shims/bun-runtime.ts +6 -6
  129. package/src/_shims/index.d.ts +36 -36
  130. package/src/_shims/index.js +5 -5
  131. package/src/_shims/index.mjs +4 -4
  132. package/src/_shims/node-runtime.ts +32 -32
  133. package/src/_shims/node-types.d.ts +27 -27
  134. package/src/_shims/registry.ts +44 -44
  135. package/src/_shims/web-runtime.ts +16 -16
  136. package/src/_shims/web-types.d.ts +52 -52
  137. package/src/core.ts +373 -373
  138. package/src/error.ts +37 -37
  139. package/src/index.ts +61 -78
  140. package/src/internal/qs/formats.ts +5 -5
  141. package/src/internal/qs/index.ts +5 -5
  142. package/src/internal/qs/stringify.ts +98 -98
  143. package/src/internal/qs/types.ts +52 -52
  144. package/src/internal/qs/utils.ts +87 -87
  145. package/src/lib/generate-signature.ts +13 -0
  146. package/src/resource.ts +3 -3
  147. package/src/resources/conversation/chat.ts +70 -51
  148. package/src/resources/conversation/conversation.ts +10 -8
  149. package/src/resources/conversation/index.ts +10 -2
  150. package/src/resources/conversation.ts +1 -1
  151. package/src/resources/index.ts +3 -3
  152. package/src/resources/ingest.ts +5 -55
  153. package/src/resources/token.ts +9 -13
  154. package/src/shims/node.ts +24 -24
  155. package/src/shims/web.ts +24 -24
  156. package/src/uploads.ts +75 -74
  157. package/src/version.ts +1 -1
  158. package/uploads.d.ts +2 -2
  159. package/uploads.d.ts.map +1 -1
  160. package/uploads.js +3 -4
  161. package/uploads.js.map +1 -1
  162. package/uploads.mjs +1 -2
  163. package/uploads.mjs.map +1 -1
  164. package/version.d.ts +1 -1
  165. package/version.d.ts.map +1 -1
  166. package/version.js +1 -1
  167. package/version.js.map +1 -1
  168. package/version.mjs +1 -1
  169. package/version.mjs.map +1 -1
  170. package/resources/pets.d.ts +0 -157
  171. package/resources/pets.d.ts.map +0 -1
  172. package/resources/pets.js +0 -75
  173. package/resources/pets.js.map +0 -1
  174. package/resources/pets.mjs +0 -71
  175. package/resources/pets.mjs.map +0 -1
  176. package/resources/shared.d.ts +0 -12
  177. package/resources/shared.d.ts.map +0 -1
  178. package/resources/shared.js +0 -4
  179. package/resources/shared.js.map +0 -1
  180. package/resources/shared.mjs +0 -3
  181. package/resources/shared.mjs.map +0 -1
  182. package/resources/store/index.d.ts +0 -3
  183. package/resources/store/index.d.ts.map +0 -1
  184. package/resources/store/index.js +0 -9
  185. package/resources/store/index.js.map +0 -1
  186. package/resources/store/index.mjs +0 -4
  187. package/resources/store/index.mjs.map +0 -1
  188. package/resources/store/order.d.ts +0 -16
  189. package/resources/store/order.d.ts.map +0 -1
  190. package/resources/store/order.js +0 -26
  191. package/resources/store/order.js.map +0 -1
  192. package/resources/store/order.mjs +0 -22
  193. package/resources/store/order.mjs.map +0 -1
  194. package/resources/store/store.d.ts +0 -35
  195. package/resources/store/store.d.ts.map +0 -1
  196. package/resources/store/store.js +0 -53
  197. package/resources/store/store.js.map +0 -1
  198. package/resources/store/store.mjs +0 -26
  199. package/resources/store/store.mjs.map +0 -1
  200. package/resources/user.d.ts +0 -96
  201. package/resources/user.d.ts.map +0 -1
  202. package/resources/user.js +0 -65
  203. package/resources/user.js.map +0 -1
  204. package/resources/user.mjs +0 -61
  205. package/resources/user.mjs.map +0 -1
  206. package/src/resources/pets.ts +0 -276
  207. package/src/resources/shared.ts +0 -18
  208. package/src/resources/store/index.ts +0 -4
  209. package/src/resources/store/order.ts +0 -26
  210. package/src/resources/store/store.ts +0 -59
  211. package/src/resources/user.ts +0 -185
@@ -1,49 +1,49 @@
1
- import { RFC1738 } from './formats';
2
- import type { DefaultEncoder, Format } from './types';
1
+ import { RFC1738 } from './formats'
2
+ import type { DefaultEncoder, Format } from './types'
3
3
 
4
- const has = Object.prototype.hasOwnProperty;
5
- const is_array = Array.isArray;
4
+ const has = Object.prototype.hasOwnProperty
5
+ const is_array = Array.isArray
6
6
 
7
7
  const hex_table = (() => {
8
- const array = [];
8
+ const array = []
9
9
  for (let i = 0; i < 256; ++i) {
10
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
10
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase())
11
11
  }
12
12
 
13
- return array;
14
- })();
13
+ return array
14
+ })()
15
15
 
16
16
  function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
17
17
  while (queue.length > 1) {
18
- const item = queue.pop();
19
- if (!item) continue;
18
+ const item = queue.pop()
19
+ if (!item) continue
20
20
 
21
- const obj = item.obj[item.prop];
21
+ const obj = item.obj[item.prop]
22
22
 
23
23
  if (is_array(obj)) {
24
- const compacted: unknown[] = [];
24
+ const compacted: unknown[] = []
25
25
 
26
26
  for (let j = 0; j < obj.length; ++j) {
27
27
  if (typeof obj[j] !== 'undefined') {
28
- compacted.push(obj[j]);
28
+ compacted.push(obj[j])
29
29
  }
30
30
  }
31
31
 
32
32
  // @ts-ignore
33
- item.obj[item.prop] = compacted;
33
+ item.obj[item.prop] = compacted
34
34
  }
35
35
  }
36
36
  }
37
37
 
38
38
  function array_to_object(source: any[], options: { plainObjects: boolean }) {
39
- const obj = options && options.plainObjects ? Object.create(null) : {};
39
+ const obj = options && options.plainObjects ? Object.create(null) : {}
40
40
  for (let i = 0; i < source.length; ++i) {
41
41
  if (typeof source[i] !== 'undefined') {
42
- obj[i] = source[i];
42
+ obj[i] = source[i]
43
43
  }
44
44
  }
45
45
 
46
- return obj;
46
+ return obj
47
47
  }
48
48
 
49
49
  export function merge(
@@ -52,86 +52,86 @@ export function merge(
52
52
  options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
53
53
  ) {
54
54
  if (!source) {
55
- return target;
55
+ return target
56
56
  }
57
57
 
58
58
  if (typeof source !== 'object') {
59
59
  if (is_array(target)) {
60
- target.push(source);
60
+ target.push(source)
61
61
  } else if (target && typeof target === 'object') {
62
62
  if (
63
63
  (options && (options.plainObjects || options.allowPrototypes)) ||
64
64
  !has.call(Object.prototype, source)
65
65
  ) {
66
- target[source] = true;
66
+ target[source] = true
67
67
  }
68
68
  } else {
69
- return [target, source];
69
+ return [target, source]
70
70
  }
71
71
 
72
- return target;
72
+ return target
73
73
  }
74
74
 
75
75
  if (!target || typeof target !== 'object') {
76
- return [target].concat(source);
76
+ return [target].concat(source)
77
77
  }
78
78
 
79
- let mergeTarget = target;
79
+ let mergeTarget = target
80
80
  if (is_array(target) && !is_array(source)) {
81
81
  // @ts-ignore
82
- mergeTarget = array_to_object(target, options);
82
+ mergeTarget = array_to_object(target, options)
83
83
  }
84
84
 
85
85
  if (is_array(target) && is_array(source)) {
86
86
  source.forEach(function (item, i) {
87
87
  if (has.call(target, i)) {
88
- const targetItem = target[i];
88
+ const targetItem = target[i]
89
89
  if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
90
- target[i] = merge(targetItem, item, options);
90
+ target[i] = merge(targetItem, item, options)
91
91
  } else {
92
- target.push(item);
92
+ target.push(item)
93
93
  }
94
94
  } else {
95
- target[i] = item;
95
+ target[i] = item
96
96
  }
97
- });
98
- return target;
97
+ })
98
+ return target
99
99
  }
100
100
 
101
101
  return Object.keys(source).reduce(function (acc, key) {
102
- const value = source[key];
102
+ const value = source[key]
103
103
 
104
104
  if (has.call(acc, key)) {
105
- acc[key] = merge(acc[key], value, options);
105
+ acc[key] = merge(acc[key], value, options)
106
106
  } else {
107
- acc[key] = value;
107
+ acc[key] = value
108
108
  }
109
- return acc;
110
- }, mergeTarget);
109
+ return acc
110
+ }, mergeTarget)
111
111
  }
112
112
 
113
113
  export function assign_single_source(target: any, source: any) {
114
114
  return Object.keys(source).reduce(function (acc, key) {
115
- acc[key] = source[key];
116
- return acc;
117
- }, target);
115
+ acc[key] = source[key]
116
+ return acc
117
+ }, target)
118
118
  }
119
119
 
120
120
  export function decode(str: string, _: any, charset: string) {
121
- const strWithoutPlus = str.replace(/\+/g, ' ');
121
+ const strWithoutPlus = str.replace(/\+/g, ' ')
122
122
  if (charset === 'iso-8859-1') {
123
123
  // unescape never throws, no try...catch needed:
124
- return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
124
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape)
125
125
  }
126
126
  // utf-8
127
127
  try {
128
- return decodeURIComponent(strWithoutPlus);
128
+ return decodeURIComponent(strWithoutPlus)
129
129
  } catch (e) {
130
- return strWithoutPlus;
130
+ return strWithoutPlus
131
131
  }
132
132
  }
133
133
 
134
- const limit = 1024;
134
+ const limit = 1024
135
135
 
136
136
  export const encode: (
137
137
  str: any,
@@ -143,29 +143,29 @@ export const encode: (
143
143
  // This code was originally written by Brian White for the io.js core querystring library.
144
144
  // It has been adapted here for stricter adherence to RFC 3986
145
145
  if (str.length === 0) {
146
- return str;
146
+ return str
147
147
  }
148
148
 
149
- let string = str;
149
+ let string = str
150
150
  if (typeof str === 'symbol') {
151
- string = Symbol.prototype.toString.call(str);
151
+ string = Symbol.prototype.toString.call(str)
152
152
  } else if (typeof str !== 'string') {
153
- string = String(str);
153
+ string = String(str)
154
154
  }
155
155
 
156
156
  if (charset === 'iso-8859-1') {
157
157
  return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
158
- return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
159
- });
158
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B'
159
+ })
160
160
  }
161
161
 
162
- let out = '';
162
+ let out = ''
163
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 = [];
164
+ const segment = string.length >= limit ? string.slice(j, j + limit) : string
165
+ const arr = []
166
166
 
167
167
  for (let i = 0; i < segment.length; ++i) {
168
- let c = segment.charCodeAt(i);
168
+ let c = segment.charCodeAt(i)
169
169
  if (
170
170
  c === 0x2d || // -
171
171
  c === 0x2e || // .
@@ -176,90 +176,90 @@ export const encode: (
176
176
  (c >= 0x61 && c <= 0x7a) || // A-Z
177
177
  (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
178
178
  ) {
179
- arr[arr.length] = segment.charAt(i);
180
- continue;
179
+ arr[arr.length] = segment.charAt(i)
180
+ continue
181
181
  }
182
182
 
183
183
  if (c < 0x80) {
184
- arr[arr.length] = hex_table[c];
185
- continue;
184
+ arr[arr.length] = hex_table[c]
185
+ continue
186
186
  }
187
187
 
188
188
  if (c < 0x800) {
189
- arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
190
- continue;
189
+ arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)]
190
+ continue
191
191
  }
192
192
 
193
193
  if (c < 0xd800 || c >= 0xe000) {
194
194
  arr[arr.length] =
195
- hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
196
- continue;
195
+ hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)]
196
+ continue
197
197
  }
198
198
 
199
- i += 1;
200
- c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
199
+ i += 1
200
+ c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff))
201
201
 
202
202
  arr[arr.length] =
203
203
  hex_table[0xf0 | (c >> 18)]! +
204
204
  hex_table[0x80 | ((c >> 12) & 0x3f)] +
205
205
  hex_table[0x80 | ((c >> 6) & 0x3f)] +
206
- hex_table[0x80 | (c & 0x3f)];
206
+ hex_table[0x80 | (c & 0x3f)]
207
207
  }
208
208
 
209
- out += arr.join('');
209
+ out += arr.join('')
210
210
  }
211
211
 
212
- return out;
213
- };
212
+ return out
213
+ }
214
214
 
215
215
  export function compact(value: any) {
216
- const queue = [{ obj: { o: value }, prop: 'o' }];
217
- const refs = [];
216
+ const queue = [{ obj: { o: value }, prop: 'o' }]
217
+ const refs = []
218
218
 
219
219
  for (let i = 0; i < queue.length; ++i) {
220
- const item = queue[i];
220
+ const item = queue[i]
221
221
  // @ts-ignore
222
- const obj = item.obj[item.prop];
222
+ const obj = item.obj[item.prop]
223
223
 
224
- const keys = Object.keys(obj);
224
+ const keys = Object.keys(obj)
225
225
  for (let j = 0; j < keys.length; ++j) {
226
- const key = keys[j]!;
227
- const val = obj[key];
226
+ const key = keys[j]!
227
+ const val = obj[key]
228
228
  if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
229
- queue.push({ obj: obj, prop: key });
230
- refs.push(val);
229
+ queue.push({ obj: obj, prop: key })
230
+ refs.push(val)
231
231
  }
232
232
  }
233
233
  }
234
234
 
235
- compact_queue(queue);
235
+ compact_queue(queue)
236
236
 
237
- return value;
237
+ return value
238
238
  }
239
239
 
240
240
  export function is_regexp(obj: any) {
241
- return Object.prototype.toString.call(obj) === '[object RegExp]';
241
+ return Object.prototype.toString.call(obj) === '[object RegExp]'
242
242
  }
243
243
 
244
244
  export function is_buffer(obj: any) {
245
245
  if (!obj || typeof obj !== 'object') {
246
- return false;
246
+ return false
247
247
  }
248
248
 
249
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
249
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj))
250
250
  }
251
251
 
252
252
  export function combine(a: any, b: any) {
253
- return [].concat(a, b);
253
+ return [].concat(a, b)
254
254
  }
255
255
 
256
256
  export function maybe_map<T>(val: T[], fn: (v: T) => T) {
257
257
  if (is_array(val)) {
258
- const mapped = [];
258
+ const mapped = []
259
259
  for (let i = 0; i < val.length; i += 1) {
260
- mapped.push(fn(val[i]!));
260
+ mapped.push(fn(val[i]!))
261
261
  }
262
- return mapped;
262
+ return mapped
263
263
  }
264
- return fn(val);
264
+ return fn(val)
265
265
  }
@@ -0,0 +1,13 @@
1
+ import crypto from 'crypto'
2
+
3
+ /**
4
+ * Generate a signature for a given payload using a secret key.
5
+ */
6
+ export function generateSignature(payload: Buffer | string, secret: string) {
7
+ return crypto
8
+ .createHmac('sha256', secret)
9
+ .update(payload)
10
+ .digest('base64')
11
+ .replace(/\+/g, '-')
12
+ .replace(/\//g, '_')
13
+ }
package/src/resource.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import type { Lorikeet } from './index';
3
+ import type { Lorikeet } from './index'
4
4
 
5
5
  export class APIResource {
6
- protected _client: Lorikeet;
6
+ protected _client: Lorikeet
7
7
 
8
8
  constructor(client: Lorikeet) {
9
- this._client = client;
9
+ this._client = client
10
10
  }
11
11
  }
@@ -1,83 +1,102 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import * as Core from '../../core';
5
- import * as ChatAPI from './chat';
3
+ import { APIResource } from '../../resource'
4
+ import * as Core from '../../core'
5
+ import * as ChatAPI from './chat'
6
6
 
7
7
  export class Chat extends APIResource {
8
+ generate(body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ChatGenerateResponse> {
9
+ return this._client.post('/conversation/chat/message', { body, ...options })
10
+ }
11
+
12
+ get(query: ChatGetParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse> {
13
+ return this._client.get('/conversation/chat/message', { query, ...options })
14
+ }
15
+
16
+ start(body: ChatStartParams, options?: Core.RequestOptions): Core.APIPromise<ChatStartResponse> {
17
+ return this._client.post('/conversation/chat/create', { body, ...options })
18
+ }
19
+ }
20
+
21
+ export interface ChatGenerateResponse {
8
22
  /**
9
- * Retrieves the latest conversation message for a given conversation ID.
23
+ * The ID of the conversation
10
24
  */
11
- generate(
12
- conversationId: string,
13
- body: ChatGenerateParams,
14
- options?: Core.RequestOptions,
15
- ): Core.APIPromise<ConversationMessage> {
16
- return this._client.post(`/conversation/chat/${conversationId}/generate`, { body, ...options });
17
- }
25
+ conversationId: string
18
26
 
19
27
  /**
20
- * Retrieves the latest conversation message for a given conversation ID.
28
+ * The timestamp of when the message was created in our system.
21
29
  */
22
- get(conversationId: string, options?: Core.RequestOptions): Core.APIPromise<ConversationMessage> {
23
- return this._client.get(`/conversation/chat/${conversationId}`, options);
24
- }
30
+ createdAt: string
25
31
 
26
32
  /**
27
- * Generates a new conversation ID.
33
+ * The message to be sent back to the user. If empty, the message is still being
34
+ * processed.
28
35
  */
29
- start(body: ChatStartParams, options?: Core.RequestOptions): Core.APIPromise<ChatStartResponse> {
30
- return this._client.post('/conversation/chat/start', { body, ...options });
31
- }
36
+ message: string
32
37
  }
33
38
 
34
- export interface ConversationMessage {
35
- actions?: Array<ConversationMessage.Action>;
39
+ export interface ChatGetResponse {
40
+ /**
41
+ * The ID of the conversation
42
+ */
43
+ conversationId: string
36
44
 
37
45
  /**
38
- * The message content.
46
+ * The timestamp of when the message was created in our system.
39
47
  */
40
- message?: string;
48
+ createdAt: string
41
49
 
42
50
  /**
43
- * The timestamp of the message.
51
+ * The message to be sent back to the user. If empty, the message is still being
52
+ * processed.
44
53
  */
45
- timestamp?: string;
54
+ message: string
46
55
  }
47
56
 
48
- export namespace ConversationMessage {
49
- export interface Action {
50
- /**
51
- * The label of the action.
52
- */
53
- label?: string;
54
-
55
- /**
56
- * The type of action.
57
- */
58
- type?: string;
59
-
60
- /**
61
- * The value of the action.
62
- */
63
- value?: string;
64
- }
57
+ export interface ChatStartResponse {
58
+ /**
59
+ * The ID of the conversation
60
+ */
61
+ conversationId: string
62
+
63
+ /**
64
+ * The timestamp of the when the conversation was created in our system.
65
+ */
66
+ createdAt: string
65
67
  }
66
68
 
67
- export interface ChatStartResponse {
69
+ export interface ChatGenerateParams {
68
70
  /**
69
- * The unique identifier of the created conversation.
71
+ * The ID of the conversation
70
72
  */
71
- conversationId?: string;
73
+ conversationId: string
74
+
75
+ /**
76
+ * The message to be sent to the user. This endpoint supports markdown.
77
+ */
78
+ message: string
72
79
  }
73
80
 
74
- export type ChatGenerateParams = unknown;
81
+ export interface ChatGetParams {
82
+ /**
83
+ * The ID of the conversation you need to poll.
84
+ */
85
+ conversationId: string
86
+ }
75
87
 
76
- export type ChatStartParams = unknown;
88
+ export interface ChatStartParams {
89
+ /**
90
+ * The ID of the customer. If omitted, a new customer will be created.
91
+ */
92
+ customerId: string
93
+ }
77
94
 
78
95
  export namespace Chat {
79
- export import ConversationMessage = ChatAPI.ConversationMessage;
80
- export import ChatStartResponse = ChatAPI.ChatStartResponse;
81
- export import ChatGenerateParams = ChatAPI.ChatGenerateParams;
82
- export import ChatStartParams = ChatAPI.ChatStartParams;
96
+ export import ChatGenerateResponse = ChatAPI.ChatGenerateResponse
97
+ export import ChatGetResponse = ChatAPI.ChatGetResponse
98
+ export import ChatStartResponse = ChatAPI.ChatStartResponse
99
+ export import ChatGenerateParams = ChatAPI.ChatGenerateParams
100
+ export import ChatGetParams = ChatAPI.ChatGetParams
101
+ export import ChatStartParams = ChatAPI.ChatStartParams
83
102
  }
@@ -1,16 +1,18 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import * as ChatAPI from './chat';
3
+ import { APIResource } from '../../resource'
4
+ import * as ChatAPI from './chat'
5
5
 
6
6
  export class Conversation extends APIResource {
7
- chat: ChatAPI.Chat = new ChatAPI.Chat(this._client);
7
+ chat: ChatAPI.Chat = new ChatAPI.Chat(this._client)
8
8
  }
9
9
 
10
10
  export namespace Conversation {
11
- export import Chat = ChatAPI.Chat;
12
- export import ConversationMessage = ChatAPI.ConversationMessage;
13
- export import ChatStartResponse = ChatAPI.ChatStartResponse;
14
- export import ChatGenerateParams = ChatAPI.ChatGenerateParams;
15
- export import ChatStartParams = ChatAPI.ChatStartParams;
11
+ export import Chat = ChatAPI.Chat
12
+ export import ChatGenerateResponse = ChatAPI.ChatGenerateResponse
13
+ export import ChatGetResponse = ChatAPI.ChatGetResponse
14
+ export import ChatStartResponse = ChatAPI.ChatStartResponse
15
+ export import ChatGenerateParams = ChatAPI.ChatGenerateParams
16
+ export import ChatGetParams = ChatAPI.ChatGetParams
17
+ export import ChatStartParams = ChatAPI.ChatStartParams
16
18
  }
@@ -1,4 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Conversation } from './conversation';
4
- export { ConversationMessage, ChatStartResponse, ChatGenerateParams, ChatStartParams, Chat } from './chat';
3
+ export {
4
+ ChatGenerateResponse,
5
+ ChatGetResponse,
6
+ ChatStartResponse,
7
+ ChatGenerateParams,
8
+ ChatGetParams,
9
+ ChatStartParams,
10
+ Chat,
11
+ } from './chat'
12
+ export { Conversation } from './conversation'
@@ -1,5 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../resource';
3
+ import { APIResource } from '../resource'
4
4
 
5
5
  export class Conversation extends APIResource {}
@@ -1,5 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Conversation } from './conversation/conversation';
4
- export { IngestValidateResponse, IngestValidateParams, IngestWebhooksParams, Ingest } from './ingest';
5
- export { TokenCreateParams, Token } from './token';
3
+ export { Conversation } from './conversation/conversation'
4
+ export { Ingest } from './ingest'
5
+ export { TokenCreateParams, Token } from './token'
@@ -1,63 +1,13 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../resource';
4
- import * as Core from '../core';
5
- import * as IngestAPI from './ingest';
3
+ import { APIResource } from '../resource'
4
+ import * as Core from '../core'
6
5
 
7
6
  export class Ingest extends APIResource {
8
- /**
9
- * Validate your webhook is configured correctly
10
- */
11
- validate(
12
- body: IngestValidateParams,
13
- options?: Core.RequestOptions,
14
- ): Core.APIPromise<IngestValidateResponse> {
15
- return this._client.post('/ingest/validate', { body, ...options });
16
- }
17
-
18
- /**
19
- * The url to post a return webhook request to. This url will be generated by
20
- * Lorikeet and sent as a payload to your webhook
21
- */
22
- webhooks(
23
- toolId: string,
24
- ticketId: string,
25
- body: IngestWebhooksParams,
26
- options?: Core.RequestOptions,
27
- ): Core.APIPromise<void> {
28
- return this._client.post(`/ingest/${toolId}/${ticketId}`, {
29
- body,
7
+ validate(options?: Core.RequestOptions): Core.APIPromise<void> {
8
+ return this._client.post('/ingest/validate', {
30
9
  ...options,
31
10
  headers: { Accept: '*/*', ...options?.headers },
32
- });
11
+ })
33
12
  }
34
13
  }
35
-
36
- export interface IngestValidateResponse {
37
- code?: 200;
38
-
39
- /**
40
- * The return data for the tool request.
41
- */
42
- data?: string;
43
- }
44
-
45
- export interface IngestValidateParams {
46
- /**
47
- * The return data for the tool request.
48
- */
49
- data: unknown;
50
- }
51
-
52
- export interface IngestWebhooksParams {
53
- /**
54
- * The return data for the tool request.
55
- */
56
- data: unknown;
57
- }
58
-
59
- export namespace Ingest {
60
- export import IngestValidateResponse = IngestAPI.IngestValidateResponse;
61
- export import IngestValidateParams = IngestAPI.IngestValidateParams;
62
- export import IngestWebhooksParams = IngestAPI.IngestWebhooksParams;
63
- }