telnyx 6.2.0 → 6.3.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 +23 -0
- package/client.d.mts +2 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -8
- package/client.d.ts.map +1 -1
- package/client.js +4 -10
- package/client.js.map +1 -1
- package/client.mjs +4 -10
- package/client.mjs.map +1 -1
- package/core/EventEmitter.d.mts +45 -0
- package/core/EventEmitter.d.mts.map +1 -0
- package/core/EventEmitter.d.ts +45 -0
- package/core/EventEmitter.d.ts.map +1 -0
- package/core/EventEmitter.js +79 -0
- package/core/EventEmitter.js.map +1 -0
- package/core/EventEmitter.mjs +75 -0
- package/core/EventEmitter.mjs.map +1 -0
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts.map +1 -1
- package/internal/detect-platform.js +1 -1
- package/internal/detect-platform.js.map +1 -1
- package/internal/detect-platform.mjs +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/package.json +9 -1
- package/resources/ai/audio.d.mts +0 -3
- package/resources/ai/audio.d.mts.map +1 -1
- package/resources/ai/audio.d.ts +0 -3
- package/resources/ai/audio.d.ts.map +1 -1
- package/resources/ai/audio.js +0 -3
- package/resources/ai/audio.js.map +1 -1
- package/resources/ai/audio.mjs +0 -3
- package/resources/ai/audio.mjs.map +1 -1
- package/resources/index.d.mts +1 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -4
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +0 -1
- package/resources/index.mjs.map +1 -1
- package/resources/inexplicit-number-orders.d.mts.map +1 -1
- package/resources/inexplicit-number-orders.d.ts.map +1 -1
- package/resources/networks/networks.d.mts.map +1 -1
- package/resources/networks/networks.d.ts.map +1 -1
- package/resources/networks/networks.js.map +1 -1
- package/resources/networks/networks.mjs.map +1 -1
- package/resources/text-to-speech/index.d.mts +2 -0
- package/resources/text-to-speech/index.d.mts.map +1 -0
- package/resources/text-to-speech/index.d.ts +2 -0
- package/resources/text-to-speech/index.d.ts.map +1 -0
- package/resources/text-to-speech/index.js +7 -0
- package/resources/text-to-speech/index.js.map +1 -0
- package/resources/text-to-speech/index.mjs +3 -0
- package/resources/text-to-speech/index.mjs.map +1 -0
- package/resources/text-to-speech/internal-base.d.mts +40 -0
- package/resources/text-to-speech/internal-base.d.mts.map +1 -0
- package/resources/text-to-speech/internal-base.d.ts +40 -0
- package/resources/text-to-speech/internal-base.d.ts.map +1 -0
- package/resources/text-to-speech/internal-base.js +52 -0
- package/resources/text-to-speech/internal-base.js.map +1 -0
- package/resources/text-to-speech/internal-base.mjs +46 -0
- package/resources/text-to-speech/internal-base.mjs.map +1 -0
- package/resources/text-to-speech/text-to-speech.d.mts +427 -0
- package/resources/text-to-speech/text-to-speech.d.mts.map +1 -0
- package/resources/text-to-speech/text-to-speech.d.ts +427 -0
- package/resources/text-to-speech/text-to-speech.d.ts.map +1 -0
- package/resources/text-to-speech/text-to-speech.js +41 -0
- package/resources/text-to-speech/text-to-speech.js.map +1 -0
- package/resources/text-to-speech/text-to-speech.mjs +37 -0
- package/resources/text-to-speech/text-to-speech.mjs.map +1 -0
- package/resources/text-to-speech/ws.d.mts +17 -0
- package/resources/text-to-speech/ws.d.mts.map +1 -0
- package/resources/text-to-speech/ws.d.ts +17 -0
- package/resources/text-to-speech/ws.d.ts.map +1 -0
- package/resources/text-to-speech/ws.js +69 -0
- package/resources/text-to-speech/ws.js.map +1 -0
- package/resources/text-to-speech/ws.mjs +64 -0
- package/resources/text-to-speech/ws.mjs.map +1 -0
- package/resources/text-to-speech.d.mts +1 -386
- package/resources/text-to-speech.d.mts.map +1 -1
- package/resources/text-to-speech.d.ts +1 -386
- package/resources/text-to-speech.d.ts.map +1 -1
- package/resources/text-to-speech.js +2 -67
- package/resources/text-to-speech.js.map +1 -1
- package/resources/text-to-speech.mjs +1 -65
- package/resources/text-to-speech.mjs.map +1 -1
- package/resources/virtual-cross-connects.d.mts.map +1 -1
- package/resources/virtual-cross-connects.d.ts.map +1 -1
- package/resources/wireguard-interfaces.d.mts.map +1 -1
- package/resources/wireguard-interfaces.d.ts.map +1 -1
- package/src/client.ts +14 -20
- package/src/core/EventEmitter.ts +98 -0
- package/src/core/pagination.ts +3 -3
- package/src/internal/detect-platform.ts +1 -1
- package/src/resources/ai/audio.ts +0 -3
- package/src/resources/index.ts +2 -2
- package/src/resources/inexplicit-number-orders.ts +1 -2
- package/src/resources/networks/networks.ts +1 -2
- package/src/resources/text-to-speech/index.ts +11 -0
- package/src/resources/text-to-speech/internal-base.ts +93 -0
- package/src/resources/text-to-speech/text-to-speech.ts +518 -0
- package/src/resources/text-to-speech/ws.ts +74 -0
- package/src/resources/text-to-speech.ts +1 -475
- package/src/resources/virtual-cross-connects.ts +1 -2
- package/src/resources/wireguard-interfaces.ts +1 -2
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/speech-to-text.d.mts +0 -38
- package/resources/speech-to-text.d.mts.map +0 -1
- package/resources/speech-to-text.d.ts +0 -38
- package/resources/speech-to-text.d.ts.map +0 -1
- package/resources/speech-to-text.js +0 -23
- package/resources/speech-to-text.js.map +0 -1
- package/resources/speech-to-text.mjs +0 -19
- package/resources/speech-to-text.mjs.map +0 -1
- package/src/resources/speech-to-text.ts +0 -66
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireguard-interfaces.d.ts","sourceRoot":"","sources":["../src/resources/wireguard-interfaces.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,sBAAsB;OAC3B,KAAK,yBAAyB;OAC9B,EAAE,UAAU,EAAE;OACd,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,WAAW,EAAE;OACxE,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,mBAAo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EAAE,MAAM,CAAC;SACtB;KACF;CACF;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,CAAC,EAAE,kCAAkC,CAAC,IAAI,CAAC;CAChD;AAED,yBAAiB,kCAAkC,CAAC;IAClD,UAAiB,IAAK,SAAQ,sBAAsB,CAAC,MAAM,EAAE,yBAAyB,CAAC,gBAAgB;QACrG;;WAEG;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAE9B;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAElB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;QAErB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IAED,UAAiB,IAAI,CAAC;QACpB,UAAiB,MAAM;YACrB;;eAEG;YACH,IAAI,CAAC,EAAE,MAAM,CAAC;YAEd;;eAEG;YACH,IAAI,CAAC,EAAE,MAAM,CAAC;YAEd;;eAEG;YACH,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB;KACF;CACF;AAED,MAAM,WAAW,8BACf,SAAQ,sBAAsB,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"wireguard-interfaces.d.ts","sourceRoot":"","sources":["../src/resources/wireguard-interfaces.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,sBAAsB;OAC3B,KAAK,yBAAyB;OAC9B,EAAE,UAAU,EAAE;OACd,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,WAAW,EAAE;OACxE,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAClD;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,IAAI,EAAE,8BAA8B,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,gCAAgC,CAAC;IAI/C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,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 @@ import {
|
|
|
805
805
|
SiprecConnectorUpdateResponse,
|
|
806
806
|
SiprecConnectors,
|
|
807
807
|
} from './resources/siprec-connectors';
|
|
808
|
-
import { SpeechToText, SpeechToTextTranscribeParams } from './resources/speech-to-text';
|
|
809
808
|
import {
|
|
810
809
|
SubNumberOrder,
|
|
811
810
|
SubNumberOrderCancelResponse,
|
|
@@ -853,14 +852,6 @@ import {
|
|
|
853
852
|
TexmlApplications,
|
|
854
853
|
TexmlApplicationsDefaultFlatPagination,
|
|
855
854
|
} from './resources/texml-applications';
|
|
856
|
-
import {
|
|
857
|
-
TextToSpeech,
|
|
858
|
-
TextToSpeechGenerateParams,
|
|
859
|
-
TextToSpeechGenerateResponse,
|
|
860
|
-
TextToSpeechListVoicesParams,
|
|
861
|
-
TextToSpeechListVoicesResponse,
|
|
862
|
-
TextToSpeechStreamParams,
|
|
863
|
-
} from './resources/text-to-speech';
|
|
864
855
|
import {
|
|
865
856
|
UsageReportGetOptionsParams,
|
|
866
857
|
UsageReportGetOptionsResponse,
|
|
@@ -1439,6 +1430,15 @@ import {
|
|
|
1439
1430
|
} from './resources/sim-cards/sim-cards';
|
|
1440
1431
|
import { Storage, StorageListMigrationSourceCoverageResponse } from './resources/storage/storage';
|
|
1441
1432
|
import { Texml, TexmlSecretsParams, TexmlSecretsResponse } from './resources/texml/texml';
|
|
1433
|
+
import {
|
|
1434
|
+
StreamClientEvent,
|
|
1435
|
+
StreamServerEvent,
|
|
1436
|
+
TextToSpeech,
|
|
1437
|
+
TextToSpeechGenerateParams,
|
|
1438
|
+
TextToSpeechGenerateResponse,
|
|
1439
|
+
TextToSpeechListVoicesParams,
|
|
1440
|
+
TextToSpeechListVoicesResponse,
|
|
1441
|
+
} from './resources/text-to-speech/text-to-speech';
|
|
1442
1442
|
import {
|
|
1443
1443
|
CreateVerificationResponse,
|
|
1444
1444
|
Verification,
|
|
@@ -2132,9 +2132,9 @@ export class Telnyx {
|
|
|
2132
2132
|
}
|
|
2133
2133
|
}
|
|
2134
2134
|
|
|
2135
|
-
// If the API asks us to wait a certain amount of time
|
|
2136
|
-
//
|
|
2137
|
-
if (
|
|
2135
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
2136
|
+
// says, but otherwise calculate a default
|
|
2137
|
+
if (timeoutMillis === undefined) {
|
|
2138
2138
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
2139
2139
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
2140
2140
|
}
|
|
@@ -2798,10 +2798,6 @@ export class Telnyx {
|
|
|
2798
2798
|
*/
|
|
2799
2799
|
mobileVoiceConnections: API.MobileVoiceConnections = new API.MobileVoiceConnections(this);
|
|
2800
2800
|
messaging10dlc: API.Messaging10dlc = new API.Messaging10dlc(this);
|
|
2801
|
-
/**
|
|
2802
|
-
* Speech to text command operations
|
|
2803
|
-
*/
|
|
2804
|
-
speechToText: API.SpeechToText = new API.SpeechToText(this);
|
|
2805
2801
|
organizations: API.Organizations = new API.Organizations(this);
|
|
2806
2802
|
alphanumericSenderIDs: API.AlphanumericSenderIDs = new API.AlphanumericSenderIDs(this);
|
|
2807
2803
|
messagingProfileMetrics: API.MessagingProfileMetrics = new API.MessagingProfileMetrics(this);
|
|
@@ -2960,7 +2956,6 @@ Telnyx.InexplicitNumberOrders = InexplicitNumberOrders;
|
|
|
2960
2956
|
Telnyx.MobilePhoneNumbers = MobilePhoneNumbers;
|
|
2961
2957
|
Telnyx.MobileVoiceConnections = MobileVoiceConnections;
|
|
2962
2958
|
Telnyx.Messaging10dlc = Messaging10dlc;
|
|
2963
|
-
Telnyx.SpeechToText = SpeechToText;
|
|
2964
2959
|
Telnyx.Organizations = Organizations;
|
|
2965
2960
|
Telnyx.AlphanumericSenderIDs = AlphanumericSenderIDs;
|
|
2966
2961
|
Telnyx.MessagingProfileMetrics = MessagingProfileMetrics;
|
|
@@ -4407,9 +4402,10 @@ export declare namespace Telnyx {
|
|
|
4407
4402
|
TextToSpeech as TextToSpeech,
|
|
4408
4403
|
type TextToSpeechGenerateResponse as TextToSpeechGenerateResponse,
|
|
4409
4404
|
type TextToSpeechListVoicesResponse as TextToSpeechListVoicesResponse,
|
|
4405
|
+
type StreamClientEvent as StreamClientEvent,
|
|
4406
|
+
type StreamServerEvent as StreamServerEvent,
|
|
4410
4407
|
type TextToSpeechGenerateParams as TextToSpeechGenerateParams,
|
|
4411
4408
|
type TextToSpeechListVoicesParams as TextToSpeechListVoicesParams,
|
|
4412
|
-
type TextToSpeechStreamParams as TextToSpeechStreamParams,
|
|
4413
4409
|
};
|
|
4414
4410
|
|
|
4415
4411
|
export {
|
|
@@ -4597,8 +4593,6 @@ export declare namespace Telnyx {
|
|
|
4597
4593
|
type Messaging10dlcGetEnumResponse as Messaging10dlcGetEnumResponse,
|
|
4598
4594
|
};
|
|
4599
4595
|
|
|
4600
|
-
export { SpeechToText as SpeechToText, type SpeechToTextTranscribeParams as SpeechToTextTranscribeParams };
|
|
4601
|
-
|
|
4602
4596
|
export { Organizations as Organizations };
|
|
4603
4597
|
|
|
4604
4598
|
export {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
type EventListener<Events, EventType extends keyof Events> = Events[EventType];
|
|
2
|
+
|
|
3
|
+
type EventListeners<Events, EventType extends keyof Events> = Array<{
|
|
4
|
+
listener: EventListener<Events, EventType>;
|
|
5
|
+
once?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
|
|
8
|
+
export type EventParameters<Events, EventType extends keyof Events> = {
|
|
9
|
+
[Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any ? P : never;
|
|
10
|
+
}[EventType];
|
|
11
|
+
|
|
12
|
+
export class EventEmitter<EventTypes extends Record<string, (...args: any) => any>> {
|
|
13
|
+
#listeners: {
|
|
14
|
+
[Event in keyof EventTypes]?: EventListeners<EventTypes, Event>;
|
|
15
|
+
} = {};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Adds the listener function to the end of the listeners array for the event.
|
|
19
|
+
* No checks are made to see if the listener has already been added. Multiple calls passing
|
|
20
|
+
* the same combination of event and listener will result in the listener being added, and
|
|
21
|
+
* called, multiple times.
|
|
22
|
+
* @returns this, so that calls can be chained
|
|
23
|
+
*/
|
|
24
|
+
on<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this {
|
|
25
|
+
const listeners: EventListeners<EventTypes, Event> =
|
|
26
|
+
this.#listeners[event] || (this.#listeners[event] = []);
|
|
27
|
+
listeners.push({ listener });
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Removes the specified listener from the listener array for the event.
|
|
33
|
+
* off() will remove, at most, one instance of a listener from the listener array. If any single
|
|
34
|
+
* listener has been added multiple times to the listener array for the specified event, then
|
|
35
|
+
* off() must be called multiple times to remove each instance.
|
|
36
|
+
* @returns this, so that calls can be chained
|
|
37
|
+
*/
|
|
38
|
+
off<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this {
|
|
39
|
+
const listeners = this.#listeners[event];
|
|
40
|
+
if (!listeners) return this;
|
|
41
|
+
const index = listeners.findIndex((l) => l.listener === listener);
|
|
42
|
+
if (index >= 0) listeners.splice(index, 1);
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Adds a one-time listener function for the event. The next time the event is triggered,
|
|
48
|
+
* this listener is removed and then invoked.
|
|
49
|
+
* @returns this, so that calls can be chained
|
|
50
|
+
*/
|
|
51
|
+
once<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this {
|
|
52
|
+
const listeners: EventListeners<EventTypes, Event> =
|
|
53
|
+
this.#listeners[event] || (this.#listeners[event] = []);
|
|
54
|
+
listeners.push({ listener, once: true });
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* This is similar to `.once()`, but returns a Promise that resolves the next time
|
|
60
|
+
* the event is triggered, instead of calling a listener callback.
|
|
61
|
+
* @returns a Promise that resolves the next time given event is triggered,
|
|
62
|
+
* or rejects if an error is emitted. (If you request the 'error' event,
|
|
63
|
+
* returns a promise that resolves with the error).
|
|
64
|
+
*
|
|
65
|
+
* Example:
|
|
66
|
+
*
|
|
67
|
+
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
68
|
+
*/
|
|
69
|
+
emitted<Event extends keyof EventTypes>(
|
|
70
|
+
event: Event,
|
|
71
|
+
): Promise<
|
|
72
|
+
EventParameters<EventTypes, Event> extends [infer Param] ? Param
|
|
73
|
+
: EventParameters<EventTypes, Event> extends [] ? void
|
|
74
|
+
: EventParameters<EventTypes, Event>
|
|
75
|
+
> {
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
77
|
+
// TODO: handle errors
|
|
78
|
+
this.once(event, resolve as any);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected _emit<Event extends keyof EventTypes>(
|
|
83
|
+
this: EventEmitter<EventTypes>,
|
|
84
|
+
event: Event,
|
|
85
|
+
...args: EventParameters<EventTypes, Event>
|
|
86
|
+
) {
|
|
87
|
+
const listeners: EventListeners<EventTypes, Event> | undefined = this.#listeners[event];
|
|
88
|
+
if (listeners) {
|
|
89
|
+
this.#listeners[event] = listeners.filter((l) => !l.once) as any;
|
|
90
|
+
listeners.forEach(({ listener }: any) => listener(...(args as any)));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
protected _hasListener(event: keyof EventTypes): boolean {
|
|
95
|
+
const listeners = this.#listeners[event];
|
|
96
|
+
return listeners && listeners.length > 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
package/src/core/pagination.ts
CHANGED
|
@@ -73,9 +73,9 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
73
73
|
* }
|
|
74
74
|
*/
|
|
75
75
|
export class PagePromise<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
PageClass extends AbstractPage<Item>,
|
|
77
|
+
Item = ReturnType<PageClass['getPaginatedItems']>[number],
|
|
78
|
+
>
|
|
79
79
|
extends APIPromise<PageClass>
|
|
80
80
|
implements AsyncIterable<Item>
|
|
81
81
|
{
|
|
@@ -67,7 +67,7 @@ const getPlatformProperties = (): PlatformProperties => {
|
|
|
67
67
|
'X-Stainless-Arch': normalizeArch(Deno.build.arch),
|
|
68
68
|
'X-Stainless-Runtime': 'deno',
|
|
69
69
|
'X-Stainless-Runtime-Version':
|
|
70
|
-
typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
|
|
70
|
+
typeof Deno.version === 'string' ? Deno.version : (Deno.version?.deno ?? 'unknown'),
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
if (typeof EdgeRuntime !== 'undefined') {
|
|
@@ -6,9 +6,6 @@ import { type Uploadable } from '../../core/uploads';
|
|
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
7
|
import { multipartFormRequestOptions } from '../../internal/uploads';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Turn audio into text or text into audio.
|
|
11
|
-
*/
|
|
12
9
|
export class Audio extends APIResource {
|
|
13
10
|
/**
|
|
14
11
|
* Transcribe speech to text. This endpoint is consistent with the
|
package/src/resources/index.ts
CHANGED
|
@@ -1130,7 +1130,6 @@ export {
|
|
|
1130
1130
|
type SiprecConnectorCreateParams,
|
|
1131
1131
|
type SiprecConnectorUpdateParams,
|
|
1132
1132
|
} from './siprec-connectors';
|
|
1133
|
-
export { SpeechToText, type SpeechToTextTranscribeParams } from './speech-to-text';
|
|
1134
1133
|
export { Storage, type StorageListMigrationSourceCoverageResponse } from './storage/storage';
|
|
1135
1134
|
export {
|
|
1136
1135
|
SubNumberOrders,
|
|
@@ -1184,9 +1183,10 @@ export {
|
|
|
1184
1183
|
TextToSpeech,
|
|
1185
1184
|
type TextToSpeechGenerateResponse,
|
|
1186
1185
|
type TextToSpeechListVoicesResponse,
|
|
1186
|
+
type StreamClientEvent,
|
|
1187
|
+
type StreamServerEvent,
|
|
1187
1188
|
type TextToSpeechGenerateParams,
|
|
1188
1189
|
type TextToSpeechListVoicesParams,
|
|
1189
|
-
type TextToSpeechStreamParams,
|
|
1190
1190
|
} from './text-to-speech';
|
|
1191
1191
|
export {
|
|
1192
1192
|
UsageReports,
|
|
@@ -321,8 +321,7 @@ export namespace InexplicitNumberOrderCreateParams {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
export interface InexplicitNumberOrderListParams
|
|
325
|
-
extends DefaultFlatPaginationForInexplicitNumberOrdersParams {}
|
|
324
|
+
export interface InexplicitNumberOrderListParams extends DefaultFlatPaginationForInexplicitNumberOrdersParams {}
|
|
326
325
|
|
|
327
326
|
export declare namespace InexplicitNumberOrders {
|
|
328
327
|
export {
|
|
@@ -207,8 +207,7 @@ export namespace NetworkDeleteResponse {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
export interface NetworkListInterfacesResponse
|
|
210
|
-
extends GlobalIPAssignmentsAPI.Record,
|
|
211
|
-
PublicInternetGatewaysAPI.NetworkInterface {
|
|
210
|
+
extends GlobalIPAssignmentsAPI.Record, PublicInternetGatewaysAPI.NetworkInterface {
|
|
212
211
|
/**
|
|
213
212
|
* Identifies the type of the resource.
|
|
214
213
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
TextToSpeech,
|
|
5
|
+
type TextToSpeechGenerateResponse,
|
|
6
|
+
type TextToSpeechListVoicesResponse,
|
|
7
|
+
type StreamClientEvent,
|
|
8
|
+
type StreamServerEvent,
|
|
9
|
+
type TextToSpeechGenerateParams,
|
|
10
|
+
type TextToSpeechListVoicesParams,
|
|
11
|
+
} from './text-to-speech';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import * as TextToSpeechAPI from './text-to-speech';
|
|
4
|
+
import { Telnyx } from '../../client';
|
|
5
|
+
|
|
6
|
+
import { EventEmitter } from '../../core/EventEmitter';
|
|
7
|
+
import { TelnyxError } from '../../core/error';
|
|
8
|
+
import { stringifyQuery } from '../../internal/utils';
|
|
9
|
+
|
|
10
|
+
export class WebSocketError extends TelnyxError {
|
|
11
|
+
/**
|
|
12
|
+
* The error data that the API sent back in an error event.
|
|
13
|
+
*/
|
|
14
|
+
error?: TextToSpeechAPI.StreamServerEvent.ErrorFrame | undefined;
|
|
15
|
+
|
|
16
|
+
constructor(message: string, event: TextToSpeechAPI.StreamServerEvent.ErrorFrame | null) {
|
|
17
|
+
super(message);
|
|
18
|
+
|
|
19
|
+
this.error = event ?? undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
24
|
+
|
|
25
|
+
type WebsocketEvents = Simplify<
|
|
26
|
+
{
|
|
27
|
+
event: (event: TextToSpeechAPI.StreamServerEvent) => void;
|
|
28
|
+
error: (error: WebSocketError) => void;
|
|
29
|
+
} & {
|
|
30
|
+
[EventType in Exclude<NonNullable<TextToSpeechAPI.StreamServerEvent['type']>, 'error'>]: (
|
|
31
|
+
event: Extract<TextToSpeechAPI.StreamServerEvent, { type?: EventType }>,
|
|
32
|
+
) => unknown;
|
|
33
|
+
}
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
export abstract class TextToSpeechEmitter extends EventEmitter<WebsocketEvents> {
|
|
37
|
+
/**
|
|
38
|
+
* Send an event to the API.
|
|
39
|
+
*/
|
|
40
|
+
abstract send(event: TextToSpeechAPI.StreamClientEvent): void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Close the websocket connection.
|
|
44
|
+
*/
|
|
45
|
+
abstract close(props?: { code: number; reason: string }): void;
|
|
46
|
+
|
|
47
|
+
protected _onError(event: null, message: string, cause: any): void;
|
|
48
|
+
protected _onError(event: TextToSpeechAPI.StreamServerEvent.ErrorFrame, message?: string | undefined): void;
|
|
49
|
+
protected _onError(
|
|
50
|
+
event: TextToSpeechAPI.StreamServerEvent.ErrorFrame | null,
|
|
51
|
+
message?: string | undefined,
|
|
52
|
+
cause?: any,
|
|
53
|
+
): void {
|
|
54
|
+
message = message ?? safeJSONStringify(event) ?? 'unknown error';
|
|
55
|
+
|
|
56
|
+
if (!this._hasListener('error')) {
|
|
57
|
+
const error = new WebSocketError(
|
|
58
|
+
message +
|
|
59
|
+
`\n\nTo resolve these unhandled rejection errors you should bind an \`error\` callback, e.g. \`ws.on('error', (error) => ...)\` `,
|
|
60
|
+
event,
|
|
61
|
+
);
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
error.cause = cause;
|
|
64
|
+
Promise.reject(error);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const error = new WebSocketError(message, event);
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
error.cause = cause;
|
|
71
|
+
|
|
72
|
+
this._emit('error', error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function buildURL(client: Telnyx, query?: object | null): URL {
|
|
77
|
+
const path = '/text-to-speech/speech';
|
|
78
|
+
const baseURL = client.baseURL;
|
|
79
|
+
const url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path));
|
|
80
|
+
if (query) {
|
|
81
|
+
url.search = stringifyQuery(query);
|
|
82
|
+
}
|
|
83
|
+
url.protocol = 'wss';
|
|
84
|
+
return url;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function safeJSONStringify(value: unknown): string | null {
|
|
88
|
+
try {
|
|
89
|
+
return JSON.stringify(value);
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|