@lorikeetai/node-sdk 1.3.0 → 1.8.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 (146) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/LICENSE +1 -1
  3. package/README.md +11 -5
  4. package/core.d.ts.map +1 -1
  5. package/core.js +5 -0
  6. package/core.js.map +1 -1
  7. package/core.mjs +5 -0
  8. package/core.mjs.map +1 -1
  9. package/index.d.mts +7 -20
  10. package/index.d.ts +7 -20
  11. package/index.d.ts.map +1 -1
  12. package/index.js +3 -18
  13. package/index.js.map +1 -1
  14. package/index.mjs +3 -18
  15. package/index.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/api-keys.d.ts +129 -0
  18. package/resources/api-keys.d.ts.map +1 -0
  19. package/resources/api-keys.js +61 -0
  20. package/resources/api-keys.js.map +1 -0
  21. package/resources/api-keys.mjs +57 -0
  22. package/resources/api-keys.mjs.map +1 -0
  23. package/resources/conversation/chat.d.ts +15 -1
  24. package/resources/conversation/chat.d.ts.map +1 -1
  25. package/resources/conversation/conversation.d.ts +1 -58
  26. package/resources/conversation/conversation.d.ts.map +1 -1
  27. package/resources/conversation/conversation.js +0 -36
  28. package/resources/conversation/conversation.js.map +1 -1
  29. package/resources/conversation/conversation.mjs +0 -36
  30. package/resources/conversation/conversation.mjs.map +1 -1
  31. package/resources/conversation/email.d.ts +15 -1
  32. package/resources/conversation/email.d.ts.map +1 -1
  33. package/resources/conversation/index.d.ts +1 -1
  34. package/resources/conversation/index.d.ts.map +1 -1
  35. package/resources/conversation/index.js.map +1 -1
  36. package/resources/conversation/index.mjs +1 -1
  37. package/resources/conversation/index.mjs.map +1 -1
  38. package/resources/conversation/voice.d.ts +3 -1
  39. package/resources/conversation/voice.d.ts.map +1 -1
  40. package/resources/customer/customer.d.ts +38 -5
  41. package/resources/customer/customer.d.ts.map +1 -1
  42. package/resources/customer/customer.js +6 -10
  43. package/resources/customer/customer.js.map +1 -1
  44. package/resources/customer/customer.mjs +6 -10
  45. package/resources/customer/customer.mjs.map +1 -1
  46. package/resources/customer/index.d.ts +1 -1
  47. package/resources/customer/index.d.ts.map +1 -1
  48. package/resources/customer/index.js.map +1 -1
  49. package/resources/customer/index.mjs.map +1 -1
  50. package/resources/customer/profile.d.ts +3 -45
  51. package/resources/customer/profile.d.ts.map +1 -1
  52. package/resources/customer/remote.d.ts +12 -0
  53. package/resources/customer/remote.d.ts.map +1 -1
  54. package/resources/index.d.ts +3 -7
  55. package/resources/index.d.ts.map +1 -1
  56. package/resources/index.js +3 -11
  57. package/resources/index.js.map +1 -1
  58. package/resources/index.mjs +1 -5
  59. package/resources/index.mjs.map +1 -1
  60. package/resources/ingest.d.ts +3 -4
  61. package/resources/ingest.d.ts.map +1 -1
  62. package/resources/ingest.js +0 -3
  63. package/resources/ingest.js.map +1 -1
  64. package/resources/ingest.mjs +0 -3
  65. package/resources/ingest.mjs.map +1 -1
  66. package/src/core.ts +9 -3
  67. package/src/index.ts +16 -38
  68. package/src/resources/api-keys.ts +168 -0
  69. package/src/resources/conversation/chat.ts +16 -1
  70. package/src/resources/conversation/conversation.ts +0 -90
  71. package/src/resources/conversation/email.ts +16 -1
  72. package/src/resources/conversation/index.ts +1 -10
  73. package/src/resources/conversation/voice.ts +3 -1
  74. package/src/resources/customer/customer.ts +55 -5
  75. package/src/resources/customer/index.ts +1 -0
  76. package/src/resources/customer/profile.ts +3 -54
  77. package/src/resources/customer/remote.ts +15 -0
  78. package/src/resources/index.ts +8 -9
  79. package/src/resources/ingest.ts +3 -7
  80. package/src/version.ts +1 -1
  81. package/version.d.ts +1 -1
  82. package/version.js +1 -1
  83. package/version.mjs +1 -1
  84. package/resources/file.d.ts +0 -7
  85. package/resources/file.d.ts.map +0 -1
  86. package/resources/file.js +0 -21
  87. package/resources/file.js.map +0 -1
  88. package/resources/file.mjs +0 -17
  89. package/resources/file.mjs.map +0 -1
  90. package/resources/oauth/authorization.d.ts +0 -6
  91. package/resources/oauth/authorization.d.ts.map +0 -1
  92. package/resources/oauth/authorization.js +0 -15
  93. package/resources/oauth/authorization.js.map +0 -1
  94. package/resources/oauth/authorization.mjs +0 -11
  95. package/resources/oauth/authorization.mjs.map +0 -1
  96. package/resources/oauth/index.d.ts +0 -3
  97. package/resources/oauth/index.d.ts.map +0 -1
  98. package/resources/oauth/index.js +0 -9
  99. package/resources/oauth/index.js.map +0 -1
  100. package/resources/oauth/index.mjs +0 -4
  101. package/resources/oauth/index.mjs.map +0 -1
  102. package/resources/oauth/oauth.d.ts +0 -24
  103. package/resources/oauth/oauth.d.ts.map +0 -1
  104. package/resources/oauth/oauth.js +0 -65
  105. package/resources/oauth/oauth.js.map +0 -1
  106. package/resources/oauth/oauth.mjs +0 -38
  107. package/resources/oauth/oauth.mjs.map +0 -1
  108. package/resources/oauth.d.ts +0 -2
  109. package/resources/oauth.d.ts.map +0 -1
  110. package/resources/oauth.js +0 -19
  111. package/resources/oauth.js.map +0 -1
  112. package/resources/oauth.mjs +0 -3
  113. package/resources/oauth.mjs.map +0 -1
  114. package/resources/suggestion.d.ts +0 -7
  115. package/resources/suggestion.d.ts.map +0 -1
  116. package/resources/suggestion.js +0 -21
  117. package/resources/suggestion.js.map +0 -1
  118. package/resources/suggestion.mjs +0 -17
  119. package/resources/suggestion.mjs.map +0 -1
  120. package/resources/top-level.d.ts +0 -2
  121. package/resources/top-level.d.ts.map +0 -1
  122. package/resources/top-level.js +0 -4
  123. package/resources/top-level.js.map +0 -1
  124. package/resources/top-level.mjs +0 -3
  125. package/resources/top-level.mjs.map +0 -1
  126. package/resources/webhooks.d.ts +0 -6
  127. package/resources/webhooks.d.ts.map +0 -1
  128. package/resources/webhooks.js +0 -15
  129. package/resources/webhooks.js.map +0 -1
  130. package/resources/webhooks.mjs +0 -11
  131. package/resources/webhooks.mjs.map +0 -1
  132. package/resources/workflow.d.ts +0 -8
  133. package/resources/workflow.d.ts.map +0 -1
  134. package/resources/workflow.js +0 -21
  135. package/resources/workflow.js.map +0 -1
  136. package/resources/workflow.mjs +0 -17
  137. package/resources/workflow.mjs.map +0 -1
  138. package/src/resources/file.ts +0 -20
  139. package/src/resources/oauth/authorization.ts +0 -13
  140. package/src/resources/oauth/index.ts +0 -4
  141. package/src/resources/oauth/oauth.ts +0 -63
  142. package/src/resources/oauth.ts +0 -3
  143. package/src/resources/suggestion.ts +0 -20
  144. package/src/resources/top-level.ts +0 -3
  145. package/src/resources/webhooks.ts +0 -13
  146. package/src/resources/workflow.ts +0 -21
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Ingest = void 0;
5
5
  const resource_1 = require("../resource.js");
