@lorikeetai/node-sdk 0.1.0-alpha.1 → 0.1.0-alpha.2
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.
- package/CHANGELOG.md +9 -0
- package/README.md +18 -12
- package/index.d.mts +15 -17
- package/index.d.ts +15 -17
- package/index.d.ts.map +1 -1
- package/index.js +26 -39
- package/index.js.map +1 -1
- package/index.mjs +26 -39
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/conversation/chat.d.ts +59 -0
- package/resources/conversation/chat.d.ts.map +1 -0
- package/resources/conversation/chat.js +29 -0
- package/resources/conversation/chat.js.map +1 -0
- package/resources/conversation/chat.mjs +25 -0
- package/resources/conversation/chat.mjs.map +1 -0
- package/resources/conversation/conversation.d.ts +13 -0
- package/resources/conversation/conversation.d.ts.map +1 -0
- package/resources/conversation/conversation.js +40 -0
- package/resources/conversation/conversation.js.map +1 -0
- package/resources/conversation/conversation.mjs +13 -0
- package/resources/conversation/conversation.mjs.map +1 -0
- package/resources/conversation/index.d.ts +3 -0
- package/resources/conversation/index.d.ts.map +1 -0
- package/resources/conversation/index.js +9 -0
- package/resources/conversation/index.js.map +1 -0
- package/resources/conversation/index.mjs +4 -0
- package/resources/conversation/index.mjs.map +1 -0
- package/resources/conversation.d.ts +0 -41
- package/resources/conversation.d.ts.map +1 -1
- package/resources/conversation.js +0 -14
- package/resources/conversation.js.map +1 -1
- package/resources/conversation.mjs +0 -14
- package/resources/conversation.mjs.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -2
- package/resources/index.mjs.map +1 -1
- package/resources/ingest.d.ts +8 -27
- package/resources/ingest.d.ts.map +1 -1
- package/resources/ingest.js +7 -17
- package/resources/ingest.js.map +1 -1
- package/resources/ingest.mjs +7 -17
- package/resources/ingest.mjs.map +1 -1
- package/resources/token.d.ts +32 -0
- package/resources/token.d.ts.map +1 -0
- package/resources/token.js +22 -0
- package/resources/token.js.map +1 -0
- package/resources/token.mjs +18 -0
- package/resources/token.mjs.map +1 -0
- package/src/index.ts +44 -58
- package/src/resources/conversation/chat.ts +83 -0
- package/src/resources/conversation/conversation.ts +16 -0
- package/src/resources/conversation/index.ts +4 -0
- package/src/resources/conversation.ts +1 -58
- package/src/resources/index.ts +3 -13
- package/src/resources/ingest.ts +17 -46
- package/src/resources/token.ts +45 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.2 (2024-10-28)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/optechai/node-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update via SDK Studio ([#6](https://github.com/optechai/node-sdk/issues/6)) ([3078f36](https://github.com/optechai/node-sdk/commit/3078f360f3957f91352415fa834418c5f8b05b71))
|
|
10
|
+
* **api:** update via SDK Studio ([#8](https://github.com/optechai/node-sdk/issues/8)) ([deaf9d5](https://github.com/optechai/node-sdk/commit/deaf9d58eb28691faae681527ec062e29eaa5b9e))
|
|
11
|
+
|
|
3
12
|
## 0.1.0-alpha.1 (2024-10-25)
|
|
4
13
|
|
|
5
14
|
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/optechai/node-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
|
package/README.md
CHANGED
|
@@ -23,11 +23,12 @@ The full API of this library can be found in [api.md](api.md).
|
|
|
23
23
|
import Lorikeet from '@lorikeetai/node-sdk';
|
|
24
24
|
|
|
25
25
|
const client = new Lorikeet({
|
|
26
|
-
|
|
26
|
+
clientId: process.env['LORIKEET_CLIENT_ID'], // This is the default and can be omitted
|
|
27
|
+
clientSecret: process.env['LORIKEET_CLIENT_SECRET'], // This is the default and can be omitted
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
async function main() {
|
|
30
|
-
const response = await client.conversation.start();
|
|
31
|
+
const response = await client.conversation.chat.start({});
|
|
31
32
|
|
|
32
33
|
console.log(response.conversationId);
|
|
33
34
|
}
|
|
@@ -44,11 +45,13 @@ This library includes TypeScript definitions for all request params and response
|
|
|
44
45
|
import Lorikeet from '@lorikeetai/node-sdk';
|
|
45
46
|
|
|
46
47
|
const client = new Lorikeet({
|
|
47
|
-
|
|
48
|
+
clientId: process.env['LORIKEET_CLIENT_ID'], // This is the default and can be omitted
|
|
49
|
+
clientSecret: process.env['LORIKEET_CLIENT_SECRET'], // This is the default and can be omitted
|
|
48
50
|
});
|
|
49
51
|
|
|
50
52
|
async function main() {
|
|
51
|
-
const
|
|
53
|
+
const params: Lorikeet.Conversation.ChatStartParams = {};
|
|
54
|
+
const response: Lorikeet.Conversation.ChatStartResponse = await client.conversation.chat.start(params);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
main();
|
|
@@ -65,7 +68,7 @@ a subclass of `APIError` will be thrown:
|
|
|
65
68
|
<!-- prettier-ignore -->
|
|
66
69
|
```ts
|
|
67
70
|
async function main() {
|
|
68
|
-
const response = await client.conversation.start().catch(async (err) => {
|
|
71
|
+
const response = await client.conversation.chat.start({}).catch(async (err) => {
|
|
69
72
|
if (err instanceof Lorikeet.APIError) {
|
|
70
73
|
console.log(err.status); // 400
|
|
71
74
|
console.log(err.name); // BadRequestError
|
|
@@ -108,7 +111,7 @@ const client = new Lorikeet({
|
|
|
108
111
|
});
|
|
109
112
|
|
|
110
113
|
// Or, configure per-request:
|
|
111
|
-
await client.conversation.start({
|
|
114
|
+
await client.conversation.chat.start({}, {
|
|
112
115
|
maxRetries: 5,
|
|
113
116
|
});
|
|
114
117
|
```
|
|
@@ -125,7 +128,7 @@ const client = new Lorikeet({
|
|
|
125
128
|
});
|
|
126
129
|
|
|
127
130
|
// Override per-request:
|
|
128
|
-
await client.conversation.start({
|
|
131
|
+
await client.conversation.chat.start({}, {
|
|
129
132
|
timeout: 5 * 1000,
|
|
130
133
|
});
|
|
131
134
|
```
|
|
@@ -146,11 +149,11 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
|
|
|
146
149
|
```ts
|
|
147
150
|
const client = new Lorikeet();
|
|
148
151
|
|
|
149
|
-
const response = await client.conversation.start().asResponse();
|
|
152
|
+
const response = await client.conversation.chat.start({}).asResponse();
|
|
150
153
|
console.log(response.headers.get('X-My-Header'));
|
|
151
154
|
console.log(response.statusText); // access the underlying Response object
|
|
152
155
|
|
|
153
|
-
const { data: response, response: raw } = await client.conversation.start().withResponse();
|
|
156
|
+
const { data: response, response: raw } = await client.conversation.chat.start({}).withResponse();
|
|
154
157
|
console.log(raw.headers.get('X-My-Header'));
|
|
155
158
|
console.log(response.conversationId);
|
|
156
159
|
```
|
|
@@ -256,9 +259,12 @@ const client = new Lorikeet({
|
|
|
256
259
|
});
|
|
257
260
|
|
|
258
261
|
// Override per-request:
|
|
259
|
-
await client.conversation.start(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
await client.conversation.chat.start(
|
|
263
|
+
{},
|
|
264
|
+
{
|
|
265
|
+
httpAgent: new http.Agent({ keepAlive: false }),
|
|
266
|
+
},
|
|
267
|
+
);
|
|
262
268
|
```
|
|
263
269
|
|
|
264
270
|
## Semantic versioning
|
package/index.d.mts
CHANGED
|
@@ -5,13 +5,13 @@ import * as Core from "./core.js";
|
|
|
5
5
|
import * as API from "./resources/index.js";
|
|
6
6
|
export interface ClientOptions {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* client identifier authentication associated with the account.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
clientId?: string | undefined;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Secret key pulled from the Lorikeet App
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
clientSecret?: string | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
17
17
|
*
|
|
@@ -66,14 +66,14 @@ export interface ClientOptions {
|
|
|
66
66
|
* API Client for interfacing with the Lorikeet API.
|
|
67
67
|
*/
|
|
68
68
|
export declare class Lorikeet extends Core.APIClient {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
clientId: string;
|
|
70
|
+
clientSecret: string;
|
|
71
71
|
private _options;
|
|
72
72
|
/**
|
|
73
73
|
* API Client for interfacing with the Lorikeet API.
|
|
74
74
|
*
|
|
75
|
-
* @param {string |
|
|
76
|
-
* @param {string |
|
|
75
|
+
* @param {string | undefined} [opts.clientId=process.env['LORIKEET_CLIENT_ID'] ?? undefined]
|
|
76
|
+
* @param {string | undefined} [opts.clientSecret=process.env['LORIKEET_CLIENT_SECRET'] ?? undefined]
|
|
77
77
|
* @param {string} [opts.baseURL=process.env['LORIKEET_BASE_URL'] ?? http://api.lorikeetcx.ai] - Override the default base URL for the API.
|
|
78
78
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
79
79
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
@@ -82,15 +82,15 @@ export declare class Lorikeet extends Core.APIClient {
|
|
|
82
82
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
83
83
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
84
84
|
*/
|
|
85
|
-
constructor({ baseURL,
|
|
85
|
+
constructor({ baseURL, clientId, clientSecret, ...opts }?: ClientOptions);
|
|
86
86
|
conversation: API.Conversation;
|
|
87
|
+
token: API.Token;
|
|
87
88
|
ingest: API.Ingest;
|
|
88
89
|
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
89
90
|
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
90
|
-
protected validateHeaders(headers: Core.Headers, customHeaders: Core.Headers): void;
|
|
91
91
|
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
92
|
-
protected
|
|
93
|
-
protected
|
|
92
|
+
protected lorikeetClientIdAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
93
|
+
protected lorikeetSignatureAuthV1Auth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
94
94
|
static Lorikeet: typeof Lorikeet;
|
|
95
95
|
static DEFAULT_TIMEOUT: number;
|
|
96
96
|
static LorikeetError: typeof Errors.LorikeetError;
|
|
@@ -115,14 +115,12 @@ export import fileFromPath = Uploads.fileFromPath;
|
|
|
115
115
|
export declare namespace Lorikeet {
|
|
116
116
|
export import RequestOptions = Core.RequestOptions;
|
|
117
117
|
export import Conversation = API.Conversation;
|
|
118
|
-
export import
|
|
119
|
-
export import
|
|
120
|
-
export import ConversationMessageParams = API.ConversationMessageParams;
|
|
118
|
+
export import Token = API.Token;
|
|
119
|
+
export import TokenCreateParams = API.TokenCreateParams;
|
|
121
120
|
export import Ingest = API.Ingest;
|
|
122
121
|
export import IngestValidateResponse = API.IngestValidateResponse;
|
|
123
|
-
export import IngestReturnWebhookParams = API.IngestReturnWebhookParams;
|
|
124
|
-
export import IngestTokenParams = API.IngestTokenParams;
|
|
125
122
|
export import IngestValidateParams = API.IngestValidateParams;
|
|
123
|
+
export import IngestWebhooksParams = API.IngestWebhooksParams;
|
|
126
124
|
}
|
|
127
125
|
export default Lorikeet;
|
|
128
126
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ import * as Core from "./core.js";
|
|
|
5
5
|
import * as API from "./resources/index.js";
|
|
6
6
|
export interface ClientOptions {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* client identifier authentication associated with the account.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
clientId?: string | undefined;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Secret key pulled from the Lorikeet App
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
clientSecret?: string | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
17
17
|
*
|
|
@@ -66,14 +66,14 @@ export interface ClientOptions {
|
|
|
66
66
|
* API Client for interfacing with the Lorikeet API.
|
|
67
67
|
*/
|
|
68
68
|
export declare class Lorikeet extends Core.APIClient {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
clientId: string;
|
|
70
|
+
clientSecret: string;
|
|
71
71
|
private _options;
|
|
72
72
|
/**
|
|
73
73
|
* API Client for interfacing with the Lorikeet API.
|
|
74
74
|
*
|
|
75
|
-
* @param {string |
|
|
76
|
-
* @param {string |
|
|
75
|
+
* @param {string | undefined} [opts.clientId=process.env['LORIKEET_CLIENT_ID'] ?? undefined]
|
|
76
|
+
* @param {string | undefined} [opts.clientSecret=process.env['LORIKEET_CLIENT_SECRET'] ?? undefined]
|
|
77
77
|
* @param {string} [opts.baseURL=process.env['LORIKEET_BASE_URL'] ?? http://api.lorikeetcx.ai] - Override the default base URL for the API.
|
|
78
78
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
79
79
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
@@ -82,15 +82,15 @@ export declare class Lorikeet extends Core.APIClient {
|
|
|
82
82
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
83
83
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
84
84
|
*/
|
|
85
|
-
constructor({ baseURL,
|
|
85
|
+
constructor({ baseURL, clientId, clientSecret, ...opts }?: ClientOptions);
|
|
86
86
|
conversation: API.Conversation;
|
|
87
|
+
token: API.Token;
|
|
87
88
|
ingest: API.Ingest;
|
|
88
89
|
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
89
90
|
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
90
|
-
protected validateHeaders(headers: Core.Headers, customHeaders: Core.Headers): void;
|
|
91
91
|
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
92
|
-
protected
|
|
93
|
-
protected
|
|
92
|
+
protected lorikeetClientIdAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
93
|
+
protected lorikeetSignatureAuthV1Auth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
94
94
|
static Lorikeet: typeof Lorikeet;
|
|
95
95
|
static DEFAULT_TIMEOUT: number;
|
|
96
96
|
static LorikeetError: typeof Errors.LorikeetError;
|
|
@@ -115,14 +115,12 @@ export import fileFromPath = Uploads.fileFromPath;
|
|
|
115
115
|
export declare namespace Lorikeet {
|
|
116
116
|
export import RequestOptions = Core.RequestOptions;
|
|
117
117
|
export import Conversation = API.Conversation;
|
|
118
|
-
export import
|
|
119
|
-
export import
|
|
120
|
-
export import ConversationMessageParams = API.ConversationMessageParams;
|
|
118
|
+
export import Token = API.Token;
|
|
119
|
+
export import TokenCreateParams = API.TokenCreateParams;
|
|
121
120
|
export import Ingest = API.Ingest;
|
|
122
121
|
export import IngestValidateResponse = API.IngestValidateResponse;
|
|
123
|
-
export import IngestReturnWebhookParams = API.IngestReturnWebhookParams;
|
|
124
|
-
export import IngestTokenParams = API.IngestTokenParams;
|
|
125
122
|
export import IngestValidateParams = API.IngestValidateParams;
|
|
123
|
+
export import IngestWebhooksParams = API.IngestWebhooksParams;
|
|
126
124
|
}
|
|
127
125
|
export default Lorikeet;
|
|
128
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,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KA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AAwB;CAC5C;AAED,eAAO,MACL,aAAa,+BACb,QAAQ,0BACR,kBAAkB,oCAClB,yBAAyB,2CACzB,iBAAiB,mCACjB,aAAa,+BACb,aAAa,+BACb,cAAc,gCACd,eAAe,iCACf,mBAAmB,qCACnB,mBAAmB,qCACnB,qBAAqB,uCACrB,wBAAwB,wCAChB,CAAC;AAEX,MAAM,QAAQ,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AACtC,MAAM,QAAQ,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAElD,yBAAiB,QAAQ,CAAC;IACxB,MAAM,QAAQ,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAEnD,MAAM,QAAQ,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IAE9C,MAAM,QAAQ,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAChC,MAAM,QAAQ,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC;IAExD,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAClC,MAAM,QAAQ,sBAAsB,GAAG,GAAG,CAAC,sBAAsB,CAAC;IAClE,MAAM,QAAQ,oBAAoB,GAAG,GAAG,CAAC,oBAAoB,CAAC;IAC9D,MAAM,QAAQ,oBAAoB,GAAG,GAAG,CAAC,oBAAoB,CAAC;CAC/D;AAED,eAAe,QAAQ,CAAC"}
|
package/index.js
CHANGED
|
@@ -37,8 +37,8 @@ class Lorikeet extends Core.APIClient {
|
|
|
37
37
|
/**
|
|
38
38
|
* API Client for interfacing with the Lorikeet API.
|
|
39
39
|
*
|
|
40
|
-
* @param {string |
|
|
41
|
-
* @param {string |
|
|
40
|
+
* @param {string | undefined} [opts.clientId=process.env['LORIKEET_CLIENT_ID'] ?? undefined]
|
|
41
|
+
* @param {string | undefined} [opts.clientSecret=process.env['LORIKEET_CLIENT_SECRET'] ?? undefined]
|
|
42
42
|
* @param {string} [opts.baseURL=process.env['LORIKEET_BASE_URL'] ?? http://api.lorikeetcx.ai] - Override the default base URL for the API.
|
|
43
43
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
44
44
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
@@ -47,10 +47,16 @@ class Lorikeet extends Core.APIClient {
|
|
|
47
47
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
48
48
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
49
49
|
*/
|
|
50
|
-
constructor({ baseURL = Core.readEnv('LORIKEET_BASE_URL'),
|
|
50
|
+
constructor({ baseURL = Core.readEnv('LORIKEET_BASE_URL'), clientId = Core.readEnv('LORIKEET_CLIENT_ID'), clientSecret = Core.readEnv('LORIKEET_CLIENT_SECRET'), ...opts } = {}) {
|
|
51
|
+
if (clientId === undefined) {
|
|
52
|
+
throw new Errors.LorikeetError("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' }).");
|
|
53
|
+
}
|
|
54
|
+
if (clientSecret === undefined) {
|
|
55
|
+
throw new Errors.LorikeetError("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' }).");
|
|
56
|
+
}
|
|
51
57
|
const options = {
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
clientId,
|
|
59
|
+
clientSecret,
|
|
54
60
|
...opts,
|
|
55
61
|
baseURL: baseURL || `http://api.lorikeetcx.ai`,
|
|
56
62
|
};
|
|
@@ -62,10 +68,11 @@ class Lorikeet extends Core.APIClient {
|
|
|
62
68
|
fetch: options.fetch,
|
|
63
69
|
});
|
|
64
70
|
this.conversation = new API.Conversation(this);
|
|
71
|
+
this.token = new API.Token(this);
|
|
65
72
|
this.ingest = new API.Ingest(this);
|
|
66
73
|
this._options = options;
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
74
|
+
this.clientId = clientId;
|
|
75
|
+
this.clientSecret = clientSecret;
|
|
69
76
|
}
|
|
70
77
|
defaultQuery() {
|
|
71
78
|
return this._options.defaultQuery;
|
|
@@ -76,43 +83,22 @@ class Lorikeet extends Core.APIClient {
|
|
|
76
83
|
...this._options.defaultHeaders,
|
|
77
84
|
};
|
|
78
85
|
}
|
|
79
|
-
validateHeaders(headers, customHeaders) {
|
|
80
|
-
if (this.bearerToken && headers['authorization']) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (customHeaders['authorization'] === null) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (this.apiKey && headers['x-optech-webhook-signature']) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (customHeaders['x-optech-webhook-signature'] === null) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
throw new Error('Could not resolve authentication method. Expected either bearerToken or apiKey to be set. Or for one of the "Authorization" or "x-optech-webhook-signature" headers to be explicitly omitted');
|
|
93
|
-
}
|
|
94
86
|
authHeaders(opts) {
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return
|
|
87
|
+
const lorikeetClientIdAuth = this.lorikeetClientIdAuth(opts);
|
|
88
|
+
const lorikeetSignatureAuthV1Auth = this.lorikeetSignatureAuthV1Auth(opts);
|
|
89
|
+
if (lorikeetClientIdAuth != null &&
|
|
90
|
+
!Core.isEmptyObj(lorikeetClientIdAuth) &&
|
|
91
|
+
lorikeetSignatureAuthV1Auth != null &&
|
|
92
|
+
!Core.isEmptyObj(lorikeetSignatureAuthV1Auth)) {
|
|
93
|
+
return { ...lorikeetClientIdAuth, ...lorikeetSignatureAuthV1Auth };
|
|
102
94
|
}
|
|
103
95
|
return {};
|
|
104
96
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return {};
|
|
108
|
-
}
|
|
109
|
-
return { Authorization: `Bearer ${this.bearerToken}` };
|
|
97
|
+
lorikeetClientIdAuth(opts) {
|
|
98
|
+
return { Authorization: `Bearer ${this.clientId}` };
|
|
110
99
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return {};
|
|
114
|
-
}
|
|
115
|
-
return { 'x-optech-webhook-signature': this.apiKey };
|
|
100
|
+
lorikeetSignatureAuthV1Auth(opts) {
|
|
101
|
+
return { 'x-optech-webhook-signature': this.clientSecret };
|
|
116
102
|
}
|
|
117
103
|
}
|
|
118
104
|
exports.Lorikeet = Lorikeet;
|
|
@@ -139,6 +125,7 @@ exports.toFile = Uploads.toFile;
|
|
|
139
125
|
exports.fileFromPath = Uploads.fileFromPath;
|
|
140
126
|
(function (Lorikeet) {
|
|
141
127
|
Lorikeet.Conversation = API.Conversation;
|
|
128
|
+
Lorikeet.Token = API.Token;
|
|
142
129
|
Lorikeet.Ingest = API.Ingest;
|
|
143
130
|
})(Lorikeet = exports.Lorikeet || (exports.Lorikeet = {}));
|
|
144
131
|
exports = module.exports = Lorikeet;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,mDAAkC;AAClC,sDAAqC;AAErC,gDAA+B;AAC/B,0DAAyC;AAsEzC;;GAEG;AACH,MAAa,QAAS,SAAQ,IAAI,CAAC,SAAS;IAM1C;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAC3C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,mDAAkC;AAClC,sDAAqC;AAErC,gDAA+B;AAC/B,0DAAyC;AAs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|
|
13
13
|
*
|
|
14
|
-
* @param {string |
|
|
15
|
-
* @param {string |
|
|
14
|
+
* @param {string | undefined} [opts.clientId=process.env['LORIKEET_CLIENT_ID'] ?? undefined]
|
|
15
|
+
* @param {string | undefined} [opts.clientSecret=process.env['LORIKEET_CLIENT_SECRET'] ?? undefined]
|
|
16
16
|
* @param {string} [opts.baseURL=process.env['LORIKEET_BASE_URL'] ?? http://api.lorikeetcx.ai] - Override the default base URL for the API.
|
|
17
17
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
18
18
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
@@ -21,10 +21,16 @@ export class Lorikeet extends Core.APIClient {
|
|
|
21
21
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
22
22
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
23
23
|
*/
|
|
24
|
-
constructor({ baseURL = Core.readEnv('LORIKEET_BASE_URL'),
|
|
24
|
+
constructor({ baseURL = Core.readEnv('LORIKEET_BASE_URL'), clientId = Core.readEnv('LORIKEET_CLIENT_ID'), clientSecret = Core.readEnv('LORIKEET_CLIENT_SECRET'), ...opts } = {}) {
|
|
25
|
+
if (clientId === undefined) {
|
|
26
|
+
throw new Errors.LorikeetError("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' }).");
|
|
27
|
+
}
|
|
28
|
+
if (clientSecret === undefined) {
|
|
29
|
+
throw new Errors.LorikeetError("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' }).");
|
|
30
|
+
}
|
|
25
31
|
const options = {
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
clientId,
|
|
33
|
+
clientSecret,
|
|
28
34
|
...opts,
|
|
29
35
|
baseURL: baseURL || `http://api.lorikeetcx.ai`,
|
|
30
36
|
};
|
|
@@ -36,10 +42,11 @@ export class Lorikeet extends Core.APIClient {
|
|
|
36
42
|
fetch: options.fetch,
|
|
37
43
|
});
|
|
38
44
|
this.conversation = new API.Conversation(this);
|
|
45
|
+
this.token = new API.Token(this);
|
|
39
46
|
this.ingest = new API.Ingest(this);
|
|
40
47
|
this._options = options;
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
48
|
+
this.clientId = clientId;
|
|
49
|
+
this.clientSecret = clientSecret;
|
|
43
50
|
}
|
|
44
51
|
defaultQuery() {
|
|
45
52
|
return this._options.defaultQuery;
|
|
@@ -50,43 +57,22 @@ export class Lorikeet extends Core.APIClient {
|
|
|
50
57
|
...this._options.defaultHeaders,
|
|
51
58
|
};
|
|
52
59
|
}
|
|
53
|
-
validateHeaders(headers, customHeaders) {
|
|
54
|
-
if (this.bearerToken && headers['authorization']) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (customHeaders['authorization'] === null) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (this.apiKey && headers['x-optech-webhook-signature']) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (customHeaders['x-optech-webhook-signature'] === null) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
throw new Error('Could not resolve authentication method. Expected either bearerToken or apiKey to be set. Or for one of the "Authorization" or "x-optech-webhook-signature" headers to be explicitly omitted');
|
|
67
|
-
}
|
|
68
60
|
authHeaders(opts) {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return
|
|
61
|
+
const lorikeetClientIdAuth = this.lorikeetClientIdAuth(opts);
|
|
62
|
+
const lorikeetSignatureAuthV1Auth = this.lorikeetSignatureAuthV1Auth(opts);
|
|
63
|
+
if (lorikeetClientIdAuth != null &&
|
|
64
|
+
!Core.isEmptyObj(lorikeetClientIdAuth) &&
|
|
65
|
+
lorikeetSignatureAuthV1Auth != null &&
|
|
66
|
+
!Core.isEmptyObj(lorikeetSignatureAuthV1Auth)) {
|
|
67
|
+
return { ...lorikeetClientIdAuth, ...lorikeetSignatureAuthV1Auth };
|
|
76
68
|
}
|
|
77
69
|
return {};
|
|
78
70
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return {};
|
|
82
|
-
}
|
|
83
|
-
return { Authorization: `Bearer ${this.bearerToken}` };
|
|
71
|
+
lorikeetClientIdAuth(opts) {
|
|
72
|
+
return { Authorization: `Bearer ${this.clientId}` };
|
|
84
73
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return {};
|
|
88
|
-
}
|
|
89
|
-
return { 'x-optech-webhook-signature': this.apiKey };
|
|
74
|
+
lorikeetSignatureAuthV1Auth(opts) {
|
|
75
|
+
return { 'x-optech-webhook-signature': this.clientSecret };
|
|
90
76
|
}
|
|
91
77
|
}
|
|
92
78
|
_a = Lorikeet;
|
|
@@ -112,6 +98,7 @@ export var toFile = Uploads.toFile;
|
|
|
112
98
|
export var fileFromPath = Uploads.fileFromPath;
|
|
113
99
|
(function (Lorikeet) {
|
|
114
100
|
Lorikeet.Conversation = API.Conversation;
|
|
101
|
+
Lorikeet.Token = API.Token;
|
|
115
102
|
Lorikeet.Ingest = API.Ingest;
|
|
116
103
|
})(Lorikeet || (Lorikeet = {}));
|
|
117
104
|
export default Lorikeet;
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAE/E,KAAK,MAAM;OACX,KAAK,OAAO;OAEZ,KAAK,IAAI;OACT,KAAK,GAAG;AAsEf;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,SAAS;IAM1C;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,OAAO,GAAG,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js";
|
|
2
|
+
import * as Core from "../../core.js";
|
|
3
|
+
import * as ChatAPI from "./chat.js";
|
|
4
|
+
export declare class Chat extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves the latest conversation message for a given conversation ID.
|
|
7
|
+
*/
|
|
8
|
+
generate(conversationId: string, body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ConversationMessage>;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the latest conversation message for a given conversation ID.
|
|
11
|
+
*/
|
|
12
|
+
get(conversationId: string, options?: Core.RequestOptions): Core.APIPromise<ConversationMessage>;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a new conversation ID.
|
|
15
|
+
*/
|
|
16
|
+
start(body: ChatStartParams, options?: Core.RequestOptions): Core.APIPromise<ChatStartResponse>;
|
|
17
|
+
}
|
|
18
|
+
export interface ConversationMessage {
|
|
19
|
+
actions?: Array<ConversationMessage.Action>;
|
|
20
|
+
/**
|
|
21
|
+
* The message content.
|
|
22
|
+
*/
|
|
23
|
+
message?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The timestamp of the message.
|
|
26
|
+
*/
|
|
27
|
+
timestamp?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare namespace ConversationMessage {
|
|
30
|
+
interface Action {
|
|
31
|
+
/**
|
|
32
|
+
* The label of the action.
|
|
33
|
+
*/
|
|
34
|
+
label?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The type of action.
|
|
37
|
+
*/
|
|
38
|
+
type?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The value of the action.
|
|
41
|
+
*/
|
|
42
|
+
value?: string;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export interface ChatStartResponse {
|
|
46
|
+
/**
|
|
47
|
+
* The unique identifier of the created conversation.
|
|
48
|
+
*/
|
|
49
|
+
conversationId?: string;
|
|
50
|
+
}
|
|
51
|
+
export type ChatGenerateParams = unknown;
|
|
52
|
+
export type ChatStartParams = unknown;
|
|
53
|
+
export declare namespace Chat {
|
|
54
|
+
export import ConversationMessage = ChatAPI.ConversationMessage;
|
|
55
|
+
export import ChatStartResponse = ChatAPI.ChatStartResponse;
|
|
56
|
+
export import ChatGenerateParams = ChatAPI.ChatGenerateParams;
|
|
57
|
+
export import ChatStartParams = ChatAPI.ChatStartParams;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,QAAQ,CAAC;AAElC,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CACN,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;IAIvC;;OAEG;IACH,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;IAIhG;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;CAGhG;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE5C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,MAAM;QACrB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AAEtC,yBAAiB,IAAI,CAAC;IACpB,MAAM,QAAQ,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAChE,MAAM,QAAQ,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAC5D,MAAM,QAAQ,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAC9D,MAAM,QAAQ,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CACzD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Chat = void 0;
|
|
5
|
+
const resource_1 = require("../../resource.js");
|
|
6
|
+
class Chat extends resource_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the latest conversation message for a given conversation ID.
|
|
9
|
+
*/
|
|
10
|
+
generate(conversationId, body, options) {
|
|
11
|
+
return this._client.post(`/conversation/chat/${conversationId}/generate`, { body, ...options });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves the latest conversation message for a given conversation ID.
|
|
15
|
+
*/
|
|
16
|
+
get(conversationId, options) {
|
|
17
|
+
return this._client.get(`/conversation/chat/${conversationId}`, options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generates a new conversation ID.
|
|
21
|
+
*/
|
|
22
|
+
start(body, options) {
|
|
23
|
+
return this._client.post('/conversation/chat/start', { body, ...options });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.Chat = Chat;
|
|
27
|
+
(function (Chat) {
|
|
28
|
+
})(Chat = exports.Chat || (exports.Chat = {}));
|
|
29
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/resources/conversation/chat.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAI7C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;OAEG;IACH,QAAQ,CACN,cAAsB,EACtB,IAAwB,EACxB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,cAAc,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,cAAsB,EAAE,OAA6B;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAqB,EAAE,OAA6B;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF;AAzBD,oBAyBC;AA8CD,WAAiB,IAAI;AAKrB,CAAC,EALgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAKpB"}
|