@sentdm/sentdm 0.41.0 → 0.42.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/client.d.mts +18 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +18 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +13 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +13 -0
  9. package/client.mjs.map +1 -1
  10. package/core/pagination.d.mts +25 -0
  11. package/core/pagination.d.mts.map +1 -1
  12. package/core/pagination.d.ts +25 -0
  13. package/core/pagination.d.ts.map +1 -1
  14. package/core/pagination.js +28 -1
  15. package/core/pagination.js.map +1 -1
  16. package/core/pagination.mjs +26 -0
  17. package/core/pagination.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/calls/calls.d.mts +386 -0
  20. package/resources/calls/calls.d.mts.map +1 -0
  21. package/resources/calls/calls.d.ts +386 -0
  22. package/resources/calls/calls.d.ts.map +1 -0
  23. package/resources/calls/calls.js +158 -0
  24. package/resources/calls/calls.js.map +1 -0
  25. package/resources/calls/calls.mjs +153 -0
  26. package/resources/calls/calls.mjs.map +1 -0
  27. package/resources/calls/index.d.mts +3 -0
  28. package/resources/calls/index.d.mts.map +1 -0
  29. package/resources/calls/index.d.ts +3 -0
  30. package/resources/calls/index.d.ts.map +1 -0
  31. package/resources/calls/index.js +9 -0
  32. package/resources/calls/index.js.map +1 -0
  33. package/resources/calls/index.mjs +4 -0
  34. package/resources/calls/index.mjs.map +1 -0
  35. package/resources/calls/participants.d.mts +258 -0
  36. package/resources/calls/participants.d.mts.map +1 -0
  37. package/resources/calls/participants.d.ts +258 -0
  38. package/resources/calls/participants.d.ts.map +1 -0
  39. package/resources/calls/participants.js +158 -0
  40. package/resources/calls/participants.js.map +1 -0
  41. package/resources/calls/participants.mjs +154 -0
  42. package/resources/calls/participants.mjs.map +1 -0
  43. package/resources/calls.d.mts +2 -0
  44. package/resources/calls.d.mts.map +1 -0
  45. package/resources/calls.d.ts +2 -0
  46. package/resources/calls.d.ts.map +1 -0
  47. package/resources/calls.js +6 -0
  48. package/resources/calls.js.map +1 -0
  49. package/resources/calls.mjs +3 -0
  50. package/resources/calls.mjs.map +1 -0
  51. package/resources/channels/channels.d.mts +10 -0
  52. package/resources/channels/channels.d.mts.map +1 -0
  53. package/resources/channels/channels.d.ts +10 -0
  54. package/resources/channels/channels.d.ts.map +1 -0
  55. package/resources/channels/channels.js +17 -0
  56. package/resources/channels/channels.js.map +1 -0
  57. package/resources/channels/channels.mjs +12 -0
  58. package/resources/channels/channels.mjs.map +1 -0
  59. package/resources/channels/index.d.mts +3 -0
  60. package/resources/channels/index.d.mts.map +1 -0
  61. package/resources/channels/index.d.ts +3 -0
  62. package/resources/channels/index.d.ts.map +1 -0
  63. package/resources/channels/index.js +9 -0
  64. package/resources/channels/index.js.map +1 -0
  65. package/resources/channels/index.mjs +4 -0
  66. package/resources/channels/index.mjs.map +1 -0
  67. package/resources/channels/voice.d.mts +654 -0
  68. package/resources/channels/voice.d.mts.map +1 -0
  69. package/resources/channels/voice.d.ts +654 -0
  70. package/resources/channels/voice.d.ts.map +1 -0
  71. package/resources/channels/voice.js +285 -0
  72. package/resources/channels/voice.js.map +1 -0
  73. package/resources/channels/voice.mjs +281 -0
  74. package/resources/channels/voice.mjs.map +1 -0
  75. package/resources/channels.d.mts +2 -0
  76. package/resources/channels.d.mts.map +1 -0
  77. package/resources/channels.d.ts +2 -0
  78. package/resources/channels.d.ts.map +1 -0
  79. package/resources/channels.js +6 -0
  80. package/resources/channels.js.map +1 -0
  81. package/resources/channels.mjs +3 -0
  82. package/resources/channels.mjs.map +1 -0
  83. package/resources/index.d.mts +3 -1
  84. package/resources/index.d.mts.map +1 -1
  85. package/resources/index.d.ts +3 -1
  86. package/resources/index.d.ts.map +1 -1
  87. package/resources/index.js +5 -1
  88. package/resources/index.js.map +1 -1
  89. package/resources/index.mjs +2 -0
  90. package/resources/index.mjs.map +1 -1
  91. package/resources/webhooks.d.mts +104 -106
  92. package/resources/webhooks.d.mts.map +1 -1
  93. package/resources/webhooks.d.ts +104 -106
  94. package/resources/webhooks.d.ts.map +1 -1
  95. package/src/client.ts +60 -0
  96. package/src/core/pagination.ts +59 -0
  97. package/src/resources/calls/calls.ts +554 -0
  98. package/src/resources/calls/index.ts +31 -0
  99. package/src/resources/calls/participants.ts +367 -0
  100. package/src/resources/calls.ts +3 -0
  101. package/src/resources/channels/channels.ts +61 -0
  102. package/src/resources/channels/index.ts +27 -0
  103. package/src/resources/channels/voice.ts +864 -0
  104. package/src/resources/channels.ts +3 -0
  105. package/src/resources/index.ts +21 -0
  106. package/src/resources/webhooks.ts +119 -119
  107. package/src/version.ts +1 -1
  108. package/version.d.mts +1 -1
  109. package/version.d.ts +1 -1
  110. package/version.js +1 -1
  111. package/version.mjs +1 -1
