kod-temp
Version:
Workano Communications SDK
79 lines (78 loc) • 2.93 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = __importDefault(require("../../lib/index"));
class Applications {
/**
* 1. Create a new call
* POST /applications/{applicationUuid}/calls
*/
static createCall(applicationUuid, params) {
return __awaiter(this, void 0, void 0, function* () {
try {
const response = yield index_1.default.application.createCall(applicationUuid, params);
return response;
}
catch (error) {
throw error;
}
});
}
/**
* 2. Get the list of calls
* GET /applications/{applicationUuid}/calls
*/
static listCalls(applicationUuid) {
return __awaiter(this, void 0, void 0, function* () {
try {
const response = yield index_1.default.application.calls(applicationUuid);
return response;
}
catch (error) {
throw error;
}
});
}
/**
* 3. Start playback on a call
* POST /applications/{applicationUuid}/calls/{callId}/playbacks
*/
static startPlayback(applicationUuid, callId, params) {
return __awaiter(this, void 0, void 0, function* () {
try {
const response = yield index_1.default.application.startPlaybackCall(applicationUuid, callId, params.language, params.uri);
return response;
}
catch (error) {
throw error;
}
});
}
/**
* 4. Hang up a call
* DELETE /applications/{applicationUuid}/calls/{callId}
*/
static hangupCall(applicationUuid, callId) {
return __awaiter(this, void 0, void 0, function* () {
try {
const response = yield index_1.default.application.hangupCall(applicationUuid, callId);
return response;
}
catch (error) {
throw error;
}
});
}
}
exports.default = Applications;