@lorikeetai/node-sdk 0.1.0-beta.4 → 0.2.0

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 (133) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +11 -11
  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.map +1 -1
  16. package/_shims/bun-runtime.mjs.map +1 -1
  17. package/_shims/index.d.ts +36 -36
  18. package/_shims/index.js +5 -5
  19. package/_shims/index.mjs +4 -4
  20. package/_shims/node-runtime.d.ts.map +1 -1
  21. package/_shims/node-runtime.js.map +1 -1
  22. package/_shims/node-runtime.mjs.map +1 -1
  23. package/_shims/node-types.d.ts +27 -27
  24. package/_shims/registry.d.ts.map +1 -1
  25. package/_shims/registry.js.map +1 -1
  26. package/_shims/registry.mjs.map +1 -1
  27. package/_shims/web-runtime.d.ts.map +1 -1
  28. package/_shims/web-runtime.js.map +1 -1
  29. package/_shims/web-runtime.mjs.map +1 -1
  30. package/_shims/web-types.d.ts +52 -52
  31. package/core.d.ts.map +1 -1
  32. package/core.js +0 -1
  33. package/core.js.map +1 -1
  34. package/core.mjs +0 -1
  35. package/core.mjs.map +1 -1
  36. package/error.d.ts.map +1 -1
  37. package/error.js.map +1 -1
  38. package/error.mjs.map +1 -1
  39. package/index.d.mts +3 -0
  40. package/index.d.ts +3 -0
  41. package/index.d.ts.map +1 -1
  42. package/index.js +3 -0
  43. package/index.js.map +1 -1
  44. package/index.mjs +3 -0
  45. package/index.mjs.map +1 -1
  46. package/lib/generate-signature.js.map +1 -1
  47. package/lib/generate-signature.mjs.map +1 -1
  48. package/package.json +1 -1
  49. package/resource.d.ts.map +1 -1
  50. package/resource.js.map +1 -1
  51. package/resource.mjs.map +1 -1
  52. package/resources/conversation/chat.d.ts +9 -5
  53. package/resources/conversation/chat.d.ts.map +1 -1
  54. package/resources/conversation/chat.js +3 -3
  55. package/resources/conversation/chat.js.map +1 -1
  56. package/resources/conversation/chat.mjs +3 -3
  57. package/resources/conversation/chat.mjs.map +1 -1
  58. package/resources/conversation/conversation.d.ts.map +1 -1
  59. package/resources/conversation/conversation.js.map +1 -1
  60. package/resources/conversation/conversation.mjs.map +1 -1
  61. package/resources/conversation/email.d.ts +6 -2
  62. package/resources/conversation/email.d.ts.map +1 -1
  63. package/resources/conversation/email.js +1 -1
  64. package/resources/conversation/email.js.map +1 -1
  65. package/resources/conversation/email.mjs +1 -1
  66. package/resources/conversation/email.mjs.map +1 -1
  67. package/resources/conversation/index.d.ts.map +1 -1
  68. package/resources/conversation/index.js.map +1 -1
  69. package/resources/customer.d.ts +61 -0
  70. package/resources/customer.d.ts.map +1 -0
  71. package/resources/customer.js +12 -0
  72. package/resources/customer.js.map +1 -0
  73. package/resources/customer.mjs +8 -0
  74. package/resources/customer.mjs.map +1 -0
  75. package/resources/index.d.ts +1 -0
  76. package/resources/index.d.ts.map +1 -1
  77. package/resources/index.js +3 -1
  78. package/resources/index.js.map +1 -1
  79. package/resources/index.mjs +1 -0
  80. package/resources/index.mjs.map +1 -1
  81. package/resources/ingest.d.ts.map +1 -1
  82. package/resources/ingest.js.map +1 -1
  83. package/resources/ingest.mjs.map +1 -1
  84. package/resources/token.d.ts.map +1 -1
  85. package/resources/token.js.map +1 -1
  86. package/resources/token.mjs.map +1 -1
  87. package/shims/node.d.ts.map +1 -1
  88. package/shims/node.js.map +1 -1
  89. package/shims/node.mjs.map +1 -1
  90. package/shims/web.d.ts.map +1 -1
  91. package/shims/web.js.map +1 -1
  92. package/shims/web.mjs.map +1 -1
  93. package/src/_shims/MultipartBody.ts +1 -1
  94. package/src/_shims/auto/runtime-bun.ts +1 -1
  95. package/src/_shims/auto/runtime-node.ts +1 -1
  96. package/src/_shims/auto/runtime.ts +1 -1
  97. package/src/_shims/auto/types-node.ts +1 -1
  98. package/src/_shims/auto/types.d.ts +52 -52
  99. package/src/_shims/bun-runtime.ts +6 -6
  100. package/src/_shims/index.d.ts +36 -36
  101. package/src/_shims/index.js +5 -5
  102. package/src/_shims/index.mjs +4 -4
  103. package/src/_shims/node-runtime.ts +32 -32
  104. package/src/_shims/node-types.d.ts +27 -27
  105. package/src/_shims/registry.ts +44 -44
  106. package/src/_shims/web-runtime.ts +16 -16
  107. package/src/_shims/web-types.d.ts +52 -52
  108. package/src/core.ts +372 -372
  109. package/src/error.ts +37 -37
  110. package/src/index.ts +74 -65
  111. package/src/lib/generate-signature.ts +3 -3
  112. package/src/resource.ts +3 -3
  113. package/src/resources/conversation/chat.ts +23 -18
  114. package/src/resources/conversation/conversation.ts +11 -11
  115. package/src/resources/conversation/email.ts +12 -7
  116. package/src/resources/conversation/index.ts +3 -3
  117. package/src/resources/customer.ts +81 -0
  118. package/src/resources/index.ts +4 -3
  119. package/src/resources/ingest.ts +7 -7
  120. package/src/resources/token.ts +9 -9
  121. package/src/shims/node.ts +24 -24
  122. package/src/shims/web.ts +24 -24
  123. package/src/uploads.ts +72 -72
  124. package/src/version.ts +1 -1
  125. package/uploads.d.ts.map +1 -1
  126. package/uploads.js.map +1 -1
  127. package/uploads.mjs.map +1 -1
  128. package/version.d.ts +1 -1
  129. package/version.d.ts.map +1 -1
  130. package/version.js +1 -1
  131. package/version.js.map +1 -1
  132. package/version.mjs +1 -1
  133. package/version.mjs.map +1 -1
