phonic 0.12.0 → 0.13.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/README.md +16 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +22 -2
- package/dist/index.mjs +22 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Node.js library for the Phonic API.
|
|
|
9
9
|
- [Get voice by id](#get-voice-by-id)
|
|
10
10
|
- [Get conversation by id](#get-conversation-by-id)
|
|
11
11
|
- [Get conversation by external id](#get-conversation-by-external-id)
|
|
12
|
+
- [List conversations](#list-conversations)
|
|
12
13
|
- [Speech-to-speech via WebSocket](#speech-to-speech-via-websocket)
|
|
13
14
|
|
|
14
15
|
## Installation
|
|
@@ -70,6 +71,21 @@ if (error === null) {
|
|
|
70
71
|
}
|
|
71
72
|
```
|
|
72
73
|
|
|
74
|
+
### List conversations
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
const { data, error } = await phonic.conversations.list({
|
|
78
|
+
durationMin: 10000, // ms
|
|
79
|
+
durationMax: 20000, // ms
|
|
80
|
+
startedAtMin: "2025-04-17", // 00:00:00 UTC time is assumed
|
|
81
|
+
startedAtMax: "2025-09-05T10:30:00.000Z",
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (error === null) {
|
|
85
|
+
console.log(data.conversations);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
73
89
|
### Speech-to-speech via WebSocket
|
|
74
90
|
|
|
75
91
|
To start a conversation, open a WebSocket connection:
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,8 @@ type DataOrError<T> = Promise<{
|
|
|
19
19
|
data: null;
|
|
20
20
|
error: ErrorResponse;
|
|
21
21
|
}>;
|
|
22
|
+
type ISODate = `${string}-${string}-${string}`;
|
|
23
|
+
type ISODateTime$1 = `${string}Z`;
|
|
22
24
|
|
|
23
25
|
type ISODateTime = `${string}Z`;
|
|
24
26
|
type ConversationItem = {
|
|
@@ -53,12 +55,21 @@ type Conversation = {
|
|
|
53
55
|
type ConversationSuccessResponse = {
|
|
54
56
|
conversation: Conversation;
|
|
55
57
|
};
|
|
58
|
+
type ConversationsSuccessResponse = {
|
|
59
|
+
conversations: Array<Conversation>;
|
|
60
|
+
};
|
|
56
61
|
|
|
57
62
|
declare class Conversations {
|
|
58
63
|
private readonly phonic;
|
|
59
64
|
constructor(phonic: Phonic);
|
|
60
65
|
get(id: string): DataOrError<ConversationSuccessResponse>;
|
|
61
66
|
getByExternalId(externalId: string): DataOrError<ConversationSuccessResponse>;
|
|
67
|
+
list({ durationMin, durationMax, startedAtMin, startedAtMax, }: {
|
|
68
|
+
durationMin?: number;
|
|
69
|
+
durationMax?: number;
|
|
70
|
+
startedAtMin?: ISODate | ISODateTime$1;
|
|
71
|
+
startedAtMax?: ISODate | ISODateTime$1;
|
|
72
|
+
}): DataOrError<ConversationsSuccessResponse>;
|
|
62
73
|
}
|
|
63
74
|
|
|
64
75
|
type PhonicSTSConfig = {
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ type DataOrError<T> = Promise<{
|
|
|
19
19
|
data: null;
|
|
20
20
|
error: ErrorResponse;
|
|
21
21
|
}>;
|
|
22
|
+
type ISODate = `${string}-${string}-${string}`;
|
|
23
|
+
type ISODateTime$1 = `${string}Z`;
|
|
22
24
|
|
|
23
25
|
type ISODateTime = `${string}Z`;
|
|
24
26
|
type ConversationItem = {
|
|
@@ -53,12 +55,21 @@ type Conversation = {
|
|
|
53
55
|
type ConversationSuccessResponse = {
|
|
54
56
|
conversation: Conversation;
|
|
55
57
|
};
|
|
58
|
+
type ConversationsSuccessResponse = {
|
|
59
|
+
conversations: Array<Conversation>;
|
|
60
|
+
};
|
|
56
61
|
|
|
57
62
|
declare class Conversations {
|
|
58
63
|
private readonly phonic;
|
|
59
64
|
constructor(phonic: Phonic);
|
|
60
65
|
get(id: string): DataOrError<ConversationSuccessResponse>;
|
|
61
66
|
getByExternalId(externalId: string): DataOrError<ConversationSuccessResponse>;
|
|
67
|
+
list({ durationMin, durationMax, startedAtMin, startedAtMax, }: {
|
|
68
|
+
durationMin?: number;
|
|
69
|
+
durationMax?: number;
|
|
70
|
+
startedAtMin?: ISODate | ISODateTime$1;
|
|
71
|
+
startedAtMax?: ISODate | ISODateTime$1;
|
|
72
|
+
}): DataOrError<ConversationsSuccessResponse>;
|
|
62
73
|
}
|
|
63
74
|
|
|
64
75
|
type PhonicSTSConfig = {
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// package.json
|
|
38
|
-
var version = "0.
|
|
38
|
+
var version = "0.13.0";
|
|
39
39
|
|
|
40
40
|
// src/conversations/index.ts
|
|
41
41
|
var Conversations = class {
|
|
@@ -49,8 +49,28 @@ var Conversations = class {
|
|
|
49
49
|
return response;
|
|
50
50
|
}
|
|
51
51
|
async getByExternalId(externalId) {
|
|
52
|
+
const queryString = new URLSearchParams({
|
|
53
|
+
external_id: externalId
|
|
54
|
+
}).toString();
|
|
55
|
+
const response = await this.phonic.get(
|
|
56
|
+
`/conversations?${queryString}`
|
|
57
|
+
);
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
async list({
|
|
61
|
+
durationMin,
|
|
62
|
+
durationMax,
|
|
63
|
+
startedAtMin,
|
|
64
|
+
startedAtMax
|
|
65
|
+
}) {
|
|
66
|
+
const queryString = new URLSearchParams({
|
|
67
|
+
...durationMin !== void 0 && { duration_min: String(durationMin) },
|
|
68
|
+
...durationMax !== void 0 && { duration_max: String(durationMax) },
|
|
69
|
+
...startedAtMin !== void 0 && { started_at_min: startedAtMin },
|
|
70
|
+
...startedAtMax !== void 0 && { started_at_max: startedAtMax }
|
|
71
|
+
}).toString();
|
|
52
72
|
const response = await this.phonic.get(
|
|
53
|
-
`/conversations
|
|
73
|
+
`/conversations?${queryString}`
|
|
54
74
|
);
|
|
55
75
|
return response;
|
|
56
76
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.13.0";
|
|
3
3
|
|
|
4
4
|
// src/conversations/index.ts
|
|
5
5
|
var Conversations = class {
|
|
@@ -13,8 +13,28 @@ var Conversations = class {
|
|
|
13
13
|
return response;
|
|
14
14
|
}
|
|
15
15
|
async getByExternalId(externalId) {
|
|
16
|
+
const queryString = new URLSearchParams({
|
|
17
|
+
external_id: externalId
|
|
18
|
+
}).toString();
|
|
19
|
+
const response = await this.phonic.get(
|
|
20
|
+
`/conversations?${queryString}`
|
|
21
|
+
);
|
|
22
|
+
return response;
|
|
23
|
+
}
|
|
24
|
+
async list({
|
|
25
|
+
durationMin,
|
|
26
|
+
durationMax,
|
|
27
|
+
startedAtMin,
|
|
28
|
+
startedAtMax
|
|
29
|
+
}) {
|
|
30
|
+
const queryString = new URLSearchParams({
|
|
31
|
+
...durationMin !== void 0 && { duration_min: String(durationMin) },
|
|
32
|
+
...durationMax !== void 0 && { duration_max: String(durationMax) },
|
|
33
|
+
...startedAtMin !== void 0 && { started_at_min: startedAtMin },
|
|
34
|
+
...startedAtMax !== void 0 && { started_at_max: startedAtMax }
|
|
35
|
+
}).toString();
|
|
16
36
|
const response = await this.phonic.get(
|
|
17
|
-
`/conversations
|
|
37
|
+
`/conversations?${queryString}`
|
|
18
38
|
);
|
|
19
39
|
return response;
|
|
20
40
|
}
|