@lorikeetai/node-sdk 1.0.2 → 1.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.
- package/CHANGELOG.md +22 -0
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/lib/promise.d.ts +55 -0
- package/lib/promise.d.ts.map +1 -0
- package/lib/promise.js +99 -0
- package/lib/promise.js.map +1 -0
- package/lib/promise.mjs +94 -0
- package/lib/promise.mjs.map +1 -0
- package/package.json +2 -1
- package/resources/conversation/chat.d.ts +55 -2
- package/resources/conversation/chat.d.ts.map +1 -1
- package/resources/conversation/chat.js +63 -1
- package/resources/conversation/chat.js.map +1 -1
- package/resources/conversation/chat.mjs +63 -1
- package/resources/conversation/chat.mjs.map +1 -1
- package/resources/conversation/conversation.d.ts +4 -0
- package/resources/conversation/conversation.d.ts.map +1 -1
- package/resources/conversation/conversation.js +4 -0
- package/resources/conversation/conversation.js.map +1 -1
- package/resources/conversation/conversation.mjs +4 -0
- package/resources/conversation/conversation.mjs.map +1 -1
- package/resources/conversation/index.d.ts +1 -0
- package/resources/conversation/index.d.ts.map +1 -1
- package/resources/conversation/index.js +3 -1
- package/resources/conversation/index.js.map +1 -1
- package/resources/conversation/index.mjs +1 -0
- package/resources/conversation/index.mjs.map +1 -1
- package/resources/conversation/voice.d.ts +37 -0
- package/resources/conversation/voice.d.ts.map +1 -0
- package/resources/conversation/voice.js +26 -0
- package/resources/conversation/voice.js.map +1 -0
- package/resources/conversation/voice.mjs +22 -0
- package/resources/conversation/voice.mjs.map +1 -0
- package/src/index.ts +1 -0
- package/src/lib/promise.ts +101 -0
- package/src/resources/conversation/chat.ts +111 -1
- package/src/resources/conversation/conversation.ts +6 -0
- package/src/resources/conversation/index.ts +1 -0
- package/src/resources/conversation/voice.ts +50 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.mjs","sourceRoot":"","sources":["../../src/resources/conversation/chat.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,SAAS,EAAE,MAAM,qCAAqC;
|
|
1
|
+
{"version":3,"file":"chat.mjs","sourceRoot":"","sources":["../../src/resources/conversation/chat.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,9 +4,12 @@ import * as ChatAPI from "./chat.js";
|
|
|
4
4
|
import { Chat, ChatGenerateParams, ChatGenerateResponse, ChatGetParams, ChatGetResponse, ChatStartParams, ChatStartResponse } from "./chat.js";
|
|
5
5
|
import * as EmailAPI from "./email.js";
|
|
6
6
|
import { Email, EmailGenerateParams, EmailGenerateResponse, EmailGetParams, EmailGetResponse, EmailStartParams, EmailStartResponse } from "./email.js";
|
|
7
|
+
import * as VoiceAPI from "./voice.js";
|
|
8
|
+
import { Voice, VoiceOutboundParams } from "./voice.js";
|
|
7
9
|
export declare class Conversation extends APIResource {
|
|
8
10
|
email: EmailAPI.Email;
|
|
9
11
|
chat: ChatAPI.Chat;
|
|
12
|
+
voice: VoiceAPI.Voice;
|
|
10
13
|
/**
|
|
11
14
|
* @example
|
|
12
15
|
* ```ts
|
|
@@ -126,5 +129,6 @@ export declare namespace Conversation {
|
|
|
126
129
|
export { type AttachmentDto as AttachmentDto, type TicketEvent as TicketEvent, type TicketMessageDto as TicketMessageDto, type ConversationCreateResponse as ConversationCreateResponse, type ConversationRetrieveTranscriptResponse as ConversationRetrieveTranscriptResponse, type ConversationCreateParams as ConversationCreateParams, type ConversationRetrieveTranscriptParams as ConversationRetrieveTranscriptParams, };
|
|
127
130
|
export { Email as Email, type EmailGenerateResponse as EmailGenerateResponse, type EmailGetResponse as EmailGetResponse, type EmailStartResponse as EmailStartResponse, type EmailGenerateParams as EmailGenerateParams, type EmailGetParams as EmailGetParams, type EmailStartParams as EmailStartParams, };
|
|
128
131
|
export { Chat as Chat, type ChatGenerateResponse as ChatGenerateResponse, type ChatGetResponse as ChatGetResponse, type ChatStartResponse as ChatStartResponse, type ChatGenerateParams as ChatGenerateParams, type ChatGetParams as ChatGetParams, type ChatStartParams as ChatStartParams, };
|
|
132
|
+
export { Voice as Voice, type VoiceOutboundParams as VoiceOutboundParams };
|
|
129
133
|
}
|
|
130
134
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/conversation.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;AAClC,OAAO,EACL,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EAClB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,KAAK,EACL,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/conversation.ts"],"names":[],"mappings":"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"}
|
|
@@ -30,11 +30,14 @@ const ChatAPI = __importStar(require("./chat.js"));
|
|
|
30
30
|
const chat_1 = require("./chat.js");
|
|
31
31
|
const EmailAPI = __importStar(require("./email.js"));
|
|
32
32
|
const email_1 = require("./email.js");
|
|
33
|
+
const VoiceAPI = __importStar(require("./voice.js"));
|
|
34
|
+
const voice_1 = require("./voice.js");
|
|
33
35
|
class Conversation extends resource_1.APIResource {
|
|
34
36
|
constructor() {
|
|
35
37
|
super(...arguments);
|
|
36
38
|
this.email = new EmailAPI.Email(this._client);
|
|
37
39
|
this.chat = new ChatAPI.Chat(this._client);
|
|
40
|
+
this.voice = new VoiceAPI.Voice(this._client);
|
|
38
41
|
}
|
|
39
42
|
/**
|
|
40
43
|
* @example
|
|
@@ -76,4 +79,5 @@ class Conversation extends resource_1.APIResource {
|
|
|
76
79
|
exports.Conversation = Conversation;
|
|
77
80
|
Conversation.Email = email_1.Email;
|
|
78
81
|
Conversation.Chat = chat_1.Chat;
|
|
82
|
+
Conversation.Voice = voice_1.Voice;
|
|
79
83
|
//# sourceMappingURL=conversation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/resources/conversation/conversation.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAE7C,mDAAkC;AAClC,oCAQgB;AAChB,qDAAoC;AACpC,sCAQiB;
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/resources/conversation/conversation.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAE7C,mDAAkC;AAClC,oCAQgB;AAChB,qDAAoC;AACpC,sCAQiB;AACjB,qDAAoC;AACpC,sCAAqD;AAErD,MAAa,YAAa,SAAQ,sBAAW;IAA7C;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA8C3D,CAAC;IA5CC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,MAAgC,EAChC,OAA6B;QAE7B,MAAM,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACnF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC/C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACzF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,kBAAkB,CAChB,QAAgB,EAChB,MAA4C,EAC5C,OAA6B;QAE7B,MAAM,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,MAAM,CAAC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,+BAA+B,QAAQ,EAAE,EAAE;YACjE,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACzF,CAAC,CAAC;IACL,CAAC;CACF;AAjDD,oCAiDC;AAyHD,YAAY,CAAC,KAAK,GAAG,aAAK,CAAC;AAC3B,YAAY,CAAC,IAAI,GAAG,WAAI,CAAC;AACzB,YAAY,CAAC,KAAK,GAAG,aAAK,CAAC"}
|
|
@@ -4,11 +4,14 @@ import * as ChatAPI from "./chat.mjs";
|
|
|
4
4
|
import { Chat, } from "./chat.mjs";
|
|
5
5
|
import * as EmailAPI from "./email.mjs";
|
|
6
6
|
import { Email, } from "./email.mjs";
|
|
7
|
+
import * as VoiceAPI from "./voice.mjs";
|
|
8
|
+
import { Voice } from "./voice.mjs";
|
|
7
9
|
export class Conversation extends APIResource {
|
|
8
10
|
constructor() {
|
|
9
11
|
super(...arguments);
|
|
10
12
|
this.email = new EmailAPI.Email(this._client);
|
|
11
13
|
this.chat = new ChatAPI.Chat(this._client);
|
|
14
|
+
this.voice = new VoiceAPI.Voice(this._client);
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
17
|
* @example
|
|
@@ -49,4 +52,5 @@ export class Conversation extends APIResource {
|
|
|
49
52
|
}
|
|
50
53
|
Conversation.Email = Email;
|
|
51
54
|
Conversation.Chat = Chat;
|
|
55
|
+
Conversation.Voice = Voice;
|
|
52
56
|
//# sourceMappingURL=conversation.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.mjs","sourceRoot":"","sources":["../../src/resources/conversation/conversation.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,OAAO;OACZ,EACL,IAAI,GAOL;OACM,KAAK,QAAQ;OACb,EACL,KAAK,GAON;
|
|
1
|
+
{"version":3,"file":"conversation.mjs","sourceRoot":"","sources":["../../src/resources/conversation/conversation.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,OAAO;OACZ,EACL,IAAI,GAOL;OACM,KAAK,QAAQ;OACb,EACL,KAAK,GAON;OACM,KAAK,QAAQ;OACb,EAAE,KAAK,EAAuB;AAErC,MAAM,OAAO,YAAa,SAAQ,WAAW;IAA7C;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA8C3D,CAAC;IA5CC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,MAAgC,EAChC,OAA6B;QAE7B,MAAM,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACnF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC/C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACzF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,kBAAkB,CAChB,QAAgB,EAChB,MAA4C,EAC5C,OAA6B;QAE7B,MAAM,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,MAAM,CAAC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,+BAA+B,QAAQ,EAAE,EAAE;YACjE,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SACzF,CAAC,CAAC;IACL,CAAC;CACF;AAyHD,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC;AACzB,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Chat, type ChatGenerateResponse, type ChatGetResponse, type ChatStartResponse, type ChatGenerateParams, type ChatGetParams, type ChatStartParams, } from "./chat.js";
|
|
2
2
|
export { Conversation, type AttachmentDto, type TicketEvent, type TicketMessageDto, type ConversationCreateResponse, type ConversationRetrieveTranscriptResponse, type ConversationCreateParams, type ConversationRetrieveTranscriptParams, } from "./conversation.js";
|
|
3
3
|
export { Email, type EmailGenerateResponse, type EmailGetResponse, type EmailStartResponse, type EmailGenerateParams, type EmailGetParams, type EmailStartParams, } from "./email.js";
|
|
4
|
+
export { Voice, type VoiceOutboundParams } from "./voice.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,IAAI,EACJ,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC3C,KAAK,wBAAwB,EAC7B,KAAK,oCAAoC,GAC1C,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,EACL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,IAAI,EACJ,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC3C,KAAK,wBAAwB,EAC7B,KAAK,oCAAoC,GAC1C,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,EACL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Email = exports.Conversation = exports.Chat = void 0;
|
|
4
|
+
exports.Voice = exports.Email = exports.Conversation = exports.Chat = void 0;
|
|
5
5
|
var chat_1 = require("./chat.js");
|
|
6
6
|
Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_1.Chat; } });
|
|
7
7
|
var conversation_1 = require("./conversation.js");
|
|
8
8
|
Object.defineProperty(exports, "Conversation", { enumerable: true, get: function () { return conversation_1.Conversation; } });
|
|
9
9
|
var email_1 = require("./email.js");
|
|
10
10
|
Object.defineProperty(exports, "Email", { enumerable: true, get: function () { return email_1.Email; } });
|
|
11
|
+
var voice_1 = require("./voice.js");
|
|
12
|
+
Object.defineProperty(exports, "Voice", { enumerable: true, get: function () { return voice_1.Voice; } });
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/conversation/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAQgB;AAPd,4FAAA,IAAI,OAAA;AAQN,kDASwB;AARtB,4GAAA,YAAY,OAAA;AASd,oCAQiB;AAPf,8FAAA,KAAK,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/conversation/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAQgB;AAPd,4FAAA,IAAI,OAAA;AAQN,kDASwB;AARtB,4GAAA,YAAY,OAAA;AASd,oCAQiB;AAPf,8FAAA,KAAK,OAAA;AAQP,oCAA0D;AAAjD,8FAAA,KAAK,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/conversation/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,IAAI,GAOL;OACM,EACL,YAAY,GAQb;OACM,EACL,KAAK,GAON"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/conversation/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,IAAI,GAOL;OACM,EACL,YAAY,GAQb;OACM,EACL,KAAK,GAON;OACM,EAAE,KAAK,EAA4B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { APIResource } from "../../resource.js";
|
|
2
|
+
import * as Core from "../../core.js";
|
|
3
|
+
export declare class Voice extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* await client.conversation.voice.outbound({
|
|
8
|
+
* brandId: 'brandId',
|
|
9
|
+
* phoneNumber: '+61400000000',
|
|
10
|
+
* workflowId: 'workflowId',
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
outbound(body: VoiceOutboundParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface VoiceOutboundParams {
|
|
17
|
+
/**
|
|
18
|
+
* The ID of the brand to make the call from
|
|
19
|
+
*/
|
|
20
|
+
brandId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The phone number to call
|
|
23
|
+
*/
|
|
24
|
+
phoneNumber: string;
|
|
25
|
+
/**
|
|
26
|
+
* The ID of the workflow to use for the call
|
|
27
|
+
*/
|
|
28
|
+
workflowId: string;
|
|
29
|
+
/**
|
|
30
|
+
* The input data to pass to the workflow
|
|
31
|
+
*/
|
|
32
|
+
inputData?: unknown;
|
|
33
|
+
}
|
|
34
|
+
export declare namespace Voice {
|
|
35
|
+
export { type VoiceOutboundParams as VoiceOutboundParams };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=voice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/voice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;CAO1F;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC5D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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.Voice = void 0;
|
|
5
|
+
const resource_1 = require("../../resource.js");
|
|
6
|
+
class Voice extends resource_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* await client.conversation.voice.outbound({
|
|
11
|
+
* brandId: 'brandId',
|
|
12
|
+
* phoneNumber: '+61400000000',
|
|
13
|
+
* workflowId: 'workflowId',
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
outbound(body, options) {
|
|
18
|
+
return this._client.post('/v1/conversation/voice/outbound', {
|
|
19
|
+
body,
|
|
20
|
+
...options,
|
|
21
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.Voice = Voice;
|
|
26
|
+
//# sourceMappingURL=voice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.js","sourceRoot":"","sources":["../../src/resources/conversation/voice.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAG7C,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAA6B;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE;YAC1D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF;AAlBD,sBAkBC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../resource.mjs";
|
|
3
|
+
export class Voice extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* await client.conversation.voice.outbound({
|
|
8
|
+
* brandId: 'brandId',
|
|
9
|
+
* phoneNumber: '+61400000000',
|
|
10
|
+
* workflowId: 'workflowId',
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
outbound(body, options) {
|
|
15
|
+
return this._client.post('/v1/conversation/voice/outbound', {
|
|
16
|
+
body,
|
|
17
|
+
...options,
|
|
18
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=voice.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.mjs","sourceRoot":"","sources":["../../src/resources/conversation/voice.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAA6B;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE;YAC1D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a promise that can be resolved or rejected from outside the promise.
|
|
3
|
+
* Useful for creating a promise that proxies callbacks like websockets or event emitters.
|
|
4
|
+
* @example
|
|
5
|
+
* const ready = new DeferredPromise()
|
|
6
|
+
* const websocket = new WebSocket('ws://localhost:8080')
|
|
7
|
+
* websocket.on('open', () => ready.resolve())
|
|
8
|
+
* websocket.on('error', (error) => ready.reject(error))
|
|
9
|
+
*
|
|
10
|
+
* // Blocks until the websocket is ready
|
|
11
|
+
* await ready.promise
|
|
12
|
+
*/
|
|
13
|
+
export class DeferredPromise<T = void> {
|
|
14
|
+
public promise: Promise<T>;
|
|
15
|
+
public resolve!: (value: T) => void;
|
|
16
|
+
public reject!: (reason?: any) => void;
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
this.promise = new Promise<T>((resolve, reject) => {
|
|
20
|
+
this.resolve = resolve;
|
|
21
|
+
this.reject = reject;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create an async iterable that can be published to and completed from outside the constructor.
|
|
28
|
+
* Useful for creating async iterators that can be controlled externally.
|
|
29
|
+
* @example
|
|
30
|
+
* const iterable = new DeferredAsyncIterable<string>()
|
|
31
|
+
*
|
|
32
|
+
* // Push values from external source
|
|
33
|
+
* iterable.push('hello')
|
|
34
|
+
* iterable.push('world')
|
|
35
|
+
* iterable.complete()
|
|
36
|
+
*
|
|
37
|
+
* // Consume the iterator
|
|
38
|
+
* for await (const value of iterable) {
|
|
39
|
+
* console.log(value) // 'hello', 'world'
|
|
40
|
+
* }
|
|
41
|
+
*/
|
|
42
|
+
export class DeferredAsyncIterable<T> implements AsyncIterable<T> {
|
|
43
|
+
private readonly donePromise = new DeferredPromise<void>();
|
|
44
|
+
private queue: T[] = [];
|
|
45
|
+
private next = new DeferredPromise<void>();
|
|
46
|
+
private isComplete = false;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Push a value to the iterator
|
|
50
|
+
*/
|
|
51
|
+
push(value: T): void {
|
|
52
|
+
if (this.isComplete) {
|
|
53
|
+
throw new Error('Cannot push to completed iterator');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.queue.push(value);
|
|
57
|
+
this.next.resolve();
|
|
58
|
+
this.next = new DeferredPromise<void>();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Complete the iterator, causing it to finish
|
|
63
|
+
*/
|
|
64
|
+
complete(): void {
|
|
65
|
+
this.isComplete = true;
|
|
66
|
+
this.donePromise.resolve();
|
|
67
|
+
this.next.resolve();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Reject the iterator with an error
|
|
72
|
+
*/
|
|
73
|
+
reject(error: unknown): void {
|
|
74
|
+
this.isComplete = true;
|
|
75
|
+
this.donePromise.reject(error);
|
|
76
|
+
this.next.reject(error);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get done() {
|
|
80
|
+
return this.donePromise.promise;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async *[Symbol.asyncIterator](): AsyncIterator<T> {
|
|
84
|
+
for (;;) {
|
|
85
|
+
try {
|
|
86
|
+
await this.next.promise;
|
|
87
|
+
yield* this.queue;
|
|
88
|
+
this.queue = [];
|
|
89
|
+
if (this.isComplete) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
// If the next iteration went wrong, try to yield
|
|
94
|
+
// the values we have so far.
|
|
95
|
+
yield* this.queue;
|
|
96
|
+
this.queue = [];
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -4,6 +4,8 @@ import { APIResource } from '../../resource';
|
|
|
4
4
|
import * as Core from '../../core';
|
|
5
5
|
import { pollUntil } from "../../lib/poll-until";
|
|
6
6
|
import * as ConversationAPI from './conversation';
|
|
7
|
+
import { EventSource } from 'eventsource';
|
|
8
|
+
import { DeferredAsyncIterable } from "../../lib/promise";
|
|
7
9
|
|
|
8
10
|
export class Chat extends APIResource {
|
|
9
11
|
/**
|
|
@@ -96,7 +98,7 @@ export class Chat extends APIResource {
|
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
|
-
* __chat.
|
|
101
|
+
* __chat.poll__
|
|
100
102
|
*
|
|
101
103
|
* Polls until it returns a BOT chat message for a conversation.
|
|
102
104
|
*/
|
|
@@ -124,8 +126,108 @@ export class Chat extends APIResource {
|
|
|
124
126
|
},
|
|
125
127
|
) as Core.APIPromise<ChatGetResponse>;
|
|
126
128
|
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* __chat.streamUpdates__
|
|
132
|
+
*
|
|
133
|
+
* Create a persistent stream of updates for a conversation.
|
|
134
|
+
* Responses from the bot will arrive as events. Consuming clients must aggregate multiple chunks
|
|
135
|
+
* into a single message based on the messageId field. Note that new messages may arrive without
|
|
136
|
+
* new user messages, this update stream is open indefinitely and does not automatically close - avoid
|
|
137
|
+
* blocking other operations while listening to events from this generator.
|
|
138
|
+
*
|
|
139
|
+
* @param params.conversationId - Conversation/ticket ID to subscribe to.
|
|
140
|
+
* @returns AsyncGenerator<ChatStreamEvent> a generator that emits response events as they arrive.
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* for await (const evt of client.conversation.chat.streamUpdates({ conversationId: 'abc123' })) {
|
|
147
|
+
* console.log(evt);
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
streamUpdates(params: ChatStreamParams): AsyncIterable<ChatStreamEvent> {
|
|
152
|
+
const queries = new URLSearchParams();
|
|
153
|
+
queries.set('sseMessageTypes', 'new-message,message-chunk,message-complete');
|
|
154
|
+
queries.set('ticketMessageTypes', 'BOT_RESPONSE');
|
|
155
|
+
const url = `/v1/ticket/sse/${params.conversationId}?${queries.toString()}`;
|
|
156
|
+
const eventSource = new EventSource(url);
|
|
157
|
+
const output = new DeferredAsyncIterable<ChatStreamEvent>();
|
|
158
|
+
|
|
159
|
+
eventSource.addEventListener('error', (evt) => {
|
|
160
|
+
output.reject(evt);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
eventSource.addEventListener('message', (evt) => {
|
|
164
|
+
const data = JSON.parse(evt.data);
|
|
165
|
+
switch (data.type) {
|
|
166
|
+
case 'new-message':
|
|
167
|
+
output.push({
|
|
168
|
+
type: 'new-message',
|
|
169
|
+
createdAt: data.createdAt,
|
|
170
|
+
messageId: data.messageId,
|
|
171
|
+
content: data.content,
|
|
172
|
+
});
|
|
173
|
+
break;
|
|
174
|
+
case 'message-chunk':
|
|
175
|
+
output.push({
|
|
176
|
+
type: 'message-chunk',
|
|
177
|
+
contentDelta: data.contentDelta,
|
|
178
|
+
messageId: data.messageId,
|
|
179
|
+
});
|
|
180
|
+
break;
|
|
181
|
+
case 'message-complete':
|
|
182
|
+
output.push({
|
|
183
|
+
type: 'message-complete',
|
|
184
|
+
messageId: data.messageId,
|
|
185
|
+
});
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
return output;
|
|
193
|
+
}
|
|
127
194
|
}
|
|
128
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Signal that a new response message has been created and new chunks
|
|
198
|
+
* for this response for the messageId will follow.
|
|
199
|
+
*/
|
|
200
|
+
export interface ChatStreamNewMessageEvent {
|
|
201
|
+
type: 'new-message';
|
|
202
|
+
// ISO 8601 timestamp of when the message was created
|
|
203
|
+
createdAt: string;
|
|
204
|
+
messageId: string;
|
|
205
|
+
// The initial content of the message, likely empty until the first chunk arrives
|
|
206
|
+
content: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* A chunk of text response for the message with the given messageId.
|
|
211
|
+
*/
|
|
212
|
+
export interface ChatStreamMessageChunkEvent {
|
|
213
|
+
type: 'message-chunk';
|
|
214
|
+
contentDelta: string;
|
|
215
|
+
messageId: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* All chunks for a message have been received and no more chunks will follow for this message.
|
|
220
|
+
*/
|
|
221
|
+
export interface ChatStreamMessageCompleteEvent {
|
|
222
|
+
type: 'message-complete';
|
|
223
|
+
messageId: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export type ChatStreamEvent =
|
|
227
|
+
| ChatStreamNewMessageEvent
|
|
228
|
+
| ChatStreamMessageChunkEvent
|
|
229
|
+
| ChatStreamMessageCompleteEvent;
|
|
230
|
+
|
|
129
231
|
export interface ChatGenerateResponse {
|
|
130
232
|
/**
|
|
131
233
|
* The ID of the conversation
|
|
@@ -353,6 +455,13 @@ export interface ChatStartParams {
|
|
|
353
455
|
subject?: string;
|
|
354
456
|
}
|
|
355
457
|
|
|
458
|
+
export interface ChatStreamParams {
|
|
459
|
+
/**
|
|
460
|
+
* The ID of the conversation you need to stream.
|
|
461
|
+
*/
|
|
462
|
+
conversationId: string;
|
|
463
|
+
}
|
|
464
|
+
|
|
356
465
|
export declare namespace Chat {
|
|
357
466
|
export {
|
|
358
467
|
type ChatGenerateResponse as ChatGenerateResponse,
|
|
@@ -361,5 +470,6 @@ export declare namespace Chat {
|
|
|
361
470
|
type ChatGenerateParams as ChatGenerateParams,
|
|
362
471
|
type ChatGetParams as ChatGetParams,
|
|
363
472
|
type ChatStartParams as ChatStartParams,
|
|
473
|
+
type ChatStreamParams as ChatStreamParams,
|
|
364
474
|
};
|
|
365
475
|
}
|
|
@@ -22,10 +22,13 @@ import {
|
|
|
22
22
|
EmailStartParams,
|
|
23
23
|
EmailStartResponse,
|
|
24
24
|
} from './email';
|
|
25
|
+
import * as VoiceAPI from './voice';
|
|
26
|
+
import { Voice, VoiceOutboundParams } from './voice';
|
|
25
27
|
|
|
26
28
|
export class Conversation extends APIResource {
|
|
27
29
|
email: EmailAPI.Email = new EmailAPI.Email(this._client);
|
|
28
30
|
chat: ChatAPI.Chat = new ChatAPI.Chat(this._client);
|
|
31
|
+
voice: VoiceAPI.Voice = new VoiceAPI.Voice(this._client);
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
34
|
* @example
|
|
@@ -194,6 +197,7 @@ export interface ConversationRetrieveTranscriptParams {
|
|
|
194
197
|
|
|
195
198
|
Conversation.Email = Email;
|
|
196
199
|
Conversation.Chat = Chat;
|
|
200
|
+
Conversation.Voice = Voice;
|
|
197
201
|
|
|
198
202
|
export declare namespace Conversation {
|
|
199
203
|
export {
|
|
@@ -225,4 +229,6 @@ export declare namespace Conversation {
|
|
|
225
229
|
type ChatGetParams as ChatGetParams,
|
|
226
230
|
type ChatStartParams as ChatStartParams,
|
|
227
231
|
};
|
|
232
|
+
|
|
233
|
+
export { Voice as Voice, type VoiceOutboundParams as VoiceOutboundParams };
|
|
228
234
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import * as Core from '../../core';
|
|
5
|
+
|
|
6
|
+
export class Voice extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* await client.conversation.voice.outbound({
|
|
11
|
+
* brandId: 'brandId',
|
|
12
|
+
* phoneNumber: '+61400000000',
|
|
13
|
+
* workflowId: 'workflowId',
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
outbound(body: VoiceOutboundParams, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
18
|
+
return this._client.post('/v1/conversation/voice/outbound', {
|
|
19
|
+
body,
|
|
20
|
+
...options,
|
|
21
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface VoiceOutboundParams {
|
|
27
|
+
/**
|
|
28
|
+
* The ID of the brand to make the call from
|
|
29
|
+
*/
|
|
30
|
+
brandId: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The phone number to call
|
|
34
|
+
*/
|
|
35
|
+
phoneNumber: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The ID of the workflow to use for the call
|
|
39
|
+
*/
|
|
40
|
+
workflowId: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The input data to pass to the workflow
|
|
44
|
+
*/
|
|
45
|
+
inputData?: unknown;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export declare namespace Voice {
|
|
49
|
+
export { type VoiceOutboundParams as VoiceOutboundParams };
|
|
50
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.0
|
|
1
|
+
export const VERSION = '1.2.0'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0
|
|
1
|
+
export declare const VERSION = "1.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '1.0
|
|
1
|
+
export const VERSION = '1.2.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|