package/src/error.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { castToError, Headers } from './core'
3
+ import { castToError, Headers } from './core';
4
4
 
5
5
  export class LorikeetError extends Error {}
6
6
 
7
7
  export class APIError extends LorikeetError {
8
- readonly status: number | undefined
9
- readonly headers: Headers | undefined
10
- readonly error: Object | undefined
8
+ readonly status: number | undefined;
9
+ readonly headers: Headers | undefined;
10
+ readonly error: Object | undefined;
11
11
 
12
12
  constructor(
13
13
  status: number | undefined,
@@ -15,10 +15,10 @@ export class APIError extends LorikeetError {
15
15
  message: string | undefined,
16
16
  headers: Headers | undefined,
17
17
  ) {
18
- super(`${APIError.makeMessage(status, error, message)}`)
19
- this.status = status
20
- this.headers = headers
21
- this.error = error
18
+ super(`${APIError.makeMessage(status, error, message)}`);
19
+ this.status = status;
20
+ this.headers = headers;
21
+ this.error = error;
22
22
  }
23
23
 
24
24
  private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
@@ -28,18 +28,18 @@ export class APIError extends LorikeetError {
28
28
  error.message
29
29
  : JSON.stringify(error.message)
30
30
  : error ? JSON.stringify(error)
31
- : message
31
+ : message;
32
32
 
33
33
  if (status && msg) {
34
- return `${status} ${msg}`
34
+ return `${status} ${msg}`;
35
35
  }
36
36
  if (status) {
37
- return `${status} status code (no body)`
37
+ return `${status} status code (no body)`;
38
38
  }
39
39
  if (msg) {
40
- return msg
40
+ return msg;
41
41
  }
42
- return '(no status code or body)'
42
+ return '(no status code or body)';
43
43
  }
44
44
 
45
45
  static generate(
@@ -49,98 +49,98 @@ export class APIError extends LorikeetError {
49
49
  headers: Headers | undefined,
50
50
  ): APIError {
51
51
  if (!status) {
52
- return new APIConnectionError({ message, cause: castToError(errorResponse) })
52
+ return new APIConnectionError({ message, cause: castToError(errorResponse) });
53
53
  }
54
54
 
55
- const error = errorResponse as Record<string, any>
55
+ const error = errorResponse as Record<string, any>;
56
56
 
57
57
  if (status === 400) {
58
- return new BadRequestError(status, error, message, headers)
58
+ return new BadRequestError(status, error, message, headers);
59
59
  }
60
60
 
61
61
  if (status === 401) {
62
- return new AuthenticationError(status, error, message, headers)
62
+ return new AuthenticationError(status, error, message, headers);
63
63
  }
64
64
 
65
65
  if (status === 403) {
66
- return new PermissionDeniedError(status, error, message, headers)
66
+ return new PermissionDeniedError(status, error, message, headers);
67
67
  }
68
68
 
69
69
  if (status === 404) {
70
- return new NotFoundError(status, error, message, headers)
70
+ return new NotFoundError(status, error, message, headers);
71
71
  }
72
72
 
73
73
  if (status === 409) {
74
- return new ConflictError(status, error, message, headers)
74
+ return new ConflictError(status, error, message, headers);
75
75
  }
76
76
 
77
77
  if (status === 422) {
78
- return new UnprocessableEntityError(status, error, message, headers)
78
+ return new UnprocessableEntityError(status, error, message, headers);
79
79
  }
80
80
 
81
81
  if (status === 429) {
82
- return new RateLimitError(status, error, message, headers)
82
+ return new RateLimitError(status, error, message, headers);
83
83
  }
84
84
 
85
85
  if (status >= 500) {
86
- return new InternalServerError(status, error, message, headers)
86
+ return new InternalServerError(status, error, message, headers);
87
87
  }
88
88
 
89
- return new APIError(status, error, message, headers)
89
+ return new APIError(status, error, message, headers);
90
90
  }
91
91
  }
92
92
 
93
93
  export class APIUserAbortError extends APIError {
94
- override readonly status: undefined = undefined
94
+ override readonly status: undefined = undefined;
95
95
 
96
96
  constructor({ message }: { message?: string } = {}) {
97
- super(undefined, undefined, message || 'Request was aborted.', undefined)
97
+ super(undefined, undefined, message || 'Request was aborted.', undefined);
98
98
  }
99
99
  }
100
100
 
101
101
  export class APIConnectionError extends APIError {
102
- override readonly status: undefined = undefined
102
+ override readonly status: undefined = undefined;
103
103
 
104
104
  constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
105
- super(undefined, undefined, message || 'Connection error.', undefined)
105
+ super(undefined, undefined, message || 'Connection error.', undefined);
106
106
  // in some environments the 'cause' property is already declared
107
107
  // @ts-ignore
108
- if (cause) this.cause = cause
108
+ if (cause) this.cause = cause;
109
109
  }
110
110
  }
111
111
 
112
112
  export class APIConnectionTimeoutError extends APIConnectionError {
113
113
  constructor({ message }: { message?: string } = {}) {
114
- super({ message: message ?? 'Request timed out.' })
114
+ super({ message: message ?? 'Request timed out.' });
115
115
  }
116
116
  }
117
117
 
118
118
  export class BadRequestError extends APIError {
119
- override readonly status: 400 = 400
119
+ override readonly status: 400 = 400;
120
120
  }
121
121
 
122
122
  export class AuthenticationError extends APIError {
123
- override readonly status: 401 = 401
123
+ override readonly status: 401 = 401;
124
124
  }
125
125
 
126
126
  export class PermissionDeniedError extends APIError {
127
- override readonly status: 403 = 403
127
+ override readonly status: 403 = 403;
128
128
  }
129
129
 
130
130
  export class NotFoundError extends APIError {
131
- override readonly status: 404 = 404
131
+ override readonly status: 404 = 404;
132
132
  }
133
133
 
134
134
  export class ConflictError extends APIError {
135
- override readonly status: 409 = 409
135
+ override readonly status: 409 = 409;
136
136
  }
137
137
 
138
138
  export class UnprocessableEntityError extends APIError {
139
- override readonly status: 422 = 422
139
+ override readonly status: 422 = 422;
140
140
  }
141
141
 
142
142
  export class RateLimitError extends APIError {
143
- override readonly status: 429 = 429
143
+ override readonly status: 429 = 429;
144
144
  }
145
145
 
146
146
  export class InternalServerError extends APIError {}
package/src/index.ts CHANGED
@@ -1,31 +1,32 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { type Agent } from './_shims/index'
4
- import * as Core from './core'
5
- import * as Errors from './error'
6
- import * as Uploads from './uploads'
7
- import * as API from './resources/index'
8
- import { Ingest, IngestTestParams } from './resources/ingest'
9
- import { Token, TokenCreateParams, TokenCreateResponse } from './resources/token'
10
- import { Conversation } from './resources/conversation/conversation'
3
+ import { type Agent } from './_shims/index';
4
+ import * as Core from './core';
5
+ import * as Errors from './error';
6
+ import * as Uploads from './uploads';
7
+ import * as API from './resources/index';
8
+ import { Customer, CustomerCreateParams, CustomerCreateResponse } from './resources/customer';
9
+ import { Ingest, IngestTestParams } from './resources/ingest';
10
+ import { Token, TokenCreateParams, TokenCreateResponse } from './resources/token';
11
+ import { Conversation } from './resources/conversation/conversation';
11
12
 
12
13
  export interface ClientOptions {
13
14
  /**
14
15
  * client identifier authentication associated with the account.
15
16
  */
16
- clientId?: string | undefined
17
+ clientId?: string | undefined;
17
18
 
18
19
  /**
19
20
  * Secret key pulled from the Lorikeet App
20
21
  */
21
- clientSecret?: string | undefined
22
+ clientSecret?: string | undefined;
22
23
 
23
24
  /**
24
25
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
25
26
  *
26
27
  * Defaults to process.env['LORIKEET_BASE_URL'].
27
28
  */
28
- baseURL?: string | null | undefined
29
+ baseURL?: string | null | undefined;
29
30
 
30
31
  /**
31
32
  * The maximum amount of time (in milliseconds) that the client should wait for a response
@@ -34,7 +35,7 @@ export interface ClientOptions {
34
35
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
35
36
  * much longer than this timeout before the promise succeeds or fails.
36
37
  */
37
- timeout?: number
38
+ timeout?: number;
38
39
 
39
40
  /**
40
41
  * An HTTP agent used to manage HTTP(S) connections.
@@ -42,7 +43,7 @@ export interface ClientOptions {
42
43
  * If not provided, an agent will be constructed by default in the Node.js environment,
43
44
  * otherwise no agent is used.
44
45
  */
45
- httpAgent?: Agent
46
+ httpAgent?: Agent;
46
47
 
47
48
  /**
48
49
  * Specify a custom `fetch` function implementation.
@@ -50,7 +51,7 @@ export interface ClientOptions {
50
51
  * If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
51
52
  * defined globally.
52
53
  */
53
- fetch?: Core.Fetch | undefined
54
+ fetch?: Core.Fetch | undefined;
54
55
 
55
56
  /**
56
57
  * The maximum number of times that the client will retry a request in case of a
@@ -58,7 +59,7 @@ export interface ClientOptions {
58
59
  *
59
60
  * @default 2
60
61
  */
61
- maxRetries?: number
62
+ maxRetries?: number;
62
63
 
63
64
  /**
64
65
  * Default headers to include with every request to the API.
@@ -66,7 +67,7 @@ export interface ClientOptions {
66
67
  * These can be removed in individual requests by explicitly setting the
67
68
  * header to `undefined` or `null` in request options.
68
69
  */
69
- defaultHeaders?: Core.Headers
70
+ defaultHeaders?: Core.Headers;
70
71
 
71
72
  /**
72
73
  * Default query parameters to include with every request to the API.
@@ -74,17 +75,17 @@ export interface ClientOptions {
74
75
  * These can be removed in individual requests by explicitly setting the
75
76
  * param to `undefined` in request options.
76
77
  */
77
- defaultQuery?: Core.DefaultQuery
78
+ defaultQuery?: Core.DefaultQuery;
78
79
  }
79
80
 
80
81
  /**
81
82
  * API Client for interfacing with the Lorikeet API.
82
83
  */
83
84
  export class Lorikeet extends Core.APIClient {
84
- clientId: string
85
- clientSecret: string
85
+ clientId: string;
86
+ clientSecret: string;
86
87
 
87
- private _options: ClientOptions
88
+ private _options: ClientOptions;
88
89
 
89
90
  /**
90
91
  * API Client for interfacing with the Lorikeet API.
@@ -108,12 +109,12 @@ export class Lorikeet extends Core.APIClient {
108
109
  if (clientId === undefined) {
109
110
  throw new Errors.LorikeetError(
110
111
  "The LORIKEET_CLIENT_ID environment variable is missing or empty; either provide it, or instantiate the Lorikeet client with an clientId option, like new Lorikeet({ clientId: 'My Client ID' }).",
111
- )
112
+ );
112
113
  }
113
114
  if (clientSecret === undefined) {
114
115
  throw new Errors.LorikeetError(
115
116
  "The LORIKEET_CLIENT_SECRET environment variable is missing or empty; either provide it, or instantiate the Lorikeet client with an clientSecret option, like new Lorikeet({ clientSecret: 'My Client Secret' }).",
116
- )
117
+ );
117
118
  }
118
119
 
119
120
  const options: ClientOptions = {
@@ -121,7 +122,7 @@ export class Lorikeet extends Core.APIClient {
121
122
  clientSecret,
122
123
  ...opts,
123
124
  baseURL: baseURL || `https://api.lorikeetcx.ai`,
124
- }
125
+ };
125
126
 
126
127
  super({
127
128
  baseURL: options.baseURL!,
@@ -129,27 +130,28 @@ export class Lorikeet extends Core.APIClient {
129
130
  httpAgent: options.httpAgent,
130
131
  maxRetries: options.maxRetries,
131
132
  fetch: options.fetch,
132
- })
133
+ });
133
134
 
134
- this._options = options
135
+ this._options = options;
135
136
 
136
- this.clientId = clientId
137
- this.clientSecret = clientSecret
137
+ this.clientId = clientId;
138
+ this.clientSecret = clientSecret;
138
139
  }
139
140
 
140
- conversation: API.Conversation = new API.Conversation(this)
141
- token: API.Token = new API.Token(this)
142
- ingest: API.Ingest = new API.Ingest(this)
141
+ conversation: API.Conversation = new API.Conversation(this);
142
+ token: API.Token = new API.Token(this);
143
+ customer: API.Customer = new API.Customer(this);
144
+ ingest: API.Ingest = new API.Ingest(this);
143
145
 
144
146
  protected override defaultQuery(): Core.DefaultQuery | undefined {
145
- return this._options.defaultQuery
147
+ return this._options.defaultQuery;
146
148
  }
147
149
 
148
150
  protected override defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers {
149
151
  return {
150
152
  ...super.defaultHeaders(opts),
151
153
  ...this._options.defaultHeaders,
152
- }
154
+ };
153
155
  }
154
156
 
155
157
  protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
@@ -161,34 +163,34 @@ export class Lorikeet extends Core.APIClient {
161
163
  : JSON.stringify(opts.body, null, 2)
162
164
  : '',
163
165
  this.clientSecret,
164
- )
166
+ );
165
167
  return {
166
168
  // backwards compatibility
167
169
  'x-optech-webhook-signature': signature,
168
170
  'x-lorikeet-signature': signature,
169
171
  authorization: `Bearer ${this.clientId}`,
170
- }
172
+ };
171
173
  }
172
174
 
173
- static Lorikeet = this
174
- static DEFAULT_TIMEOUT = 60000 // 1 minute
175
-
176
- static LorikeetError = Errors.LorikeetError
177
- static APIError = Errors.APIError
178
- static APIConnectionError = Errors.APIConnectionError
179
- static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError
180
- static APIUserAbortError = Errors.APIUserAbortError
181
- static NotFoundError = Errors.NotFoundError
182
- static ConflictError = Errors.ConflictError
183
- static RateLimitError = Errors.RateLimitError
184
- static BadRequestError = Errors.BadRequestError
185
- static AuthenticationError = Errors.AuthenticationError
186
- static InternalServerError = Errors.InternalServerError
187
- static PermissionDeniedError = Errors.PermissionDeniedError
188
- static UnprocessableEntityError = Errors.UnprocessableEntityError
189
-
190
- static toFile = Uploads.toFile
191
- static fileFromPath = Uploads.fileFromPath
175
+ static Lorikeet = this;
176
+ static DEFAULT_TIMEOUT = 60000; // 1 minute
177
+
178
+ static LorikeetError = Errors.LorikeetError;
179
+ static APIError = Errors.APIError;
180
+ static APIConnectionError = Errors.APIConnectionError;
181
+ static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
182
+ static APIUserAbortError = Errors.APIUserAbortError;
183
+ static NotFoundError = Errors.NotFoundError;
184
+ static ConflictError = Errors.ConflictError;
185
+ static RateLimitError = Errors.RateLimitError;
186
+ static BadRequestError = Errors.BadRequestError;
187
+ static AuthenticationError = Errors.AuthenticationError;
188
+ static InternalServerError = Errors.InternalServerError;
189
+ static PermissionDeniedError = Errors.PermissionDeniedError;
190
+ static UnprocessableEntityError = Errors.UnprocessableEntityError;
191
+
192
+ static toFile = Uploads.toFile;
193
+ static fileFromPath = Uploads.fileFromPath;
192
194
  }
193
195
 
194
196
  export {
@@ -205,28 +207,35 @@ export {
205
207
  InternalServerError,
206
208
  PermissionDeniedError,
207
209
  UnprocessableEntityError,
208
- } from './error'
210
+ } from './error';
209
211
 
210
- export import toFile = Uploads.toFile
211
- export import fileFromPath = Uploads.fileFromPath
212
- import { generateSignature } from './lib/generate-signature'
212
+ export import toFile = Uploads.toFile;
213
+ export import fileFromPath = Uploads.fileFromPath;
214
+ import { generateSignature } from './lib/generate-signature';
213
215
 
214
- Lorikeet.Conversation = Conversation
215
- Lorikeet.Token = Token
216
- Lorikeet.Ingest = Ingest
216
+ Lorikeet.Conversation = Conversation;
217
+ Lorikeet.Token = Token;
218
+ Lorikeet.Customer = Customer;
219
+ Lorikeet.Ingest = Ingest;
217
220
 
218
221
  export declare namespace Lorikeet {
219
- export type RequestOptions = Core.RequestOptions
222
+ export type RequestOptions = Core.RequestOptions;
220
223
 
221
- export { Conversation as Conversation }
224
+ export { Conversation as Conversation };
222
225
 
223
226
  export {
224
227
  Token as Token,
225
228
  type TokenCreateResponse as TokenCreateResponse,
226
229
  type TokenCreateParams as TokenCreateParams,
227
- }
230
+ };
231
+
232
+ export {
233
+ Customer as Customer,
234
+ type CustomerCreateResponse as CustomerCreateResponse,
235
+ type CustomerCreateParams as CustomerCreateParams,
236
+ };
228
237
 
229
- export { Ingest as Ingest, type IngestTestParams as IngestTestParams }
238
+ export { Ingest as Ingest, type IngestTestParams as IngestTestParams };
230
239
  }
231
240
 
232
- export default Lorikeet
241
+ export default Lorikeet;
@@ -1,4 +1,4 @@
1
- import crypto from 'crypto'
1
+ import crypto from 'crypto';
2
2
 
3
3
  /**
4
4
  * Generate a signature for a given payload using a secret key.
@@ -7,7 +7,7 @@ import crypto from 'crypto'
7
7
  */
8
8
  export function generateSignature(payload: Buffer | string | undefined, secret: string) {
9
9
  if (!payload) {
10
- return crypto.createHmac('sha256', secret).digest('base64').replace(/\+/g, '-').replace(/\//g, '_')
10
+ return crypto.createHmac('sha256', secret).digest('base64').replace(/\+/g, '-').replace(/\//g, '_');
11
11
  }
12
12
 
13
13
  return crypto
@@ -15,5 +15,5 @@ export function generateSignature(payload: Buffer | string | undefined, secret:
15
15
  .update(payload)
16
16
  .digest('base64')
17
17
  .replace(/\+/g, '-')
18
- .replace(/\//g, '_')
18
+ .replace(/\//g, '_');
19
19
  }
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,19 +1,19 @@
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'
3
+ import { APIResource } from '../../resource';
4
+ import * as Core from '../../core';
5
5
 
6
6
  export class Chat extends APIResource {
7
7
  generate(body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ChatGenerateResponse> {
8
- return this._client.post('/conversation/chat/message', { body, ...options })
8
+ return this._client.post('/v1/conversation/chat/message', { body, ...options });
9
9
  }
10
10
 
11
11
  get(query: ChatGetParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse> {
12
- return this._client.get('/conversation/chat/message', { query, ...options })
12
+ return this._client.get('/v1/conversation/chat/message', { query, ...options });
13
13
  }
14
14
 
15
15
  start(body: ChatStartParams, options?: Core.RequestOptions): Core.APIPromise<ChatStartResponse> {
16
- return this._client.post('/conversation/chat/create', { body, ...options })
16
+ return this._client.post('/v1/conversation/chat/create', { body, ...options });
17
17
  }
18
18
  }
19
19
 
@@ -21,74 +21,79 @@ export interface ChatGenerateResponse {
21
21
  /**
22
22
  * The ID of the conversation
23
23
  */
24
- conversationId: string
24
+ conversationId: unknown;
25
25
 
26
26
  /**
27
27
  * The timestamp of when the message was created in our system.
28
28
  */
29
- createdAt: string
29
+ createdAt: string;
30
30
 
31
31
  /**
32
32
  * The message to be sent back to the user. If empty, the message is still being
33
33
  * processed.
34
34
  */
35
- message: string
35
+ message: string;
36
36
  }
37
37
 
38
38
  export interface ChatGetResponse {
39
39
  /**
40
40
  * The ID of the conversation
41
41
  */
42
- conversationId: string
42
+ conversationId: unknown;
43
43
 
44
44
  /**
45
45
  * The timestamp of when the message was created in our system.
46
46
  */
47
- createdAt: string
47
+ createdAt: string;
48
48
 
49
49
  /**
50
50
  * The message to be sent back to the user. If empty, the message is still being
51
51
  * processed.
52
52
  */
53
- message: string
53
+ message: string;
54
54
  }
55
55
 
56
56
  export interface ChatStartResponse {
57
57
  /**
58
58
  * The ID of the conversation
59
59
  */
60
- conversationId: string
60
+ conversationId: unknown;
61
61
 
62
62
  /**
63
63
  * The timestamp of the when the conversation was created in our system.
64
64
  */
65
- createdAt: string
65
+ createdAt: string;
66
66
  }
67
67
 
68
68
  export interface ChatGenerateParams {
69
69
  /**
70
70
  * The ID of the conversation
71
71
  */
72
- conversationId: string
72
+ conversationId: unknown;
73
73
 
74
74
  /**
75
75
  * The message to be sent to the user. This endpoint supports markdown.
76
76
  */
77
- message: string
77
+ message: string;
78
78
  }
79
79
 
80
80
  export interface ChatGetParams {
81
81
  /**
82
82
  * The ID of the conversation you need to poll.
83
83
  */
84
- conversationId: string
84
+ conversationId: string;
85
85
  }
86
86
 
87
87
  export interface ChatStartParams {
88
88
  /**
89
89
  * The ID of the customer. If omitted, a new customer will be created.
90
90
  */
91
- customerId: string
91
+ customerId: unknown;
92
+
93
+ /**
94
+ * The timestamp of the when the conversation was created in our system.
95
+ */
96
+ subject?: string;
92
97
  }
93
98
 
94
99
  export declare namespace Chat {
@@ -99,5 +104,5 @@ export declare namespace Chat {
99
104
  type ChatGenerateParams as ChatGenerateParams,
100
105
  type ChatGetParams as ChatGetParams,
101
106
  type ChatStartParams as ChatStartParams,
102
- }
107
+ };
103
108
  }
@@ -1,7 +1,7 @@
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
  import {
6
6
  Chat,
7
7
  ChatGenerateParams,
@@ -10,24 +10,24 @@ import {
10
10
  ChatGetResponse,
11
11
  ChatStartParams,
12
12
  ChatStartResponse,
13
- } from './chat'
14
- import * as EmailAPI from './email'
15
- import { Email, EmailStartParams, EmailStartResponse } from './email'
13
+ } from './chat';
14
+ import * as EmailAPI from './email';
15
+ import { Email, EmailStartParams, EmailStartResponse } from './email';
16
16
 
17
17
  export class Conversation extends APIResource {
18
- email: EmailAPI.Email = new EmailAPI.Email(this._client)
19
- chat: ChatAPI.Chat = new ChatAPI.Chat(this._client)
18
+ email: EmailAPI.Email = new EmailAPI.Email(this._client);
19
+ chat: ChatAPI.Chat = new ChatAPI.Chat(this._client);
20
20
  }
21
21
 
22
- Conversation.Email = Email
23
- Conversation.Chat = Chat
22
+ Conversation.Email = Email;
23
+ Conversation.Chat = Chat;
24
24
 
25
25
  export declare namespace Conversation {
26
26
  export {
27
27
  Email as Email,
28
28
  type EmailStartResponse as EmailStartResponse,
29
29
  type EmailStartParams as EmailStartParams,
30
- }
30
+ };
31
31
 
32
32
  export {
33
33
  Chat as Chat,
@@ -37,5 +37,5 @@ export declare namespace Conversation {
37
37
  type ChatGenerateParams as ChatGenerateParams,
38
38
  type ChatGetParams as ChatGetParams,
39
39
  type ChatStartParams as ChatStartParams,
40
- }
40
+ };
41
41
  }