@lorikeetai/node-sdk 0.3.0 → 0.4.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 (69) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +29 -16
  3. package/index.d.mts +8 -5
  4. package/index.d.ts +8 -5
  5. package/index.d.ts.map +1 -1
  6. package/index.js +13 -7
  7. package/index.js.map +1 -1
  8. package/index.mjs +7 -4
  9. package/index.mjs.map +1 -1
  10. package/lib/poll-until.d.ts +20 -0
  11. package/lib/poll-until.d.ts.map +1 -0
  12. package/lib/poll-until.js +20 -0
  13. package/lib/poll-until.js.map +1 -0
  14. package/lib/poll-until.mjs +16 -0
  15. package/lib/poll-until.mjs.map +1 -0
  16. package/package.json +2 -1
  17. package/resources/conversation/chat.d.ts +73 -17
  18. package/resources/conversation/chat.d.ts.map +1 -1
  19. package/resources/conversation/chat.js +51 -0
  20. package/resources/conversation/chat.js.map +1 -1
  21. package/resources/conversation/chat.mjs +51 -0
  22. package/resources/conversation/chat.mjs.map +1 -1
  23. package/resources/conversation/conversation.d.ts +2 -2
  24. package/resources/conversation/conversation.d.ts.map +1 -1
  25. package/resources/conversation/conversation.js.map +1 -1
  26. package/resources/conversation/conversation.mjs +1 -1
  27. package/resources/conversation/conversation.mjs.map +1 -1
  28. package/resources/conversation/email.d.ts +117 -3
  29. package/resources/conversation/email.d.ts.map +1 -1
  30. package/resources/conversation/email.js +6 -0
  31. package/resources/conversation/email.js.map +1 -1
  32. package/resources/conversation/email.mjs +6 -0
  33. package/resources/conversation/email.mjs.map +1 -1
  34. package/resources/conversation/index.d.ts +1 -1
  35. package/resources/conversation/index.d.ts.map +1 -1
  36. package/resources/conversation/index.js.map +1 -1
  37. package/resources/conversation/index.mjs +1 -1
  38. package/resources/conversation/index.mjs.map +1 -1
  39. package/resources/customer.d.ts +34 -3
  40. package/resources/customer.d.ts.map +1 -1
  41. package/resources/customer.js +3 -0
  42. package/resources/customer.js.map +1 -1
  43. package/resources/customer.mjs +3 -0
  44. package/resources/customer.mjs.map +1 -1
  45. package/resources/index.d.ts +2 -1
  46. package/resources/index.d.ts.map +1 -1
  47. package/resources/index.js +3 -1
  48. package/resources/index.js.map +1 -1
  49. package/resources/index.mjs +1 -0
  50. package/resources/index.mjs.map +1 -1
  51. package/resources/workflow.d.ts +7 -0
  52. package/resources/workflow.d.ts.map +1 -0
  53. package/resources/workflow.js +18 -0
  54. package/resources/workflow.js.map +1 -0
  55. package/resources/workflow.mjs +14 -0
  56. package/resources/workflow.mjs.map +1 -0
  57. package/src/index.ts +27 -21
  58. package/src/lib/poll-until.ts +38 -0
  59. package/src/resources/conversation/chat.ts +94 -17
  60. package/src/resources/conversation/conversation.ts +13 -1
  61. package/src/resources/conversation/email.ts +154 -3
  62. package/src/resources/conversation/index.ts +9 -1
  63. package/src/resources/customer.ts +44 -2
  64. package/src/resources/index.ts +2 -0
  65. package/src/resources/workflow.ts +17 -0
  66. package/src/version.ts +1 -1
  67. package/version.d.ts +1 -1
  68. package/version.js +1 -1
  69. package/version.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1 (2024-11-20)