@@ -0,0 +1,153 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as ParticipantsAPI from "./participants.mjs";
4
+ import { Participants, } from "./participants.mjs";
5
+ import { CallsPage } from "../../core/pagination.mjs";
6
+ import { buildHeaders } from "../../internal/headers.mjs";
7
+ import { path } from "../../internal/utils/path.mjs";
8
+ /**
9
+ * Phone calls from the numbers you hold, driven by your own callback URL.
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/channels/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
+ *
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.
14
+ */
15
+ export class Calls extends APIResource {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.participants = new ParticipantsAPI.Participants(this._client);
19
+ }
20
+ /**
21
+ * Retrieves one of your calls by id: the parties, the owning number, the current
22
+ * status with its failure reason, duration, price, recording availability, and a
23
+ * timeline of when the call entered each status.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const apiResponseOfCall = await client.calls.retrieve(
28
+ * 'call_9f2ab000-0000-4000-8000-000000000001',
29
+ * );
30
+ * ```
31
+ */
32
+ retrieve(id, params = {}, options) {
33
+ const { 'x-profile-id': xProfileID } = params ?? {};
34
+ return this._client.get(path `/v3/calls/${id}`, {
35
+ ...options,
36
+ headers: buildHeaders([
37
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
38
+ options?.headers,
39
+ ]),
40
+ });
41
+ }
42
+ /**
43
+ * Retrieves a paginated list of your calls, most recent first. Filter by
44
+ * direction, status, the owning number, and the time the call started (from and to
45
+ * are inclusive). Use the call webhooks for real-time updates; this list is for
46
+ * looking calls up afterwards.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * // Automatically fetches more pages as needed.
51
+ * for await (const call of client.calls.list()) {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ list(params = {}, options) {
57
+ const { 'x-profile-id': xProfileID, ...query } = params ?? {};
58
+ return this._client.getAPIList('/v3/calls', (CallsPage), {
59
+ query,
60
+ ...options,
61
+ headers: buildHeaders([
62
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
63
+ options?.headers,
64
+ ]),
65
+ });
66
+ }
67
+ /**
68
+ * Ends one of your live calls. The call then ends the way any other call does: its
69
+ * status moves to completed and call.completed is sent once the disconnect is
70
+ * reported. A call that has already ended answers 409, and so does a call with no
71
+ * phone leg, such as one between two app users.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * await client.calls.hangup(
76
+ * 'call_9f2ab000-0000-4000-8000-000000000001',
77
+ * );
78
+ * ```
79
+ */
80
+ hangup(id, params, options) {
81
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
82
+ return this._client.post(path `/v3/calls/${id}/hangup`, {
83
+ body,
84
+ ...options,
85
+ headers: buildHeaders([
86
+ {
87
+ Accept: '*/*',
88
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
89
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
90
+ },
91
+ options?.headers,
92
+ ]),
93
+ });
94
+ }
95
+ /**
96
+ * Returns pre-signed links to the recordings of one of your calls, each valid
97
+ * until its url_expires_at. A recording appears once the call was recorded, by a
98
+ * connect answer with record set, a startRecording instruction or the recordings
99
+ * command, and the call.recording_ready webhook has been sent; until then, and for
100
+ * a call that was never recorded, the list is empty. A call recorded more than
101
+ * once lists every recording, oldest first, each under the recording_id its
102
+ * call.recording_ready webhook carried.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const apiResponseOfCallRecordings =
107
+ * await client.calls.listRecordings(
108
+ * 'call_9f2ab000-0000-4000-8000-000000000001',
109
+ * );
110
+ * ```
111
+ */
112
+ listRecordings(id, params = {}, options) {
113
+ const { 'x-profile-id': xProfileID } = params ?? {};
114
+ return this._client.get(path `/v3/calls/${id}/recordings`, {
115
+ ...options,
116
+ headers: buildHeaders([
117
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
118
+ options?.headers,
119
+ ]),
120
+ });
121
+ }
122
+ /**
123
+ * Starts or stops recording one of your live calls. Use start to begin recording
124
+ * mid-call, or stop to end a recording, whether it was started here or by a
125
+ * connect answer with record set. A call that has already ended answers 409, and
126
+ * so does a call with no phone leg, such as one between two app users, which can't
127
+ * be recorded.
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * await client.calls.record(
132
+ * 'call_9f2ab000-0000-4000-8000-000000000001',
133
+ * );
134
+ * ```
135
+ */
136
+ record(id, params, options) {
137
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
138
+ return this._client.post(path `/v3/calls/${id}/recordings`, {
139
+ body,
140
+ ...options,
141
+ headers: buildHeaders([
142
+ {
143
+ Accept: '*/*',
144
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
145
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
146
+ },
147
+ options?.headers,
148
+ ]),
149
+ });
150
+ }
151
+ }
152
+ Calls.Participants = Participants;
153
+ //# sourceMappingURL=calls.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.mjs","sourceRoot":"","sources":["../../src/resources/calls/calls.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,KAAK,eAAe,2BAAuB;AAClD,OAAO,EASL,YAAY,GACb,2BAAuB;AAExB,OAAO,EAAE,SAAS,EAAqC,kCAA8B;AACrF,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;;;;;GAMG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAoJ9F,CAAC;IAlJC;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,EAAU,EACV,SAAgD,EAAE,EAClD,OAAwB;QAExB,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,EAAE,EAAE;YAC7C,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,S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OfCall, 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.mjs";
2
+ export { Participants, type APIResponseOfListOfCallParticipant, type CallParticipant, type CallParticipantTarget, type ParticipantUpdateParams, type ParticipantListParams, type ParticipantAddParams, type ParticipantRemoveParams, type ParticipantRemoveAllParams, } from "./participants.mjs";
3
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/calls/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,oBAAgB;AACjB,OAAO,EACL,YAAY,EACZ,KAAK,kCAAkC,EACvC,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,GAChC,2BAAuB"}
@@ -0,0 +1,3 @@
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.js";
2
+ export { Participants, type APIResponseOfListOfCallParticipant, type CallParticipant, type CallParticipantTarget, type ParticipantUpdateParams, type ParticipantListParams, type ParticipantAddParams, type ParticipantRemoveParams, type ParticipantRemoveAllParams, } from "./participants.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/calls/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,mBAAgB;AACjB,OAAO,EACL,YAAY,EACZ,KAAK,kCAAkC,EACvC,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,GAChC,0BAAuB"}
@@ -0,0 +1,9 @@
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.Participants = exports.Calls = void 0;
5
+ var calls_1 = require("./calls.js");
6
+ Object.defineProperty(exports, "Calls", { enumerable: true, get: function () { return calls_1.Calls; } });
7
+ var participants_1 = require("./participants.js");
8
+ Object.defineProperty(exports, "Participants", { enumerable: true, get: function () { return participants_1.Participants; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/calls/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAiBiB;AAhBf,8FAAA,KAAK,OAAA;AAiBP,kDAUwB;AATtB,4GAAA,YAAY,OAAA"}
@@ -0,0 +1,4 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export { Calls, } from "./calls.mjs";
3
+ export { Participants, } from "./participants.mjs";
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/calls/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,KAAK,GAgBN,oBAAgB;AACjB,OAAO,EACL,YAAY,GASb,2BAAuB"}
@@ -0,0 +1,258 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import * as WebhooksAPI from "../webhooks.mjs";
3
+ import * as CallsAPI from "./calls.mjs";
4
+ import { APIPromise } from "../../core/api-promise.mjs";
5
+ import { RequestOptions } from "../../internal/request-options.mjs";
6
+ /**
7
+ * Phone calls from the numbers you hold, driven by your own callback URL.
8
+ *
9
+ * `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/channels/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.
10
+ *
11
+ * 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.
12
+ */
13
+ export declare class Participants extends APIResource {
14
+ /**
15
+ * Mutes or unmutes one participant of the conference room a live call is in, named
16
+ * by the participant's own call id from the participants list: send muted true to
17
+ * silence them, muted false to let them be heard again. Muting a participant who
18
+ * is already muted succeeds, as does unmuting one who is not. A participant who is
19
+ * not in this call's room answers 404. A call that has ended answers 409, as does
20
+ * a call that is not in a conference.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * await client.calls.participants.update(
25
+ * 'call_9f2ab000-0000-4000-8000-000000000002',
26
+ * { id: 'call_9f2ab000-0000-4000-8000-000000000001' },
27
+ * );
28
+ * ```
29
+ */
30
+ update(participantID: string, params: ParticipantUpdateParams, options?: RequestOptions): APIPromise<void>;
31
+ /**
32
+ * Lists who is in the conference room one of your live calls is in: each
33
+ * participant's own call id, who they are, whether the room mutes them, and how
34
+ * long they have been connected. The call itself is one of the participants. Use a
35
+ * participant's id to mute or remove them; it is also a call id, so GET
36
+ * /v3/calls/{id} accepts it. A call that has ended answers 409, as does a call
37
+ * that is not in a conference.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const apiResponseOfListOfCallParticipant =
42
+ * await client.calls.participants.list(
43
+ * 'call_9f2ab000-0000-4000-8000-000000000001',
44
+ * );
45
+ * ```
46
+ */
47
+ list(id: string, params?: ParticipantListParams | null | undefined, options?: RequestOptions): APIPromise<APIResponseOfListOfCallParticipant>;
48
+ /**
49
+ * Dials one of your app users or a phone number into a call that is in a
50
+ * conference room, and answers with the participant's own call record. The
51
+ * participant is a call of their own: it has its own id, can be looked up and hung
52
+ * up, and is billed and reported through call.completed and call.failed like any
53
+ * other call. A phone participant is called from caller_id, which must be one of
54
+ * your numbers, or from the call's owning number when omitted, and needs a
55
+ * destination you may call and a positive balance. Only a call your answer
56
+ * connected to a conference can take participants: a call connected to a user or a
57
+ * number answers 409.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const apiResponseOfCall =
62
+ * await client.calls.participants.add(
63
+ * 'call_9f2ab000-0000-4000-8000-000000000001',
64
+ * );
65
+ * ```
66
+ */
67
+ add(id: string, params: ParticipantAddParams, options?: RequestOptions): APIPromise<CallsAPI.APIResponseOfCall>;
68
+ /**
69
+ * Removes one participant from the conference room a live call is in, named by the
70
+ * participant's own call id from the participants list. Their leg ends and is
71
+ * reported through call.completed like any other call; everyone else stays
72
+ * connected. A participant who is not in this call's room answers 404. A call that
73
+ * has ended answers 409, as does a call that is not in a conference.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * await client.calls.participants.remove(
78
+ * 'call_9f2ab000-0000-4000-8000-000000000002',
79
+ * { id: 'call_9f2ab000-0000-4000-8000-000000000001' },
80
+ * );
81
+ * ```
82
+ */
83
+ remove(participantID: string, params: ParticipantRemoveParams, options?: RequestOptions): APIPromise<void>;
84
+ /**
85
+ * Removes every participant from the conference room a live call is in, the call
86
+ * itself included. Every leg ends and is reported through call.completed like any
87
+ * other call. A room that is already empty answers 204 as well. A call that has
88
+ * ended answers 409, as does a call that is not in a conference.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * await client.calls.participants.removeAll(
93
+ * 'call_9f2ab000-0000-4000-8000-000000000001',
94
+ * );
95
+ * ```
96
+ */
97
+ removeAll(id: string, params: ParticipantRemoveAllParams, options?: RequestOptions): APIPromise<void>;
98
+ }
99
+ /**
100
+ * Standard API response envelope for all v3 endpoints
101
+ */
102
+ export interface APIResponseOfListOfCallParticipant {
103
+ /**
104
+ * The response data (null if error)
105
+ */
106
+ data?: Array<CallParticipant> | null;
107
+ /**
108
+ * Error information
109
+ */
110
+ error?: WebhooksAPI.ErrorDetail | null;
111
+ /**
112
+ * Request and response metadata
113
+ */
114
+ meta?: WebhooksAPI.APIMeta;
115
+ /**
116
+ * Indicates whether the request was successful
117
+ */
118
+ success?: boolean;
119
+ }
120
+ /**
121
+ * A participant of a conference call
122
+ */
123
+ export interface CallParticipant {
124
+ /**
125
+ * The participant's own call id: what the mute and remove endpoints take, and what
126
+ * GET /v3/calls/{id} accepts
127
+ */
128
+ id?: string;
129
+ /**
130
+ * How long the participant has been connected to the room, in seconds
131
+ */
132
+ duration_seconds?: number;
133
+ /**
134
+ * user for one of your app users, number for a phone number, anonymous for a
135
+ * caller who withheld their number
136
+ */
137
+ kind?: string;
138
+ /**
139
+ * True while the room mutes this participant
140
+ */
141
+ muted?: boolean;
142
+ /**
143
+ * The app user's identity or the phone number in E.164 format. Null when the kind
144
+ * is anonymous
145
+ */
146
+ value?: string | null;
147
+ }
148
+ /**
149
+ * A participant to add to a call
150
+ */
151
+ export interface CallParticipantTarget {
152
+ /**
153
+ * user for one of your app users, number for a phone number
154
+ */
155
+ kind?: string;
156
+ /**
157
+ * The app user's identity, or the phone number in E.164 format
158
+ */
159
+ value?: string;
160
+ }
161
+ export interface ParticipantUpdateParams {
162
+ /**
163
+ * Path param: The call id from the route, as carried by call webhooks and the
164
+ * calls list, for example call_9f2ab000-0000-4000-8000-000000000001
165
+ */
166
+ id: string;
167
+ /**
168
+ * Body param: true to mute the participant, false to unmute them
169
+ */
170
+ muted?: boolean;
171
+ /**
172
+ * Body param: Sandbox flag - when true, the operation is simulated without side
173
+ * effects Useful for testing integrations without actual execution
174
+ */
175
+ sandbox?: boolean;
176
+ /**
177
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
178
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
179
+ * hours per key per customer.
180
+ */
181
+ 'Idempotency-Key'?: string;
182
+ /**
183
+ * Header param: Profile UUID to scope the request to a child profile. Only
184
+ * organization API keys can use this header. The profile must belong to the
185
+ * calling organization.
186
+ */
187
+ 'x-profile-id'?: string;
188
+ }
189
+ export interface ParticipantListParams {
190
+ /**
191
+ * Profile UUID to scope the request to a child profile. Only organization API keys
192
+ * can use this header. The profile must belong to the calling organization.
193
+ */
194
+ 'x-profile-id'?: string;
195
+ }
196
+ export interface ParticipantAddParams {
197
+ /**
198
+ * Body param: The number shown to a phone participant as the caller, in E.164
199
+ * format. Must be one of your numbers. The call's owning number when omitted
200
+ */
201
+ caller_id?: string | null;
202
+ /**
203
+ * Body param: Sandbox flag - when true, the operation is simulated without side
204
+ * effects Useful for testing integrations without actual execution
205
+ */
206
+ sandbox?: boolean;
207
+ /**
208
+ * Body param: A participant to add to a call
209
+ */
210
+ to?: CallParticipantTarget;
211
+ /**
212
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
213
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
214
+ * hours per key per customer.
215
+ */
216
+ 'Idempotency-Key'?: string;
217
+ /**
218
+ * Header param: Profile UUID to scope the request to a child profile. Only
219
+ * organization API keys can use this header. The profile must belong to the
220
+ * calling organization.
221
+ */
222
+ 'x-profile-id'?: string;
223
+ }
224
+ export interface ParticipantRemoveParams {
225
+ /**
226
+ * Path param: The call id from the route, as carried by call webhooks and the
227
+ * calls list, for example call_9f2ab000-0000-4000-8000-000000000001
228
+ */
229
+ id: string;
230
+ /**
231
+ * Body param: Sandbox flag - when true, the operation is simulated without side
232
+ * effects Useful for testing integrations without actual execution
233
+ */
234
+ sandbox?: boolean;
235
+ /**
236
+ * Header param: Profile UUID to scope the request to a child profile. Only
237
+ * organization API keys can use this header. The profile must belong to the
238
+ * calling organization.
239
+ */
240
+ 'x-profile-id'?: string;
241
+ }
242
+ export interface ParticipantRemoveAllParams {
243
+ /**
244
+ * Body param: Sandbox flag - when true, the operation is simulated without side
245
+ * effects Useful for testing integrations without actual execution
246
+ */
247
+ sandbox?: boolean;
248
+ /**
249
+ * Header param: Profile UUID to scope the request to a child profile. Only
250
+ * organization API keys can use this header. The profile must belong to the
251
+ * calling organization.
252
+ */
253
+ 'x-profile-id'?: string;
254
+ }
255
+ export declare namespace Participants {
256
+ export { type APIResponseOfListOfCallParticipant as APIResponseOfListOfCallParticipant, type CallParticipant as CallParticipant, type CallParticipantTarget as CallParticipantTarget, type ParticipantUpdateParams as ParticipantUpdateParams, type ParticipantListParams as ParticipantListParams, type ParticipantAddParams as ParticipantAddParams, type ParticipantRemoveParams as ParticipantRemoveParams, type ParticipantRemoveAllParams as ParticipantRemoveAllParams, };
257
+ }
258
+ //# sourceMappingURL=participants.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participants.d.mts","sourceRoot":"","sources":["../../src/resources/calls/participants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,WAAW,wBAAoB;AA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