@sentdm/sentdm 0.45.0 → 0.46.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 +11 -0
- package/client.d.mts +3 -10
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -10
- package/client.d.ts.map +1 -1
- package/client.js +3 -10
- package/client.js.map +1 -1
- package/client.mjs +3 -10
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/channels/channels.d.mts +2 -2
- package/resources/channels/channels.d.mts.map +1 -1
- package/resources/channels/channels.d.ts +2 -2
- package/resources/channels/channels.d.ts.map +1 -1
- package/resources/channels/channels.js.map +1 -1
- package/resources/channels/channels.mjs.map +1 -1
- package/resources/channels/index.d.mts +1 -1
- package/resources/channels/index.d.mts.map +1 -1
- package/resources/channels/index.d.ts +1 -1
- package/resources/channels/index.d.ts.map +1 -1
- package/resources/channels/index.js.map +1 -1
- package/resources/channels/index.mjs.map +1 -1
- package/resources/channels/voice.d.mts +13 -105
- package/resources/channels/voice.d.mts.map +1 -1
- package/resources/channels/voice.d.ts +13 -105
- package/resources/channels/voice.d.ts.map +1 -1
- package/resources/channels/voice.js +12 -41
- package/resources/channels/voice.js.map +1 -1
- package/resources/channels/voice.mjs +12 -41
- package/resources/channels/voice.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +8 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +8 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/templates.d.mts +14 -13
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +14 -13
- package/resources/templates.d.ts.map +1 -1
- package/resources/{calls → voice/calls}/calls.d.mts +17 -12
- package/resources/voice/calls/calls.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/calls.d.ts +17 -12
- package/resources/voice/calls/calls.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/calls.js +17 -17
- package/resources/voice/calls/calls.js.map +1 -0
- package/resources/{calls → voice/calls}/calls.mjs +16 -16
- package/resources/voice/calls/calls.mjs.map +1 -0
- package/resources/voice/calls/index.d.mts.map +1 -0
- package/resources/voice/calls/index.d.ts.map +1 -0
- package/resources/voice/calls/index.js.map +1 -0
- package/resources/voice/calls/index.mjs.map +1 -0
- package/resources/{calls → voice/calls}/participants.d.mts +14 -14
- package/resources/voice/calls/participants.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/participants.d.ts +14 -14
- package/resources/voice/calls/participants.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/participants.js +17 -17
- package/resources/voice/calls/participants.js.map +1 -0
- package/resources/{calls → voice/calls}/participants.mjs +17 -17
- package/resources/voice/calls/participants.mjs.map +1 -0
- package/resources/voice/calls.d.mts.map +1 -0
- package/resources/voice/calls.d.ts.map +1 -0
- package/resources/{calls.js → voice/calls.js} +1 -1
- package/resources/voice/calls.js.map +1 -0
- package/resources/voice/calls.mjs.map +1 -0
- package/resources/voice/index.d.mts +4 -0
- package/resources/{calls → voice}/index.d.mts.map +1 -1
- package/resources/voice/index.d.ts +4 -0
- package/resources/{calls → voice}/index.d.ts.map +1 -1
- package/resources/voice/index.js +11 -0
- package/resources/voice/index.js.map +1 -0
- package/resources/voice/index.mjs +5 -0
- package/resources/voice/index.mjs.map +1 -0
- package/resources/voice/tokens.d.mts +109 -0
- package/resources/voice/tokens.d.mts.map +1 -0
- package/resources/voice/tokens.d.ts +109 -0
- package/resources/voice/tokens.d.ts.map +1 -0
- package/resources/voice/tokens.js +45 -0
- package/resources/voice/tokens.js.map +1 -0
- package/resources/voice/tokens.mjs +41 -0
- package/resources/voice/tokens.mjs.map +1 -0
- package/resources/voice/voice.d.mts +14 -0
- package/resources/voice/voice.d.mts.map +1 -0
- package/resources/voice/voice.d.ts +14 -0
- package/resources/voice/voice.d.ts.map +1 -0
- package/resources/voice/voice.js +21 -0
- package/resources/voice/voice.js.map +1 -0
- package/resources/voice/voice.mjs +16 -0
- package/resources/voice/voice.mjs.map +1 -0
- package/resources/voice.d.mts +2 -0
- package/resources/voice.d.mts.map +1 -0
- package/resources/voice.d.ts +2 -0
- package/resources/voice.d.ts.map +1 -0
- package/resources/voice.js +6 -0
- package/resources/voice.js.map +1 -0
- package/resources/voice.mjs +3 -0
- package/resources/voice.mjs.map +1 -0
- package/resources/webhooks.d.mts +3 -2
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +3 -2
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +4 -45
- package/src/resources/channels/channels.ts +0 -6
- package/src/resources/channels/index.ts +0 -3
- package/src/resources/channels/voice.ts +12 -135
- package/src/resources/index.ts +1 -18
- package/src/resources/messages.ts +8 -1
- package/src/resources/templates.ts +14 -13
- package/src/resources/{calls → voice/calls}/calls.ts +25 -19
- package/src/resources/{calls → voice/calls}/participants.ts +21 -21
- package/src/resources/voice/index.ts +22 -0
- package/src/resources/voice/tokens.ts +144 -0
- package/src/resources/voice/voice.ts +60 -0
- package/src/resources/voice.ts +3 -0
- package/src/resources/webhooks.ts +3 -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/calls/calls.d.mts.map +0 -1
- package/resources/calls/calls.d.ts.map +0 -1
- package/resources/calls/calls.js.map +0 -1
- package/resources/calls/calls.mjs.map +0 -1
- package/resources/calls/index.js.map +0 -1
- package/resources/calls/index.mjs.map +0 -1
- package/resources/calls/participants.d.mts.map +0 -1
- package/resources/calls/participants.d.ts.map +0 -1
- package/resources/calls/participants.js.map +0 -1
- package/resources/calls/participants.mjs.map +0 -1
- package/resources/calls.d.mts.map +0 -1
- package/resources/calls.d.ts.map +0 -1
- package/resources/calls.js.map +0 -1
- package/resources/calls.mjs.map +0 -1
- /package/resources/{calls → voice/calls}/index.d.mts +0 -0
- /package/resources/{calls → voice/calls}/index.d.ts +0 -0
- /package/resources/{calls → voice/calls}/index.js +0 -0
- /package/resources/{calls → voice/calls}/index.mjs +0 -0
- /package/resources/{calls.d.mts → voice/calls.d.mts} +0 -0
- /package/resources/{calls.d.ts → voice/calls.d.ts} +0 -0
- /package/resources/{calls.mjs → voice/calls.mjs} +0 -0
- /package/src/resources/{calls → voice/calls}/index.ts +0 -0
- /package/src/resources/{calls.ts → voice/calls.ts} +0 -0
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Participants = void 0;
|
|
5
|
-
const resource_1 = require("
|
|
6
|
-
const headers_1 = require("
|
|
7
|
-
const path_1 = require("
|
|
5
|
+
const resource_1 = require("../../../core/resource.js");
|
|
6
|
+
const headers_1 = require("../../../internal/headers.js");
|
|
7
|
+
const path_1 = require("../../../internal/utils/path.js");
|
|
8
8
|
/**
|
|
9
9
|
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
10
10
|
*
|
|
11
|
-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/
|
|
11
|
+
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
12
12
|
*
|
|
13
|
-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
13
|
+
* Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
14
14
|
*/
|
|
15
15
|
class Participants extends resource_1.APIResource {
|
|
16
16
|
/**
|
|
@@ -23,7 +23,7 @@ class Participants extends resource_1.APIResource {
|
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
|
-
* await client.calls.participants.update(
|
|
26
|
+
* await client.voice.calls.participants.update(
|
|
27
27
|
* 'call_9f2ab000-0000-4000-8000-000000000002',
|
|
28
28
|
* { id: 'call_9f2ab000-0000-4000-8000-000000000001' },
|
|
29
29
|
* );
|
|
@@ -31,7 +31,7 @@ class Participants extends resource_1.APIResource {
|
|
|
31
31
|
*/
|
|
32
32
|
update(participantID, params, options) {
|
|
33
33
|
const { id, 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
34
|
-
return this._client.patch((0, path_1.path) `/v3/calls/${id}/participants/${participantID}`, {
|
|
34
|
+
return this._client.patch((0, path_1.path) `/v3/voice/calls/${id}/participants/${participantID}`, {
|
|
35
35
|
body,
|
|
36
36
|
...options,
|
|
37
37
|
headers: (0, headers_1.buildHeaders)([
|
|
@@ -49,20 +49,20 @@ class Participants extends resource_1.APIResource {
|
|
|
49
49
|
* participant's own call id, who they are, whether the room mutes them, and how
|
|
50
50
|
* long they have been connected. The call itself is one of the participants. Use a
|
|
51
51
|
* participant's id to mute or remove them; it is also a call id, so GET
|
|
52
|
-
* /v3/calls/{id} accepts it. A call that has ended answers 409, as does a
|
|
53
|
-
* that is not in a conference.
|
|
52
|
+
* /v3/voice/calls/{id} accepts it. A call that has ended answers 409, as does a
|
|
53
|
+
* call that is not in a conference.
|
|
54
54
|
*
|
|
55
55
|
* @example
|
|
56
56
|
* ```ts
|
|
57
57
|
* const apiResponseOfListOfCallParticipant =
|
|
58
|
-
* await client.calls.participants.list(
|
|
58
|
+
* await client.voice.calls.participants.list(
|
|
59
59
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
60
60
|
* );
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
list(id, params = {}, options) {
|
|
64
64
|
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
65
|
-
return this._client.get((0, path_1.path) `/v3/calls/${id}/participants`, {
|
|
65
|
+
return this._client.get((0, path_1.path) `/v3/voice/calls/${id}/participants`, {
|
|
66
66
|
...options,
|
|
67
67
|
headers: (0, headers_1.buildHeaders)([
|
|
68
68
|
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
@@ -84,14 +84,14 @@ class Participants extends resource_1.APIResource {
|
|
|
84
84
|
* @example
|
|
85
85
|
* ```ts
|
|
86
86
|
* const apiResponseOfCall =
|
|
87
|
-
* await client.calls.participants.add(
|
|
87
|
+
* await client.voice.calls.participants.add(
|
|
88
88
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
89
89
|
* );
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
92
|
add(id, params, options) {
|
|
93
93
|
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
94
|
-
return this._client.post((0, path_1.path) `/v3/calls/${id}/participants`, {
|
|
94
|
+
return this._client.post((0, path_1.path) `/v3/voice/calls/${id}/participants`, {
|
|
95
95
|
body,
|
|
96
96
|
...options,
|
|
97
97
|
headers: (0, headers_1.buildHeaders)([
|
|
@@ -112,7 +112,7 @@ class Participants extends resource_1.APIResource {
|
|
|
112
112
|
*
|
|
113
113
|
* @example
|
|
114
114
|
* ```ts
|
|
115
|
-
* await client.calls.participants.remove(
|
|
115
|
+
* await client.voice.calls.participants.remove(
|
|
116
116
|
* 'call_9f2ab000-0000-4000-8000-000000000002',
|
|
117
117
|
* { id: 'call_9f2ab000-0000-4000-8000-000000000001' },
|
|
118
118
|
* );
|
|
@@ -120,7 +120,7 @@ class Participants extends resource_1.APIResource {
|
|
|
120
120
|
*/
|
|
121
121
|
remove(participantID, params, options) {
|
|
122
122
|
const { id, 'x-profile-id': xProfileID, ...body } = params;
|
|
123
|
-
return this._client.delete((0, path_1.path) `/v3/calls/${id}/participants/${participantID}`, {
|
|
123
|
+
return this._client.delete((0, path_1.path) `/v3/voice/calls/${id}/participants/${participantID}`, {
|
|
124
124
|
body,
|
|
125
125
|
...options,
|
|
126
126
|
headers: (0, headers_1.buildHeaders)([
|
|
@@ -137,14 +137,14 @@ class Participants extends resource_1.APIResource {
|
|
|
137
137
|
*
|
|
138
138
|
* @example
|
|
139
139
|
* ```ts
|
|
140
|
-
* await client.calls.participants.removeAll(
|
|
140
|
+
* await client.voice.calls.participants.removeAll(
|
|
141
141
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
142
142
|
* );
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
145
|
removeAll(id, params, options) {
|
|
146
146
|
const { 'x-profile-id': xProfileID, ...body } = params;
|
|
147
|
-
return this._client.delete((0, path_1.path) `/v3/calls/${id}/participants`, {
|
|
147
|
+
return this._client.delete((0, path_1.path) `/v3/voice/calls/${id}/participants`, {
|
|
148
148
|
body,
|
|
149
149
|
...options,
|
|
150
150
|
headers: (0, headers_1.buildHeaders)([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participants.js","sourceRoot":"","sources":["../../../src/resources/voice/calls/participants.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAIrD,0DAAyD;AAEzD,0DAAoD;AAEpD;;;;;;GAMG;AACH,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,aAAqB,EAAE,MAA+B,EAAE,OAAwB;QACrF,MAAM,EAAE,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,E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B,EAAE,eAAe,EAAE;YACnE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACvF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AAzJD,oCAyJC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { APIResource } from "
|
|
3
|
-
import { buildHeaders } from "
|
|
4
|
-
import { path } from "
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../../internal/utils/path.mjs";
|
|
5
5
|
/**
|
|
6
6
|
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
7
7
|
*
|
|
8
|
-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/
|
|
8
|
+
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
9
9
|
*
|
|
10
|
-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
10
|
+
* Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
11
11
|
*/
|
|
12
12
|
export class Participants extends APIResource {
|
|
13
13
|
/**
|
|
@@ -20,7 +20,7 @@ export class Participants extends APIResource {
|
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```ts
|
|
23
|
-
* await client.calls.participants.update(
|
|
23
|
+
* await client.voice.calls.participants.update(
|
|
24
24
|
* 'call_9f2ab000-0000-4000-8000-000000000002',
|
|
25
25
|
* { id: 'call_9f2ab000-0000-4000-8000-000000000001' },
|
|
26
26
|
* );
|
|
@@ -28,7 +28,7 @@ export class Participants extends APIResource {
|
|
|
28
28
|
*/
|
|
29
29
|
update(participantID, params, options) {
|
|
30
30
|
const { id, 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
31
|
-
return this._client.patch(path `/v3/calls/${id}/participants/${participantID}`, {
|
|
31
|
+
return this._client.patch(path `/v3/voice/calls/${id}/participants/${participantID}`, {
|
|
32
32
|
body,
|
|
33
33
|
...options,
|
|
34
34
|
headers: buildHeaders([
|
|
@@ -46,20 +46,20 @@ export class Participants extends APIResource {
|
|
|
46
46
|
* participant's own call id, who they are, whether the room mutes them, and how
|
|
47
47
|
* long they have been connected. The call itself is one of the participants. Use a
|
|
48
48
|
* participant's id to mute or remove them; it is also a call id, so GET
|
|
49
|
-
* /v3/calls/{id} accepts it. A call that has ended answers 409, as does a
|
|
50
|
-
* that is not in a conference.
|
|
49
|
+
* /v3/voice/calls/{id} accepts it. A call that has ended answers 409, as does a
|
|
50
|
+
* call that is not in a conference.
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
54
|
* const apiResponseOfListOfCallParticipant =
|
|
55
|
-
* await client.calls.participants.list(
|
|
55
|
+
* await client.voice.calls.participants.list(
|
|
56
56
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
57
57
|
* );
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
list(id, params = {}, options) {
|
|
61
61
|
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
62
|
-
return this._client.get(path `/v3/calls/${id}/participants`, {
|
|
62
|
+
return this._client.get(path `/v3/voice/calls/${id}/participants`, {
|
|
63
63
|
...options,
|
|
64
64
|
headers: buildHeaders([
|
|
65
65
|
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
@@ -81,14 +81,14 @@ export class Participants extends APIResource {
|
|
|
81
81
|
* @example
|
|
82
82
|
* ```ts
|
|
83
83
|
* const apiResponseOfCall =
|
|
84
|
-
* await client.calls.participants.add(
|
|
84
|
+
* await client.voice.calls.participants.add(
|
|
85
85
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
86
86
|
* );
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
add(id, params, options) {
|
|
90
90
|
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
91
|
-
return this._client.post(path `/v3/calls/${id}/participants`, {
|
|
91
|
+
return this._client.post(path `/v3/voice/calls/${id}/participants`, {
|
|
92
92
|
body,
|
|
93
93
|
...options,
|
|
94
94
|
headers: buildHeaders([
|
|
@@ -109,7 +109,7 @@ export class Participants extends APIResource {
|
|
|
109
109
|
*
|
|
110
110
|
* @example
|
|
111
111
|
* ```ts
|
|
112
|
-
* await client.calls.participants.remove(
|
|
112
|
+
* await client.voice.calls.participants.remove(
|
|
113
113
|
* 'call_9f2ab000-0000-4000-8000-000000000002',
|
|
114
114
|
* { id: 'call_9f2ab000-0000-4000-8000-000000000001' },
|
|
115
115
|
* );
|
|
@@ -117,7 +117,7 @@ export class Participants extends APIResource {
|
|
|
117
117
|
*/
|
|
118
118
|
remove(participantID, params, options) {
|
|
119
119
|
const { id, 'x-profile-id': xProfileID, ...body } = params;
|
|
120
|
-
return this._client.delete(path `/v3/calls/${id}/participants/${participantID}`, {
|
|
120
|
+
return this._client.delete(path `/v3/voice/calls/${id}/participants/${participantID}`, {
|
|
121
121
|
body,
|
|
122
122
|
...options,
|
|
123
123
|
headers: buildHeaders([
|
|
@@ -134,14 +134,14 @@ export class Participants extends APIResource {
|
|
|
134
134
|
*
|
|
135
135
|
* @example
|
|
136
136
|
* ```ts
|
|
137
|
-
* await client.calls.participants.removeAll(
|
|
137
|
+
* await client.voice.calls.participants.removeAll(
|
|
138
138
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
139
139
|
* );
|
|
140
140
|
* ```
|
|
141
141
|
*/
|
|
142
142
|
removeAll(id, params, options) {
|
|
143
143
|
const { 'x-profile-id': xProfileID, ...body } = params;
|
|
144
|
-
return this._client.delete(path `/v3/calls/${id}/participants`, {
|
|
144
|
+
return this._client.delete(path `/v3/voice/calls/${id}/participants`, {
|
|
145
145
|
body,
|
|
146
146
|
...options,
|
|
147
147
|
headers: buildHeaders([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participants.mjs","sourceRoot":"","sources":["../../../src/resources/voice/calls/participants.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,mCAA+B;AAIrD,OAAO,EAAE,YAAY,EAAE,sCAAkC;AAEzD,OAAO,EAAE,IAAI,EAAE,yCAAqC;AAEpD;;;;;;GAMG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,aAAqB,EAAE,MAA+B,EAAE,OAAwB;QACrF,MAAM,EAAE,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC9F,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,mBAAmB,EAAE,iBAAiB,aAAa,EAAE,EAAE;YACnF,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB;oBACE,MAA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B,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.mts","sourceRoot":"","sources":["../../src/resources/voice/calls.ts"],"names":[],"mappings":"AAEA,kCAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../src/resources/voice/calls.ts"],"names":[],"mappings":"AAEA,iCAA8B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
const tslib_1 = require("
|
|
4
|
+
const tslib_1 = require("../../internal/tslib.js");
|
|
5
5
|
tslib_1.__exportStar(require("./calls/index.js"), exports);
|
|
6
6
|
//# sourceMappingURL=calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.js","sourceRoot":"","sources":["../../src/resources/voice/calls.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.mjs","sourceRoot":"","sources":["../../src/resources/voice/calls.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,kCAA8B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Calls, type APIResponseOfCall, type APIResponseOfCallRecordings, type APIResponseOfCallsList, type Call, type CallParty, type CallRecording, type CallRecordings, type CallTimelineEntry, type CallsList, type CallRetrieveParams, type CallListParams, type CallHangupParams, type CallListRecordingsParams, type CallRecordParams, type CallsCallsPage, } from "./calls/index.mjs";
|
|
2
|
+
export { Tokens, type APIResponseOfVoiceToken, type VoiceToken, type TokenCreateParams } from "./tokens.mjs";
|
|
3
|
+
export { Voice } from "./voice.mjs";
|
|
4
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/voice/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EACL,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,0BAAsB;AACvB,OAAO,EAAE,MAAM,EAAE,KAAK,uBAAuB,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,qBAAiB;AACzG,OAAO,EAAE,KAAK,EAAE,oBAAgB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Calls, type APIResponseOfCall, type APIResponseOfCallRecordings, type APIResponseOfCallsList, type Call, type CallParty, type CallRecording, type CallRecordings, type CallTimelineEntry, type CallsList, type CallRetrieveParams, type CallListParams, type CallHangupParams, type CallListRecordingsParams, type CallRecordParams, type CallsCallsPage, } from "./calls/index.js";
|
|
2
|
+
export { Tokens, type APIResponseOfVoiceToken, type VoiceToken, type TokenCreateParams } from "./tokens.js";
|
|
3
|
+
export { Voice } from "./voice.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/voice/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EACL,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,yBAAsB;AACvB,OAAO,EAAE,MAAM,EAAE,KAAK,uBAAuB,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,oBAAiB;AACzG,OAAO,EAAE,KAAK,EAAE,mBAAgB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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 = exports.Tokens = exports.Calls = void 0;
|
|
5
|
+
var index_1 = require("./calls/index.js");
|
|
6
|
+
Object.defineProperty(exports, "Calls", { enumerable: true, get: function () { return index_1.Calls; } });
|
|
7
|
+
var tokens_1 = require("./tokens.js");
|
|
8
|
+
Object.defineProperty(exports, "Tokens", { enumerable: true, get: function () { return tokens_1.Tokens; } });
|
|
9
|
+
var voice_1 = require("./voice.js");
|
|
10
|
+
Object.defineProperty(exports, "Voice", { enumerable: true, get: function () { return voice_1.Voice; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/voice/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0CAiBuB;AAhBrB,8FAAA,KAAK,OAAA;AAiBP,sCAAyG;AAAhG,gGAAA,MAAM,OAAA;AACf,oCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/voice/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,KAAK,GAgBN,0BAAsB;AACvB,OAAO,EAAE,MAAM,EAAyE,qBAAiB;AACzG,OAAO,EAAE,KAAK,EAAE,oBAAgB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import * as WebhooksAPI from "../webhooks.mjs";
|
|
3
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
4
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
7
|
+
*
|
|
8
|
+
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
9
|
+
*
|
|
10
|
+
* Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Tokens extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Mints a short-lived token for one of your app users. Call this from your backend
|
|
15
|
+
* and return the token to your app, which passes it to the voice client SDK to
|
|
16
|
+
* register. The identity is bound to the given number, or to your default app-call
|
|
17
|
+
* number when omitted, and calls placed by that identity are routed through the
|
|
18
|
+
* bound number. Minting again re-binds the identity, so an identity can move
|
|
19
|
+
* between numbers.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const apiResponseOfVoiceToken =
|
|
24
|
+
* await client.voice.tokens.create();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
create(params: TokenCreateParams, options?: RequestOptions): APIPromise<APIResponseOfVoiceToken>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Standard API response envelope for all v3 endpoints
|
|
31
|
+
*/
|
|
32
|
+
export interface APIResponseOfVoiceToken {
|
|
33
|
+
/**
|
|
34
|
+
* A short-lived token your app passes to the voice client SDK to register
|
|
35
|
+
*/
|
|
36
|
+
data?: VoiceToken | null;
|
|
37
|
+
/**
|
|
38
|
+
* Error information
|
|
39
|
+
*/
|
|
40
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
41
|
+
/**
|
|
42
|
+
* Request and response metadata
|
|
43
|
+
*/
|
|
44
|
+
meta?: WebhooksAPI.APIMeta;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates whether the request was successful
|
|
47
|
+
*/
|
|
48
|
+
success?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A short-lived token your app passes to the voice client SDK to register
|
|
52
|
+
*/
|
|
53
|
+
export interface VoiceToken {
|
|
54
|
+
/**
|
|
55
|
+
* The signed token. Hand it to the client SDK unchanged. Treat it as opaque: read
|
|
56
|
+
* the identity, number, and expiry from this response, not from the token.
|
|
57
|
+
*/
|
|
58
|
+
token?: string;
|
|
59
|
+
/**
|
|
60
|
+
* When the token expires (UTC)
|
|
61
|
+
*/
|
|
62
|
+
expires_at?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The identity the token was minted for
|
|
65
|
+
*/
|
|
66
|
+
identity?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The phone number this identity is now bound to, in E.164 format
|
|
69
|
+
*/
|
|
70
|
+
number?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface TokenCreateParams {
|
|
73
|
+
/**
|
|
74
|
+
* Body param: Your identifier for the app user, such as an agent or account id.
|
|
75
|
+
* Letters, digits, hyphens and underscores only, up to 200 characters.
|
|
76
|
+
*/
|
|
77
|
+
identity?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Body param: One of your voice-enabled phone numbers in E.164 format. Calls
|
|
80
|
+
* placed by this identity are routed through that number. Omit to use your default
|
|
81
|
+
* app-call number.
|
|
82
|
+
*/
|
|
83
|
+
number?: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
86
|
+
* effects Useful for testing integrations without actual execution
|
|
87
|
+
*/
|
|
88
|
+
sandbox?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Body param: Token lifetime in seconds. Defaults to 600 and cannot exceed 3600.
|
|
91
|
+
*/
|
|
92
|
+
ttl?: number | null;
|
|
93
|
+
/**
|
|
94
|
+
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
95
|
+
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
96
|
+
* hours per key per customer.
|
|
97
|
+
*/
|
|
98
|
+
'Idempotency-Key'?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
101
|
+
* organization API keys can use this header. The profile must belong to the
|
|
102
|
+
* calling organization.
|
|
103
|
+
*/
|
|
104
|
+
'x-profile-id'?: string;
|
|
105
|
+
}
|
|
106
|
+
export declare namespace Tokens {
|
|
107
|
+
export { type APIResponseOfVoiceToken as APIResponseOfVoiceToken, type VoiceToken as VoiceToken, type TokenCreateParams as TokenCreateParams, };
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=tokens.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.mts","sourceRoot":"","sources":["../../src/resources/voice/tokens.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,WAAW,wBAAoB;AAC3C,OAAO,EAAE,UAAU,EAAE,mCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAEhE;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACr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IResource } from "../../core/resource.js";
|
|
2
|
+
import * as WebhooksAPI from "../webhooks.js";
|
|
3
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
5
|
+
/**
|
|
6
|
+
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
7
|
+
*
|
|
8
|
+
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
9
|
+
*
|
|
10
|
+
* Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Tokens extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Mints a short-lived token for one of your app users. Call this from your backend
|
|
15
|
+
* and return the token to your app, which passes it to the voice client SDK to
|
|
16
|
+
* register. The identity is bound to the given number, or to your default app-call
|
|
17
|
+
* number when omitted, and calls placed by that identity are routed through the
|
|
18
|
+
* bound number. Minting again re-binds the identity, so an identity can move
|
|
19
|
+
* between numbers.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const apiResponseOfVoiceToken =
|
|
24
|
+
* await client.voice.tokens.create();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
create(params: TokenCreateParams, options?: RequestOptions): APIPromise<APIResponseOfVoiceToken>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Standard API response envelope for all v3 endpoints
|
|
31
|
+
*/
|
|
32
|
+
export interface APIResponseOfVoiceToken {
|
|
33
|
+
/**
|
|
34
|
+
* A short-lived token your app passes to the voice client SDK to register
|
|
35
|
+
*/
|
|
36
|
+
data?: VoiceToken | null;
|
|
37
|
+
/**
|
|
38
|
+
* Error information
|
|
39
|
+
*/
|
|
40
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
41
|
+
/**
|
|
42
|
+
* Request and response metadata
|
|
43
|
+
*/
|
|
44
|
+
meta?: WebhooksAPI.APIMeta;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates whether the request was successful
|
|
47
|
+
*/
|
|
48
|
+
success?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A short-lived token your app passes to the voice client SDK to register
|
|
52
|
+
*/
|
|
53
|
+
export interface VoiceToken {
|
|
54
|
+
/**
|
|
55
|
+
* The signed token. Hand it to the client SDK unchanged. Treat it as opaque: read
|
|
56
|
+
* the identity, number, and expiry from this response, not from the token.
|
|
57
|
+
*/
|
|
58
|
+
token?: string;
|
|
59
|
+
/**
|
|
60
|
+
* When the token expires (UTC)
|
|
61
|
+
*/
|
|
62
|
+
expires_at?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The identity the token was minted for
|
|
65
|
+
*/
|
|
66
|
+
identity?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The phone number this identity is now bound to, in E.164 format
|
|
69
|
+
*/
|
|
70
|
+
number?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface TokenCreateParams {
|
|
73
|
+
/**
|
|
74
|
+
* Body param: Your identifier for the app user, such as an agent or account id.
|
|
75
|
+
* Letters, digits, hyphens and underscores only, up to 200 characters.
|
|
76
|
+
*/
|
|
77
|
+
identity?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Body param: One of your voice-enabled phone numbers in E.164 format. Calls
|
|
80
|
+
* placed by this identity are routed through that number. Omit to use your default
|
|
81
|
+
* app-call number.
|
|
82
|
+
*/
|
|
83
|
+
number?: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
86
|
+
* effects Useful for testing integrations without actual execution
|
|
87
|
+
*/
|
|
88
|
+
sandbox?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Body param: Token lifetime in seconds. Defaults to 600 and cannot exceed 3600.
|
|
91
|
+
*/
|
|
92
|
+
ttl?: number | null;
|
|
93
|
+
/**
|
|
94
|
+
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
95
|
+
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
96
|
+
* hours per key per customer.
|
|
97
|
+
*/
|
|
98
|
+
'Idempotency-Key'?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
101
|
+
* organization API keys can use this header. The profile must belong to the
|
|
102
|
+
* calling organization.
|
|
103
|
+
*/
|
|
104
|
+
'x-profile-id'?: string;
|
|
105
|
+
}
|
|
106
|
+
export declare namespace Tokens {
|
|
107
|
+
export { type APIResponseOfVoiceToken as APIResponseOfVoiceToken, type VoiceToken as VoiceToken, type TokenCreateParams as TokenCreateParams, };
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/resources/voice/tokens.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,WAAW,uBAAoB;AAC3C,OAAO,EAAE,UAAU,EAAE,kCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;CAcjG;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.Tokens = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const headers_1 = require("../../internal/headers.js");
|
|
7
|
+
/**
|
|
8
|
+
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
9
|
+
*
|
|
10
|
+
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
11
|
+
*
|
|
12
|
+
* Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
13
|
+
*/
|
|
14
|
+
class Tokens extends resource_1.APIResource {
|
|
15
|
+
/**
|
|
16
|
+
* Mints a short-lived token for one of your app users. Call this from your backend
|
|
17
|
+
* and return the token to your app, which passes it to the voice client SDK to
|
|
18
|
+
* register. The identity is bound to the given number, or to your default app-call
|
|
19
|
+
* number when omitted, and calls placed by that identity are routed through the
|
|
20
|
+
* bound number. Minting again re-binds the identity, so an identity can move
|
|
21
|
+
* between numbers.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const apiResponseOfVoiceToken =
|
|
26
|
+
* await client.voice.tokens.create();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
create(params, options) {
|
|
30
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
31
|
+
return this._client.post('/v3/voice/tokens', {
|
|
32
|
+
body,
|
|
33
|
+
...options,
|
|
34
|
+
headers: (0, headers_1.buildHeaders)([
|
|
35
|
+
{
|
|
36
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
37
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
38
|
+
},
|
|
39
|
+
options?.headers,
|
|
40
|
+
]),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Tokens = Tokens;
|
|
45
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/resources/voice/tokens.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAsD;AAGtD;;;;;;GAMG;AACH,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAyB,EAAE,OAAwB;QACxD,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB;oBACE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBAC/E,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACrE;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AA7BD,wBA6BC"}
|