@signalhousellc/sdk 1.0.61 → 1.0.62

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.
@@ -157,4 +157,41 @@ export class SipTrunks {
157
157
  async getPops({ options = {} } = {}) {
158
158
  return this.client(`/voice/sip-trunks/pops`, { method: "GET", ...options });
159
159
  }
160
+
161
+ /**
162
+ * Attach one or more phone numbers (by E.164) to a SIP trunk — routes each
163
+ * DID down the trunk. Idempotent; numbers already configured on a SIP profile
164
+ * are skipped and returned in `skipped` with a reason.
165
+ * @async
166
+ * @roles api, admin, developer
167
+ * @param {Object} params - Request parameters.
168
+ * @param {string} params.id - The SIP trunk UUID.
169
+ * @param {string[]} params.phoneNumbers - Phone numbers in E.164 (a leading "+" is optional).
170
+ * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
171
+ * @throws {Error} If id or phoneNumbers is missing.
172
+ * @returns {Promise<Object>} `{ assigned: string[], skipped: { e164, reason }[] }`.
173
+ */
174
+ async assignNumbers({ id, phoneNumbers, options = {} }) {
175
+ this.client._require({ id, phoneNumbers });
176
+ const safeId = encodeURIComponent(id);
177
+ return this.client(`/voice/sip-trunks/${safeId}/assign-numbers`, { method: "POST", body: { phoneNumbers }, ...options });
178
+ }
179
+
180
+ /**
181
+ * Detach one or more phone numbers (by E.164) from a SIP trunk — removes each
182
+ * number's SIP_TRUNK inbound route when it points at this trunk.
183
+ * @async
184
+ * @roles api, admin, developer
185
+ * @param {Object} params - Request parameters.
186
+ * @param {string} params.id - The SIP trunk UUID.
187
+ * @param {string[]} params.phoneNumbers - Phone numbers in E.164 (a leading "+" is optional).
188
+ * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
189
+ * @throws {Error} If id or phoneNumbers is missing.
190
+ * @returns {Promise<Object>} `{ unassigned: string[] }`.
191
+ */
192
+ async unassignNumbers({ id, phoneNumbers, options = {} }) {
193
+ this.client._require({ id, phoneNumbers });
194
+ const safeId = encodeURIComponent(id);
195
+ return this.client(`/voice/sip-trunks/${safeId}/unassign-numbers`, { method: "POST", body: { phoneNumbers }, ...options });
196
+ }
160
197
  }