4
+
5
+ Full Changelog: [v0.4.0...v0.4.1](https://github.com/optechai/node-sdk/compare/v0.4.0...v0.4.1)
6
+
7
+ ### Chores
8
+
9
+ * **internal:** version bump ([#93](https://github.com/optechai/node-sdk/issues/93)) ([d1dd557](https://github.com/optechai/node-sdk/commit/d1dd55783a548cf6f41c7a2b9e197470406dbf1e))
10
+ * remove redundant word in comment ([#95](https://github.com/optechai/node-sdk/issues/95)) ([4e5f199](https://github.com/optechai/node-sdk/commit/4e5f19965cbb44b2e9d58048c1b74cd6ef45e50c))
11
+ * update logic for bot response bolling ([3a7ba21](https://github.com/optechai/node-sdk/commit/3a7ba213594537573238a2a450c0d790d991dffc))
12
+
13
+ ## 0.4.0 (2024-11-19)
14
+
15
+ Full Changelog: [v0.3.2...v0.4.0](https://github.com/optechai/node-sdk/compare/v0.3.2...v0.4.0)
16
+
17
+ ### Features
18
+
19
+ * **api:** api update ([#84](https://github.com/optechai/node-sdk/issues/84)) ([5bbd6f8](https://github.com/optechai/node-sdk/commit/5bbd6f8ef96296dd546a7b0a3c10350362018993))
20
+ * **api:** api update ([#86](https://github.com/optechai/node-sdk/issues/86)) ([40ab47e](https://github.com/optechai/node-sdk/commit/40ab47e3f6ebe7ddf6e8acc46a052386e07eb158))
21
+ * **api:** api update ([#88](https://github.com/optechai/node-sdk/issues/88)) ([1064286](https://github.com/optechai/node-sdk/commit/10642868394250a1cd542fbd448aa638896df5f7))
22
+ * **api:** api update ([#90](https://github.com/optechai/node-sdk/issues/90)) ([6951b44](https://github.com/optechai/node-sdk/commit/6951b443591763648a0db529075c8ec7882313f0))
23
+ * **api:** manual updates / ignore endpoints ([#89](https://github.com/optechai/node-sdk/issues/89)) ([a68b265](https://github.com/optechai/node-sdk/commit/a68b26515443db2c9522f5d6ad8e0c56ccfac5b0))
24
+
25
+ ## 0.3.2 (2024-11-15)
26
+
27
+ Full Changelog: [v0.3.1...v0.3.2](https://github.com/optechai/node-sdk/compare/v0.3.1...v0.3.2)
28
+
29
+ ### Chores
30
+
31
+ * **internal:** version bump ([#80](https://github.com/optechai/node-sdk/issues/80)) ([769ddc7](https://github.com/optechai/node-sdk/commit/769ddc76f3ded51a5615e29ed44d8782f5246a8b))
32
+ * rebuild project due to codegen change ([#83](https://github.com/optechai/node-sdk/issues/83)) ([491f0d8](https://github.com/optechai/node-sdk/commit/491f0d82637f8ab76db9c8236b8f4ed2d099d0a6))
33
+ * tweak docs example ([302c7e0](https://github.com/optechai/node-sdk/commit/302c7e0a489055456e01adf22d163ed6059135e9))
34
+
35
+ ## 0.3.1 (2024-11-14)
36
+
37
+ Full Changelog: [v0.3.0...v0.3.1](https://github.com/optechai/node-sdk/compare/v0.3.0...v0.3.1)
38
+
39
+ ### Features
40
+
41
+ * **api:** api update ([#75](https://github.com/optechai/node-sdk/issues/75)) ([108e553](https://github.com/optechai/node-sdk/commit/108e55335bea22bc946e43fd7661fd77cafa7d59))
42
+ * **api:** api update ([#78](https://github.com/optechai/node-sdk/issues/78)) ([6009b30](https://github.com/optechai/node-sdk/commit/6009b30741c6835942cc1886f5ca9aa53df2e7f0))
43
+ * **api:** api update ([#79](https://github.com/optechai/node-sdk/issues/79)) ([381205e](https://github.com/optechai/node-sdk/commit/381205e424f2ea33c6d13da2342d431153319e56))
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * add poll ([22f1f28](https://github.com/optechai/node-sdk/commit/22f1f287ba8383b5c129aa7029c36d8a46389499))
49
+
3
50
  ## 0.3.0 (2024-11-07)
4
51
 
5
52
  Full Changelog: [v0.2.0...v0.3.0](https://github.com/optechai/node-sdk/compare/v0.2.0...v0.3.0)
package/README.md CHANGED
@@ -28,7 +28,7 @@ const client = new Lorikeet({
28
28
  });
29
29
 
30
30
  async function main() {
31
- const response = await client.conversation.chat.start({ customerId: 'blah' });
31
+ const response = await client.conversation.chat.start({ customerId: 'blah', publicKey: 'publicKey' });
32
32
 
33
33
  console.log(response.conversationId);
34
34
  }
@@ -50,7 +50,7 @@ const client = new Lorikeet({
50
50
  });
51
51
 
52
52
  async function main() {
53
- const params: Lorikeet.Conversation.ChatStartParams = { customerId: 'blah' };
53
+ const params: Lorikeet.Conversation.ChatStartParams = { customerId: 'blah', publicKey: 'publicKey' };
54
54
  const response: Lorikeet.Conversation.ChatStartResponse = await client.conversation.chat.start(params);
55
55
  }
56
56
 
@@ -68,15 +68,17 @@ a subclass of `APIError` will be thrown:
68
68
  <!-- prettier-ignore -->
69
69
  ```ts
70
70
  async function main() {
71
- const response = await client.conversation.chat.start({ customerId: 'blah' }).catch(async (err) => {
72
- if (err instanceof Lorikeet.APIError) {
73
- console.log(err.status); // 400
74
- console.log(err.name); // BadRequestError
75
- console.log(err.headers); // {server: 'nginx', ...}
76
- } else {
77
- throw err;
78
- }
79
- });
71
+ const response = await client.conversation.chat
72
+ .start({ customerId: 'blah', publicKey: 'publicKey' })
73
+ .catch(async (err) => {
74
+ if (err instanceof Lorikeet.APIError) {
75
+ console.log(err.status); // 400
76
+ console.log(err.name); // BadRequestError
77
+ console.log(err.headers); // {server: 'nginx', ...}
78
+ } else {
79
+ throw err;
80
+ }
81
+ });
80
82
  }
81
83
 
82
84
  main();
@@ -112,7 +114,7 @@ const client = new Lorikeet({
112
114
  });
113
115
 
114
116
  // Or, configure per-request:
115
- await client.conversation.chat.start({ customerId: 'blah' }, {
117
+ await client.conversation.chat.start({ customerId: 'blah', publicKey: 'publicKey' }, {
116
118
  maxRetries: 5,
117
119
  });
118
120
  ```
@@ -130,7 +132,7 @@ const client = new Lorikeet({
130
132
  });
131
133
 
132
134
  // Override per-request:
133
- await client.conversation.chat.start({ customerId: 'blah' }, {
135
+ await client.conversation.chat.start({ customerId: 'blah', publicKey: 'publicKey' }, {
134
136
  timeout: 5 * 1000,
135
137
  });
136
138
  ```
@@ -151,12 +153,14 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
151
153
  ```ts
152
154
  const client = new Lorikeet();
153
155
 
154
- const response = await client.conversation.chat.start({ customerId: 'blah' }).asResponse();
156
+ const response = await client.conversation.chat
157
+ .start({ customerId: 'blah', publicKey: 'publicKey' })
158
+ .asResponse();
155
159
  console.log(response.headers.get('X-My-Header'));
156
160
  console.log(response.statusText); // access the underlying Response object
157
161
 
158
162
  const { data: response, response: raw } = await client.conversation.chat
159
- .start({ customerId: 'blah' })
163
+ .start({ customerId: 'blah', publicKey: 'publicKey' })
160
164
  .withResponse();
161
165
  console.log(raw.headers.get('X-My-Header'));
162
166
  console.log(response.conversationId);
@@ -265,7 +269,7 @@ const client = new Lorikeet({
265
269
 
266
270
  // Override per-request:
267
271
  await client.conversation.chat.start(
268
- { customerId: 'blah' },
272
+ { customerId: 'blah', publicKey: 'publicKey' },
269
273
  {
270
274
  httpAgent: new http.Agent({ keepAlive: false }),
271
275
  },
@@ -290,6 +294,15 @@ TypeScript >= 4.5 is supported.
290
294
 
291
295
  The following runtimes are supported:
292
296
 
297
+ - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
298
+ - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
299
+ - Deno v1.28.0 or higher.
300
+ - Bun 1.0 or later.
301
+ - Cloudflare Workers.
302
+ - Vercel Edge Runtime.
303
+ - Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
304
+ - Nitro v2.6 or greater.
305
+
293
306
  Note that React Native is not supported at this time.
294
307
 
295
308
  If you are interested in other runtime environments, please open or upvote an issue on GitHub.
package/index.d.mts CHANGED
@@ -3,8 +3,9 @@ import * as Core from "./core.js";
3
3
  import * as Errors from "./error.js";
4
4
  import * as Uploads from "./uploads.js";
5
5
  import * as API from "./resources/index.js";
6
- import { Customer, CustomerCreateParams, CustomerCreateResponse, CustomerTokenParams, CustomerTokenResponse } from "./resources/customer.js";
6
+ import { Customer, CustomerCreateParams, CustomerCreateResponse, CustomerGetResponse, CustomerTokenParams, CustomerTokenResponse } from "./resources/customer.js";
7
7
  import { Ingest, IngestTestParams } from "./resources/ingest.js";
8
+ import { Workflow } from "./resources/workflow.js";
8
9
  import { Conversation } from "./resources/conversation/conversation.js";
9
10
  export interface ClientOptions {
10
11
  /**
@@ -88,6 +89,7 @@ export declare class Lorikeet extends Core.APIClient {
88
89
  constructor({ baseURL, clientId, clientSecret, ...opts }?: ClientOptions);
89
90
  conversation: API.Conversation;
90
91
  customer: API.Customer;
92
+ workflow: API.Workflow;
91
93
  ingest: API.Ingest;
92
94
  protected defaultQuery(): Core.DefaultQuery | undefined;
93
95
  protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
@@ -110,14 +112,15 @@ export declare class Lorikeet extends Core.APIClient {
110
112
  static toFile: typeof Uploads.toFile;
111
113
  static fileFromPath: typeof Uploads.fileFromPath;
112
114
  }
113
- export { LorikeetError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
114
- export import toFile = Uploads.toFile;
115
- export import fileFromPath = Uploads.fileFromPath;
116
115
  export declare namespace Lorikeet {
117
116
  export type RequestOptions = Core.RequestOptions;
118
117
  export { Conversation as Conversation };
119
- export { Customer as Customer, type CustomerCreateResponse as CustomerCreateResponse, type CustomerTokenResponse as CustomerTokenResponse, type CustomerCreateParams as CustomerCreateParams, type CustomerTokenParams as CustomerTokenParams, };
118
+ export { Customer as Customer, type CustomerCreateResponse as CustomerCreateResponse, type CustomerGetResponse as CustomerGetResponse, type CustomerTokenResponse as CustomerTokenResponse, type CustomerCreateParams as CustomerCreateParams, type CustomerTokenParams as CustomerTokenParams, };
119
+ export { Workflow as Workflow };
120
120
  export { Ingest as Ingest, type IngestTestParams as IngestTestParams };
121
121
  }
122
+ export { toFile, fileFromPath } from "./uploads.js";
123
+ export { LorikeetError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
124
+ export { generateSignature } from '@lorikeetai/node-sdk/lib/generate-signature';
122
125
  export default Lorikeet;
123
126
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts CHANGED
@@ -3,8 +3,9 @@ import * as Core from "./core.js";
3
3
  import * as Errors from "./error.js";
4
4
  import * as Uploads from "./uploads.js";
5
5
  import * as API from "./resources/index.js";
6
- import { Customer, CustomerCreateParams, CustomerCreateResponse, CustomerTokenParams, CustomerTokenResponse } from "./resources/customer.js";
6
+ import { Customer, CustomerCreateParams, CustomerCreateResponse, CustomerGetResponse, CustomerTokenParams, CustomerTokenResponse } from "./resources/customer.js";
7
7
  import { Ingest, IngestTestParams } from "./resources/ingest.js";
8
+ import { Workflow } from "./resources/workflow.js";
8
9
  import { Conversation } from "./resources/conversation/conversation.js";
9
10
  export interface ClientOptions {
10
11
  /**
@@ -88,6 +89,7 @@ export declare class Lorikeet extends Core.APIClient {
88
89
  constructor({ baseURL, clientId, clientSecret, ...opts }?: ClientOptions);
89
90
  conversation: API.Conversation;
90
91
  customer: API.Customer;
92
+ workflow: API.Workflow;
91
93
  ingest: API.Ingest;
92
94
  protected defaultQuery(): Core.DefaultQuery | undefined;
93
95
  protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
@@ -110,14 +112,15 @@ export declare class Lorikeet extends Core.APIClient {
110
112
  static toFile: typeof Uploads.toFile;
111
113
  static fileFromPath: typeof Uploads.fileFromPath;
112
114
  }
113
- export { LorikeetError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
114
- export import toFile = Uploads.toFile;
115
- export import fileFromPath = Uploads.fileFromPath;
116
115
  export declare namespace Lorikeet {
117
116
  export type RequestOptions = Core.RequestOptions;
118
117
  export { Conversation as Conversation };
119
- export { Customer as Customer, type CustomerCreateResponse as CustomerCreateResponse, type CustomerTokenResponse as CustomerTokenResponse, type CustomerCreateParams as CustomerCreateParams, type CustomerTokenParams as CustomerTokenParams, };
118
+ export { Customer as Customer, type CustomerCreateResponse as CustomerCreateResponse, type CustomerGetResponse as CustomerGetResponse, type CustomerTokenResponse as CustomerTokenResponse, type CustomerCreateParams as CustomerCreateParams, type CustomerTokenParams as CustomerTokenParams, };
119
+ export { Workflow as Workflow };
120
120
  export { Ingest as Ingest, type IngestTestParams as IngestTestParams };
121
121
  }
122
+ export { toFile, fileFromPath } from "./uploads.js";
123
+ export { LorikeetError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
124
+ export { generateSignature } from '@lorikeetai/node-sdk/lib/generate-signature';
122
125
  export default Lorikeet;
123
126
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAEpC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAElB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAE/B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;IAE9B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC;CAClC;AAED;;GAEG;AACH,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ACL,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAEhF,eAAe,QAAQ,CAAC"}
package/index.js CHANGED
@@ -25,14 +25,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  var _a;
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.fileFromPath = exports.toFile = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.LorikeetError = exports.Lorikeet = void 0;
28
+ exports.generateSignature = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.LorikeetError = exports.fileFromPath = exports.toFile = exports.Lorikeet = void 0;
29
29
  const Core = __importStar(require("./core.js"));
30
30
  const Errors = __importStar(require("./error.js"));
31
31
  const Uploads = __importStar(require("./uploads.js"));
32
32
  const API = __importStar(require("./resources/index.js"));
33
33
  const customer_1 = require("./resources/customer.js");
34
34
  const ingest_1 = require("./resources/ingest.js");
35
+ const workflow_1 = require("./resources/workflow.js");
35
36
  const conversation_1 = require("./resources/conversation/conversation.js");
37
+ const generate_signature_1 = require("./lib/generate-signature.js");
36
38
  /**
37
39
  * API Client for interfacing with the Lorikeet API.
38
40
  */
@@ -72,6 +74,7 @@ class Lorikeet extends Core.APIClient {
72
74
  });
73
75
  this.conversation = new API.Conversation(this);
74
76
  this.customer = new API.Customer(this);
77
+ this.workflow = new API.Workflow(this);
75
78
  this.ingest = new API.Ingest(this);
76
79
  this._options = options;
77
80
  this.clientId = clientId;
@@ -120,6 +123,13 @@ Lorikeet.PermissionDeniedError = Errors.PermissionDeniedError;
120
123
  Lorikeet.UnprocessableEntityError = Errors.UnprocessableEntityError;
121
124
  Lorikeet.toFile = Uploads.toFile;
122
125
  Lorikeet.fileFromPath = Uploads.fileFromPath;
126
+ Lorikeet.Conversation = conversation_1.Conversation;
127
+ Lorikeet.Customer = customer_1.Customer;
128
+ Lorikeet.Workflow = workflow_1.Workflow;
129
+ Lorikeet.Ingest = ingest_1.Ingest;
130
+ var uploads_1 = require("./uploads.js");
131
+ Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
132
+ Object.defineProperty(exports, "fileFromPath", { enumerable: true, get: function () { return uploads_1.fileFromPath; } });
123
133
  var error_1 = require("./error.js");
124
134
  Object.defineProperty(exports, "LorikeetError", { enumerable: true, get: function () { return error_1.LorikeetError; } });
125
135
  Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
@@ -134,12 +144,8 @@ Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: f
134
144
  Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
135
145
  Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
136
146
  Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
137
- exports.toFile = Uploads.toFile;
138
- exports.fileFromPath = Uploads.fileFromPath;
139
- const generate_signature_1 = require("./lib/generate-signature.js");
140
- Lorikeet.Conversation = conversation_1.Conversation;
141
- Lorikeet.Customer = customer_1.Customer;
142
- Lorikeet.Ingest = ingest_1.Ingest;
147
+ var generate_signature_2 = require("@lorikeetai/node-sdk/lib/generate-signature");
148
+ Object.defineProperty(exports, "generateSignature", { enumerable: true, get: function () { return generate_signature_2.generateSignature; } });
143
149
  exports = module.exports = Lorikeet;
144
150
  exports.default = Lorikeet;
145
151
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtF,gDAA+B;AAC/B,mDAAkC;AAClC,sDAAqC;AACrC,0DAAyC;AACzC,sDAM8B;AAC9B,kDAA8D;AAC9D,2EAAqE;AAsErE;;GAEG;AACH,MAAa,QAAS,SAAQ,IAAI,CAAC,SAAS;IAM1C;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAC3C,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAC7C,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,EACrD,GAAG,IAAI,KACU,EAAE;QACnB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,MAAM,CAAC,aAAa,CAC5B,kMAAkM,CACnM,CAAC;QACJ,CAAC;QACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,MAAM,CAAC,aAAa,CAC5B,kNAAkN,CACnN,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAkB;YAC7B,QAAQ;YACR,YAAY;YACZ,GAAG,IAAI;YACP,OAAO,EAAE,OAAO,IAAI,2BAA2B;SAChD,CAAC;QAEF,KAAK,CAAC;YACJ,OAAO,EAAE,OAAO,CAAC,OAAQ;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC,cAAc;YAChD,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;SAC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,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA;AAG1B,kFAAgF;AAAvE,uHAAA,iBAAiB,OAAA;AAE1B,kBAAe,QAAQ,CAAC"}
package/index.mjs CHANGED
@@ -6,7 +6,9 @@ import * as Uploads from "./uploads.mjs";
6
6
  import * as API from "./resources/index.mjs";
7
7
  import { Customer, } from "./resources/customer.mjs";
8
8
  import { Ingest } from "./resources/ingest.mjs";
9
+ import { Workflow } from "./resources/workflow.mjs";
9
10
  import { Conversation } from "./resources/conversation/conversation.mjs";
11
+ import { generateSignature } from "./lib/generate-signature.mjs";
10
12
  /**
11
13
  * API Client for interfacing with the Lorikeet API.
12
14
  */
@@ -46,6 +48,7 @@ export class Lorikeet extends Core.APIClient {
46
48
  });
47
49
  this.conversation = new API.Conversation(this);
48
50
  this.customer = new API.Customer(this);
51
+ this.workflow = new API.Workflow(this);
49
52
  this.ingest = new API.Ingest(this);
50
53
  this._options = options;
51
54
  this.clientId = clientId;
@@ -93,12 +96,12 @@ Lorikeet.PermissionDeniedError = Errors.PermissionDeniedError;
93
96
  Lorikeet.UnprocessableEntityError = Errors.UnprocessableEntityError;
94
97
  Lorikeet.toFile = Uploads.toFile;
95
98
  Lorikeet.fileFromPath = Uploads.fileFromPath;
96
- export { LorikeetError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.mjs";
97
- export var toFile = Uploads.toFile;
98
- export var fileFromPath = Uploads.fileFromPath;
99
- import { generateSignature } from "./lib/generate-signature.mjs";
100
99
  Lorikeet.Conversation = Conversation;
101
100
  Lorikeet.Customer = Customer;
101
+ Lorikeet.Workflow = Workflow;
102
102
  Lorikeet.Ingest = Ingest;
103
+ export { toFile, fileFromPath } from "./uploads.mjs";
104
+ export { LorikeetError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.mjs";
105
+ export { generateSignature } from '@lorikeetai/node-sdk/lib/generate-signature';
103
106
  export default Lorikeet;
104
107
  //# sourceMappingURL=index.mjs.map
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,KAAK,IAAI;OACT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EACL,QAAQ,GAKT;OACM,EAAE,MAAM,EAAoB;OAC5B,EAAE,YAAY,EAAE;AAsEvB;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,SAAS;IAM1C;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAC3C,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAC7C,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,EACrD,GAAG,IAAI,KACU,EAAE;QACnB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,MAAM,CAAC,aAAa,CAC5B,kMAAkM,CACnM,CAAC;QACJ,CAAC;QACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,MAAM,CAAC,aAAa,CAC5B,kNAAkN,CACnN,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAkB;YAC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C,MAAM,GAAG,MAAM,CAAC;OAoBlB,EAAE,MAAM,EAAE,YAAY,EAAE;OACxB,EACL,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OAEM,EAAE,iBAAiB,EAAE,MAAM,6CAA6C;AAE/E,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,20 @@
1
+ interface PollUntilOptions<TData> {
2
+ /**
3
+ * The maximum time to wait for the condition to be met (ms).
4
+ */
5
+ timeout?: number;
6
+ /**
7
+ * The interval between each poll (ms).
8
+ */
9
+ interval?: number;
10
+ /**
11
+ *
12
+ * @param result The result of the polling function.
13
+ * @returns
14
+ */
15
+ condition: (result: TData) => boolean;
16
+ }
17
+ /** Utility function to poll an endpoint. */
18
+ export declare const pollUntil: <T>(fn: () => Promise<T>, { condition, interval, timeout }: PollUntilOptions<T>) => Promise<T>;
19
+ export {};
20
+ //# sourceMappingURL=poll-until.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll-until.d.ts","sourceRoot":"","sources":["../src/lib/poll-until.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB,CAAC,KAAK;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,OAAO,CAAC;CACvC;AAED,4CAA4C;AAC5C,eAAO,MAAM,SAAS,GAAU,CAAC,MAC3B,MAAM,OAAO,CAAC,CAAC,CAAC,oCACoD,gBAAgB,CAAC,CAAC,CAAC,KAC1F,OAAO,CAAC,CAAC,CAgBX,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pollUntil = void 0;
4
+ /** Utility function to poll an endpoint. */
5
+ const pollUntil = async (fn, { condition = (result) => !!result, interval = 3000, timeout = 30000 }) => {
6
+ const startTime = Date.now();
7
+ if (interval < 1000) {
8
+ throw new Error(`Polling interval must be at least 1000ms`);
9
+ }
10
+ while (Date.now() - startTime < timeout) {
11
+ const result = await fn();
12
+ if (condition(result)) {
13
+ return result;
14
+ }
15
+ await new Promise((resolve) => setTimeout(resolve, interval));
16
+ }
17
+ throw new Error(`Polling timed out`);
18
+ };
19
+ exports.pollUntil = pollUntil;
20
+ //# sourceMappingURL=poll-until.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll-until.js","sourceRoot":"","sources":["../src/lib/poll-until.ts"],"names":[],"mappings":";;;AAiBA,4CAA4C;AACrC,MAAM,SAAS,GAAG,KAAK,EAC5B,EAAoB,EACpB,EAAE,SAAS,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,OAAO,GAAG,KAAK,EAAuB,EAC/E,EAAE;IACd,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,QAAQ,GAAG,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACvC,CAAC,CAAC;AAnBW,QAAA,SAAS,aAmBpB"}
@@ -0,0 +1,16 @@
1
+ /** Utility function to poll an endpoint. */
2
+ export const pollUntil = async (fn, { condition = (result) => !!result, interval = 3000, timeout = 30000 }) => {
3
+ const startTime = Date.now();
4
+ if (interval < 1000) {
5
+ throw new Error(`Polling interval must be at least 1000ms`);
6
+ }
7
+ while (Date.now() - startTime < timeout) {
8
+ const result = await fn();
9
+ if (condition(result)) {
10
+ return result;
11
+ }
12
+ await new Promise((resolve) => setTimeout(resolve, interval));
13
+ }
14
+ throw new Error(`Polling timed out`);
15
+ };
16
+ //# sourceMappingURL=poll-until.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll-until.mjs","sourceRoot":"","sources":["../src/lib/poll-until.ts"],"names":[],"mappings":"AAiBA,4CAA4C;AAC5C,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,EAAoB,EACpB,EAAE,SAAS,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,OAAO,GAAG,KAAK,EAAuB,EAC/E,EAAE;IACd,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,QAAQ,GAAG,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACvC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lorikeetai/node-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "The official TypeScript library for the Lorikeet API",
5
5
  "author": "Lorikeet <support@lorikeetcx.ai>",
6
6
  "types": "./index.d.ts",
@@ -95,6 +95,7 @@
95
95
  }
96
96
  },
97
97
  "scripts": {
98
+ "dev": "node --env-file=.env ./examples/test.mjs",
98
99
  "test": "./scripts/test",
99
100
  "build": "./scripts/build",
100
101
  "format": "prettier --write --cache --cache-strategy metadata . !dist",
@@ -1,32 +1,75 @@
1
1
  import { APIResource } from "../../resource.js";
2
2
  import * as Core from "../../core.js";
3
3
  export declare class Chat extends APIResource {
4
+ /**
5
+ * __chat.generate__
6
+ *
7
+ * Generate a chat message for a conversation. This endpoint will return immediately, polling will be required to get the response.
8
+ *
9
+ * The `latestMessageType` field in the response can be used to determine if the response is ready.
10
+ *
11
+ * If the `latestMessageType` is `BOT_RESPONSE`, the response is ready.
12
+ * For a more ergonomic way to poll, use the `message` method.
13
+ *
14
+ * ** WARNING ** This endpoint is not idempotent. If you call it multiple times, you will generate multiple messages.
15
+ *
16
+ * @see {@link Chat.message}
17
+ */
4
18
  generate(body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ChatGenerateResponse>;
19
+ /**
20
+ * __chat.get__
21
+ *
22
+ * Returns a chat message for a conversation. This endpoint will return the latest state of the conversation.
23
+ */
5
24
  get(query: ChatGetParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse>;
25
+ /**
26
+ * __chat.start__
27
+ *
28
+ * Start a chat conversation. This endpoint will return immediately.
29
+ *
30
+ * The `conversationId` field in the response can be used to generate messages.
31
+ *
32
+ * ** WARNING ** This endpoint is not idempotent. If you call it multiple times, you will generate multiple conversations.
33
+ */
6
34
  start(body: ChatStartParams, options?: Core.RequestOptions): Core.APIPromise<ChatStartResponse>;
35
+ /**
36
+ * Returns a chat message for a conversation. This endpoint will poll until a response is ready.
37
+ *
38
+ * When it return the response is the latest message type that is of type `BOT_RESPONSE`.
39
+ *
40
+ * @see {@link Chat.poll}
41
+ */
42
+ message(body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse>;
43
+ /**
44
+ * __chat.get__
45
+ *
46
+ * Polls until it returns a BOT chat message for a conversation.
47
+ */
48
+ poll(query: ChatGetParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse>;
7
49
  }
8
50
  export interface ChatGenerateResponse {
9
51
  /**
10
52
  * The ID of the conversation
11
53
  */
12
- conversationId: unknown;
54
+ conversationId: string;
13
55
  /**
14
- * The timestamp of when the message was created in our system.
56
+ * The timestamp of the when the conversation was created in our system.
15
57
  */
16
58
  createdAt: string;
17
59
  /**
18
- * The created message. This endpoint supports markdown.
60
+ * The latest message type - useful for polling
19
61
  */
20
- message: ChatGenerateResponse.Message;
62
+ latestMessageType: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
63
+ /**
64
+ * The full list of messages. This endpoint supports markdown.
65
+ */
66
+ messages: Array<ChatGenerateResponse.Message>;
21
67
  /**
22
68
  * The timestamp of when the ticket was last updated in our system.
23
69
  */
24
70
  updatedAt: string;
25
71
  }
26
72
  export declare namespace ChatGenerateResponse {
27
- /**
28
- * The created message. This endpoint supports markdown.
29
- */
30
73
  interface Message {
31
74
  /**
32
75
  * The ID of the conversation message
@@ -36,6 +79,10 @@ export declare namespace ChatGenerateResponse {
36
79
  * The content of the message. Markdown on plain text.
37
80
  */
38
81
  content: string;
82
+ /**
83
+ * The timestamp of the message.
84
+ */
85
+ createdAt: string;
39
86
  /**
40
87
  * The raw content of the message. Usually HTML.
41
88
  */
@@ -50,24 +97,25 @@ export interface ChatGetResponse {
50
97
  /**
51
98
  * The ID of the conversation
52
99
  */
53
- conversationId: unknown;
100
+ conversationId: string;
54
101
  /**
55
- * The timestamp of when the message was created in our system.
102
+ * The timestamp of the when the conversation was created in our system.
56
103
  */
57
104
  createdAt: string;
58
105
  /**
59
- * The created message. This endpoint supports markdown.
106
+ * The latest message type - useful for polling
107
+ */
108
+ latestMessageType: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
109
+ /**
110
+ * The full list of messages. This endpoint supports markdown.
60
111
  */
61
- message: ChatGetResponse.Message;
112
+ messages: Array<ChatGetResponse.Message>;
62
113
  /**
63
114
  * The timestamp of when the ticket was last updated in our system.
64
115
  */
65
116
  updatedAt: string;
66
117
  }
67
118
  export declare namespace ChatGetResponse {
68
- /**
69
- * The created message. This endpoint supports markdown.
70
- */
71
119
  interface Message {
72
120
  /**
73
121
  * The ID of the conversation message
@@ -77,6 +125,10 @@ export declare namespace ChatGetResponse {
77
125
  * The content of the message. Markdown on plain text.
78
126
  */
79
127
  content: string;
128
+ /**
129
+ * The timestamp of the message.
130
+ */
131
+ createdAt: string;
80
132
  /**
81
133
  * The raw content of the message. Usually HTML.
82
134
  */
@@ -91,7 +143,7 @@ export interface ChatStartResponse {
91
143
  /**
92
144
  * The ID of the conversation
93
145
  */
94
- conversationId: unknown;
146
+ conversationId: string;
95
147
  /**
96
148
  * The timestamp of the when the conversation was created in our system.
97
149
  */
@@ -101,7 +153,7 @@ export interface ChatGenerateParams {
101
153
  /**
102
154
  * The ID of the conversation
103
155
  */
104
- conversationId: unknown;
156
+ conversationId: string;
105
157
  /**
106
158
  * The message to be sent to the user. This endpoint supports markdown.
107
159
  */
@@ -117,7 +169,11 @@ export interface ChatStartParams {
117
169
  /**
118
170
  * The ID of the customer. If omitted, a new customer will be created.
119
171
  */
120
- customerId: unknown;
172
+ customerId: string;
173
+ /**
174
+ * The public key associated with this agent
175
+ */
176
+ publicKey: string;
121
177
  /**
122
178
  * The timestamp of the when the conversation was created in our system.
123
179
  */