Skip to content

Commit 9895f04

Browse files
andreasonny83GitHub Enterprise
authored andcommitted
FRIDGE-516 Update TaskHoldOptions (#392)
1 parent 757f1b7 commit 9895f04

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

lib/Task.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class Task extends EventEmitter {
365365
* Hold the worker's call leg in the Conference associated to this {@link Task} and specified TargetWorkerSid
366366
* @param {String } targetWorkerSid - The target worker's sid which should be put onhold or unhold
367367
* @param {boolean} onHold - Whether to hold or unhold the specified worker's call leg in the Conference referenced by the {@link Task}
368-
* @param {HoldOptions} options
368+
* @param {TaskHoldOptions} options
369369
* @returns {Promise<this>}
370370
*/
371371
hold(targetWorkerSid, onHold, options) {
@@ -605,7 +605,7 @@ export default Task;
605605
*/
606606

607607
/**
608-
* @typedef {Object} HoldOptions
609-
* @property {string} holdUrl - The URL endpoint to play when participant is on hold.
610-
* @property {'GET'} holdMethod - The HTTP method for the hold URL.
608+
* @typedef {Object} TaskHoldOptions
609+
* @property {string} [holdUrl] - The URL endpoint to play when participant is on hold.
610+
* @property {'GET'} [holdMethod] - The HTTP method for the hold URL.
611611
*/

test/unit/spec/Task.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,13 @@ describe('Task', () => {
463463
sandbox.restore();
464464
});
465465

466+
it('should use default holdMethod and holdUrl props when not provided', () => {
467+
(() => {
468+
const task = new Task(worker, new Request(config), reservationSid, assignedTaskDescriptor);
469+
task.updateParticipant();
470+
}).should.not.throw();
471+
});
472+
466473
it('should return an error if the optional params fail type check', () => {
467474
(() => {
468475
const task = new Task(worker, new Request(config), reservationSid, assignedTaskDescriptor);

types.d.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,7 @@ export interface TransferOptions {
304304
priority?: number;
305305
}
306306

307-
export interface HoldOptions {
308-
holdUrl: string;
309-
holdMethod: "GET"
310-
}
311-
312-
export interface TaskParticipantOptions extends HoldOptions {
307+
export interface TaskParticipantOptions extends TaskHoldOptions {
313308
hold: boolean;
314309
}
315310

0 commit comments

Comments
 (0)