6
6
  class Ingest extends resource_1.APIResource {
7
- retrieve(options) {
8
- return this._client.get('/v1/ingest', { ...options, headers: { Accept: '*/*', ...options?.headers } });
9
- }
10
7
  submit(toolId, ticketId, inputHash, workflowId, options) {
11
8
  return this._client.post(`/ingest/${toolId}/${ticketId}/${inputHash}/${workflowId}`, {
12
9
  ...options,
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.js","sourceRoot":"","sources":["../src/resources/ingest.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,MAAO,SAAQ,sBAAW;IACrC,QAAQ,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACzG,CAAC;IAED,MAAM,CACJ,MAAc,EACd,QAAgB,EAChB,SAAiB,EACjB,UAAkB,EAClB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,MAAM,IAAI,QAAQ,IAAI,SAAS,IAAI,UAAU,EAAE,EAAE;YACnF,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KA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AO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF;AA5BD,wBA4BC"}
@@ -1,9 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../resource.mjs";
3
3
  export class Ingest extends APIResource {
4
- retrieve(options) {
5
- return this._client.get('/v1/ingest', { ...options, headers: { Accept: '*/*', ...options?.headers } });
6
- }
7
4
  submit(toolId, ticketId, inputHash, workflowId, options) {
8
5
  return this._client.post(`/ingest/${toolId}/${ticketId}/${inputHash}/${workflowId}`, {
9
6
  ...options,
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.mjs","sourceRoot":"","sources":["../src/resources/ingest.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC,QAAQ,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACzG,CAAC;IAED,MAAM,CACJ,MAAc,EACd,QAAgB,EAChB,SAAiB,EACjB,UAAkB,EAClB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,MAAM,IAAI,QAAQ,IAAI,SAAS,IAAI,UAAU,EAAE,EAAE;YACnF,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE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AED,QAAQ,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF"}
package/src/core.ts CHANGED
@@ -70,6 +70,12 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
70
70
  const mediaType = contentType?.split(';')[0]?.trim();
71
71
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
72
72
  if (isJSON) {
73
+ const contentLength = response.headers.get('content-length');
74
+ if (contentLength === '0') {
75
+ // if there is no content we can't do anything
76
+ return undefined as T;
77
+ }
78
+
73
79
  const json = await response.json();
74
80
 
75
81
  debug('response', response.status, response.url, response.headers, json);
@@ -735,9 +741,9 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
735
741
  * }
736
742
  */
737
743
  export class PagePromise<
738
- PageClass extends AbstractPage<Item>,
739
- Item = ReturnType<PageClass['getPaginatedItems']>[number],
740
- >
744
+ PageClass extends AbstractPage<Item>,
745
+ Item = ReturnType<PageClass['getPaginatedItems']>[number],
746
+ >
741
747
  extends APIPromise<PageClass>
742
748
  implements AsyncIterable<Item>
743
749
  {
package/src/index.ts CHANGED
@@ -5,18 +5,17 @@ import * as Core from './core';
5
5
  import * as Errors from './error';
6
6
  import * as Uploads from './uploads';
7
7
  import * as API from './resources/index';
8
- import { File } from './resources/file';
8
+ import {
9
+ APIKeyCreateParams,
10
+ APIKeyCreateResponse,
11
+ APIKeyGetResponse,
12
+ APIKeyListResponse,
13
+ APIKeys,
14
+ } from './resources/api-keys';
9
15
  import { Ingest, IngestTestParams } from './resources/ingest';
10
- import { Suggestion } from './resources/suggestion';
11
- import { Webhooks } from './resources/webhooks';
12
- import { Workflow } from './resources/workflow';
13
16
  import {
14
17
  AttachmentDto,
15
18
  Conversation,
16
- ConversationCreateParams,
17
- ConversationCreateResponse,
18
- ConversationRetrieveTranscriptParams,
19
- ConversationRetrieveTranscriptResponse,
20
19
  TicketEvent,
21
20
  TicketMessageDto,
22
21
  } from './resources/conversation/conversation';
@@ -25,13 +24,13 @@ import {
25
24
  Customer,
26
25
  CustomerCreateParams,
27
26
  CustomerCreateResponse,
27
+ CustomerGetParams,
28
28
  CustomerGetResponse,
29
29
  CustomerTokenParams,
30
30
  CustomerTokenResponse,
31
31
  CustomerUpdateParams,
32
32
  CustomerUpdateResponse,
33
33
  } from './resources/customer/customer';
34
- import { OAuth, OAuthAuthorizeParams, OAuthCallbackParams } from './resources/oauth/oauth';
35
34
 
36
35
  export interface ClientOptions {
37
36
  /**
@@ -166,12 +165,8 @@ export class Lorikeet extends Core.APIClient {
166
165
 
167
166
  conversation: API.Conversation = new API.Conversation(this);
168
167
  customer: API.Customer = new API.Customer(this);
169
- workflow: API.Workflow = new API.Workflow(this);
170
168
  ingest: API.Ingest = new API.Ingest(this);
171
- file: API.File = new API.File(this);
172
- suggestion: API.Suggestion = new API.Suggestion(this);
173
- oauth: API.OAuth = new API.OAuth(this);
174
- webhooks: API.Webhooks = new API.Webhooks(this);
169
+ apiKeys: API.APIKeys = new API.APIKeys(this);
175
170
 
176
171
  /**
177
172
  * Check whether the base URL is set to its default.
@@ -180,10 +175,6 @@ export class Lorikeet extends Core.APIClient {
180
175
  return this.baseURL !== 'https://api.lorikeetcx.ai';
181
176
  }
182
177
 
183
- retrieve(options?: Core.RequestOptions): Core.APIPromise<void> {
184
- return this.get('/', { ...options, headers: { Accept: '*/*', ...options?.headers } });
185
- }
186
-
187
178
  protected override defaultQuery(): Core.DefaultQuery | undefined {
188
179
  return this._options.defaultQuery;
189
180
  }
@@ -243,12 +234,8 @@ export class Lorikeet extends Core.APIClient {
243
234
 
244
235
  Lorikeet.Conversation = Conversation;
245
236
  Lorikeet.Customer = Customer;
246
- Lorikeet.Workflow = Workflow;
247
237
  Lorikeet.Ingest = Ingest;
248
- Lorikeet.File = File;
249
- Lorikeet.Suggestion = Suggestion;
250
- Lorikeet.OAuth = OAuth;
251
- Lorikeet.Webhooks = Webhooks;
238
+ Lorikeet.APIKeys = APIKeys;
252
239
 
253
240
  export declare namespace Lorikeet {
254
241
  export type RequestOptions = Core.RequestOptions;
@@ -258,10 +245,6 @@ export declare namespace Lorikeet {
258
245
  type AttachmentDto as AttachmentDto,
259
246
  type TicketEvent as TicketEvent,
260
247
  type TicketMessageDto as TicketMessageDto,
261
- type ConversationCreateResponse as ConversationCreateResponse,
262
- type ConversationRetrieveTranscriptResponse as ConversationRetrieveTranscriptResponse,
263
- type ConversationCreateParams as ConversationCreateParams,
264
- type ConversationRetrieveTranscriptParams as ConversationRetrieveTranscriptParams,
265
248
  };
266
249
 
267
250
  export {
@@ -272,24 +255,19 @@ export declare namespace Lorikeet {
272
255
  type CustomerTokenResponse as CustomerTokenResponse,
273
256
  type CustomerCreateParams as CustomerCreateParams,
274
257
  type CustomerUpdateParams as CustomerUpdateParams,
258
+ type CustomerGetParams as CustomerGetParams,
275
259
  type CustomerTokenParams as CustomerTokenParams,
276
260
  };
277
261
 
278
- export { Workflow as Workflow };
279
-
280
262
  export { Ingest as Ingest, type IngestTestParams as IngestTestParams };
281
263
 
282
- export { File as File };
283
-
284
- export { Suggestion as Suggestion };
285
-
286
264
  export {
287
- OAuth as OAuth,
288
- type OAuthAuthorizeParams as OAuthAuthorizeParams,
289
- type OAuthCallbackParams as OAuthCallbackParams,
265
+ APIKeys as APIKeys,
266
+ type APIKeyCreateResponse as APIKeyCreateResponse,
267
+ type APIKeyListResponse as APIKeyListResponse,
268
+ type APIKeyGetResponse as APIKeyGetResponse,
269
+ type APIKeyCreateParams as APIKeyCreateParams,
290
270
  };
291
-
292
- export { Webhooks as Webhooks };
293
271
  }
294
272
 
295
273
  export { toFile, fileFromPath } from './uploads';
@@ -0,0 +1,168 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class APIKeys extends APIResource {
7
+ /**
8
+ * Generate a new API key pair (clientId + clientSecret) for the authenticated
9
+ * subscriber. The clientSecret is only returned once on creation.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const apiKey = await client.apiKeys.create();
14
+ * ```
15
+ */
16
+ create(body: APIKeyCreateParams, options?: Core.RequestOptions): Core.APIPromise<APIKeyCreateResponse> {
17
+ return this._client.post('/v1/api-keys', { body, ...options });
18
+ }
19
+
20
+ /**
21
+ * List all API keys for the authenticated subscriber. Secrets are masked.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const apiKeys = await client.apiKeys.list();
26
+ * ```
27
+ */
28
+ list(options?: Core.RequestOptions): Core.APIPromise<APIKeyListResponse> {
29
+ return this._client.get('/v1/api-keys', options);
30
+ }
31
+
32
+ /**
33
+ * Permanently delete an API key. This action cannot be undone.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * await client.apiKeys.delete(
38
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
39
+ * );
40
+ * ```
41
+ */
42
+ delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
43
+ return this._client.delete(`/v1/api-keys/${id}`, {
44
+ ...options,
45
+ headers: { Accept: '*/*', ...options?.headers },
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Get details of a specific API key. Secret is masked.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const apiKey = await client.apiKeys.get(
55
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
56
+ * );
57
+ * ```
58
+ */
59
+ get(id: string, options?: Core.RequestOptions): Core.APIPromise<APIKeyGetResponse> {
60
+ return this._client.get(`/v1/api-keys/${id}`, options);
61
+ }
62
+ }
63
+
64
+ export interface APIKeyCreateResponse {
65
+ /**
66
+ * Unique identifier for the API key
67
+ */
68
+ id: string;
69
+
70
+ /**
71
+ * Public client ID used in API requests
72
+ */
73
+ clientId: string;
74
+
75
+ /**
76
+ * Secret key for signing requests. Only returned on creation - store securely.
77
+ */
78
+ clientSecret: string;
79
+
80
+ /**
81
+ * Timestamp when the API key was created
82
+ */
83
+ createdAt: string;
84
+
85
+ /**
86
+ * Environment label for the API key
87
+ */
88
+ env: string;
89
+ }
90
+
91
+ export interface APIKeyListResponse {
92
+ /**
93
+ * List of API keys
94
+ */
95
+ keys: Array<APIKeyListResponse.Key>;
96
+ }
97
+
98
+ export namespace APIKeyListResponse {
99
+ export interface Key {
100
+ /**
101
+ * Unique identifier for the API key
102
+ */
103
+ id: string;
104
+
105
+ /**
106
+ * Public client ID used in API requests
107
+ */
108
+ clientId: string;
109
+
110
+ /**
111
+ * Masked preview of the secret key
112
+ */
113
+ clientSecretPreview: string;
114
+
115
+ /**
116
+ * Timestamp when the API key was created
117
+ */
118
+ createdAt: string;
119
+
120
+ /**
121
+ * Environment label for the API key
122
+ */
123
+ env: string;
124
+ }
125
+ }
126
+
127
+ export interface APIKeyGetResponse {
128
+ /**
129
+ * Unique identifier for the API key
130
+ */
131
+ id: string;
132
+
133
+ /**
134
+ * Public client ID used in API requests
135
+ */
136
+ clientId: string;
137
+
138
+ /**
139
+ * Masked preview of the secret key
140
+ */
141
+ clientSecretPreview: string;
142
+
143
+ /**
144
+ * Timestamp when the API key was created
145
+ */
146
+ createdAt: string;
147
+
148
+ /**
149
+ * Environment label for the API key
150
+ */
151
+ env: string;
152
+ }
153
+
154
+ export interface APIKeyCreateParams {
155
+ /**
156
+ * Environment label for the API key (e.g., "api", "production", "staging")
157
+ */
158
+ env?: string;
159
+ }
160
+
161
+ export declare namespace APIKeys {
162
+ export {
163
+ type APIKeyCreateResponse as APIKeyCreateResponse,
164
+ type APIKeyListResponse as APIKeyListResponse,
165
+ type APIKeyGetResponse as APIKeyGetResponse,
166
+ type APIKeyCreateParams as APIKeyCreateParams,
167
+ };
168
+ }
@@ -380,6 +380,11 @@ export interface ChatGenerateParams {
380
380
  * be omitted if the message is sent by the agent to the customer.
381
381
  */
382
382
  customer?: ChatGenerateParams.Customer;
383
+
384
+ /**
385
+ * The variables to be passed to the conversation - this can be used by workflows
386
+ */
387
+ variables?: { [key: string]: unknown };
383
388
  }
384
389
 
385
390
  export namespace ChatGenerateParams {
@@ -414,6 +419,11 @@ export namespace ChatGenerateParams {
414
419
  */
415
420
  lastName?: string;
416
421
 
422
+ /**
423
+ * The phone number of the customer (in international / E.164 format)
424
+ */
425
+ phoneNumber?: string;
426
+
417
427
  /**
418
428
  * The id of the customer in the ticketing system. For the SDK this needs to be
419
429
  * stable and unique
@@ -453,9 +463,14 @@ export interface ChatStartParams {
453
463
  publicKey: string;
454
464
 
455
465
  /**
456
- * The timestamp of the when the conversation was created in our system.
466
+ * The subject of the conversation.
457
467
  */
458
468
  subject?: string;
469
+
470
+ /**
471
+ * The UUID of the workflow to trigger.
472
+ */
473
+ workflowId?: string;
459
474
  }
460
475
 
461
476
  export interface ChatStreamParams {
@@ -1,7 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../resource';
4
- import * as Core from '../../core';
5
4
  import * as ChatAPI from './chat';
6
5
  import {
7
6
  Chat,
@@ -29,51 +28,6 @@ export class Conversation extends APIResource {
29
28
  email: EmailAPI.Email = new EmailAPI.Email(this._client);
30
29
  chat: ChatAPI.Chat = new ChatAPI.Chat(this._client);
31
30
  voice: VoiceAPI.Voice = new VoiceAPI.Voice(this._client);
32
-
33
- /**
34
- * @example
35
- * ```ts
36
- * const conversation = await client.conversation.create({
37
- * customerId: '1234567890',
38
- * phoneNumber: '0412745903',
39
- * 'x-lorikeet-voice-public-key':
40
- * 'x-lorikeet-voice-public-key',
41
- * });
42
- * ```
43
- */
44
- create(
45
- params: ConversationCreateParams,
46
- options?: Core.RequestOptions,
47
- ): Core.APIPromise<ConversationCreateResponse> {
48
- const { 'x-lorikeet-voice-public-key': xLorikeetVoicePublicKey, ...body } = params;
49
- return this._client.post('/v1/conversation/new', {
50
- body,
51
- ...options,
52
- headers: { 'x-lorikeet-voice-public-key': xLorikeetVoicePublicKey, ...options?.headers },
53
- });
54
- }
55
-
56
- /**
57
- * @example
58
- * ```ts
59
- * const response =
60
- * await client.conversation.retrieveTranscript('ticketId', {
61
- * 'x-lorikeet-voice-public-key':
62
- * 'x-lorikeet-voice-public-key',
63
- * });
64
- * ```
65
- */
66
- retrieveTranscript(
67
- ticketId: string,
68
- params: ConversationRetrieveTranscriptParams,
69
- options?: Core.RequestOptions,
70
- ): Core.APIPromise<ConversationRetrieveTranscriptResponse> {
71
- const { 'x-lorikeet-voice-public-key': xLorikeetVoicePublicKey } = params;
72
- return this._client.get(`/v1/conversation/transcript/${ticketId}`, {
73
- ...options,
74
- headers: { 'x-lorikeet-voice-public-key': xLorikeetVoicePublicKey, ...options?.headers },
75
- });
76
- }
77
31
  }
78
32
 
79
33
  export interface AttachmentDto {
@@ -155,46 +109,6 @@ export interface TicketMessageDto {
155
109
  type: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
156
110
  }
157
111
 
158
- export interface ConversationCreateResponse {
159
- /**
160
- * The id of the ticket created
161
- */
162
- ticketId: string;
163
- }
164
-
165
- export interface ConversationRetrieveTranscriptResponse {
166
- /**
167
- * The custom attributes of the conversation
168
- */
169
- customAttributes: unknown;
170
-
171
- /**
172
- * The transcript of the conversation
173
- */
174
- transcript: string;
175
- }
176
-
177
- export interface ConversationCreateParams {
178
- /**
179
- * Body param: The id of the customer in the ticketing system
180
- */
181
- customerId: string;
182
-
183
- /**
184
- * Body param: The phone number of the customer
185
- */
186
- phoneNumber: string;
187
-
188
- /**
189
- * Header param:
190
- */
191
- 'x-lorikeet-voice-public-key': string;
192
- }
193
-
194
- export interface ConversationRetrieveTranscriptParams {
195
- 'x-lorikeet-voice-public-key': string;
196
- }
197
-
198
112
  Conversation.Email = Email;
199
113
  Conversation.Chat = Chat;
200
114
  Conversation.Voice = Voice;
@@ -204,10 +118,6 @@ export declare namespace Conversation {
204
118
  type AttachmentDto as AttachmentDto,
205
119
  type TicketEvent as TicketEvent,
206
120
  type TicketMessageDto as TicketMessageDto,
207
- type ConversationCreateResponse as ConversationCreateResponse,
208
- type ConversationRetrieveTranscriptResponse as ConversationRetrieveTranscriptResponse,
209
- type ConversationCreateParams as ConversationCreateParams,
210
- type ConversationRetrieveTranscriptParams as ConversationRetrieveTranscriptParams,
211
121
  };
212
122
 
213
123
  export {
@@ -234,6 +234,11 @@ export interface EmailGenerateParams {
234
234
  * be omitted if the message is sent by the agent to the customer.
235
235
  */
236
236
  customer?: EmailGenerateParams.Customer;
237
+
238
+ /**
239
+ * The variables to be passed to the conversation - this can be used by workflows
240
+ */
241
+ variables?: { [key: string]: unknown };
237
242
  }
238
243
 
239
244
  export namespace EmailGenerateParams {
@@ -268,6 +273,11 @@ export namespace EmailGenerateParams {
268
273
  */
269
274
  lastName?: string;
270
275
 
276
+ /**
277
+ * The phone number of the customer (in international / E.164 format)
278
+ */
279
+ phoneNumber?: string;
280
+
271
281
  /**
272
282
  * The id of the customer in the ticketing system. For the SDK this needs to be
273
283
  * stable and unique
@@ -307,9 +317,14 @@ export interface EmailStartParams {
307
317
  publicKey: string;
308
318
 
309
319
  /**
310
- * The timestamp of the when the conversation was created in our system.
320
+ * The subject of the conversation.
311
321
  */
312
322
  subject?: string;
323
+
324
+ /**
325
+ * The UUID of the workflow to trigger.
326
+ */
327
+ workflowId?: string;
313
328
  }
314
329
 
315
330
  export declare namespace Email {
@@ -9,16 +9,7 @@ export {
9
9
  type ChatGetParams,
10
10
  type ChatStartParams,
11
11
  } from './chat';
12
- export {
13
- Conversation,
14
- type AttachmentDto,
15
- type TicketEvent,
16
- type TicketMessageDto,
17
- type ConversationCreateResponse,
18
- type ConversationRetrieveTranscriptResponse,
19
- type ConversationCreateParams,
20
- type ConversationRetrieveTranscriptParams,
21
- } from './conversation';
12
+ export { Conversation, type AttachmentDto, type TicketEvent, type TicketMessageDto } from './conversation';
22
13
  export {
23
14
  Email,
24
15
  type EmailGenerateResponse,
@@ -41,7 +41,9 @@ export interface VoiceOutboundParams {
41
41
  customerId?: string;
42
42
 
43
43
  /**
44
- * The input data to pass to the workflow. Only used if a workflow is specified.
44
+ * Input data to pass to workflows. Should include values for input fields defined
45
+ * by both the chosen opening workflow and - if configured - the voicemail detected
46
+ * workflow.
45
47
  */
46
48
  inputData?: unknown;
47
49