@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
72 lines (71 loc) • 2.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const BaseAPI_1 = require("../../../common/BaseAPI");
const Mapper_1 = require("../../../common/Mapper");
const AgentSessionHistoryResponse_1 = require("../../../models/AgentSessionHistoryResponse");
const AgentSessionListResponse_1 = require("../../../models/AgentSessionListResponse");
const AgentSessionResponse_1 = require("../../../models/AgentSessionResponse");
/**
* SessionsApi - object-oriented interface
* @export
* @class SessionsApi
* @extends {BaseAPI}
*/
class SessionsApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* @summary Create Agent Session
* @param {string} xUserId User ID used to scope agent sessions
* @throws {BitmovinError}
* @memberof SessionsApi
*/
create() {
return this.restClient.post('/agents/assistant/sessions', {}).then((response) => {
return (0, Mapper_1.map)(response, AgentSessionResponse_1.default);
});
}
/**
* @summary Delete Agent Session
* @param {string} sessionId Id of the session
* @param {string} xUserId User ID used to scope agent sessions
* @throws {BitmovinError}
* @memberof SessionsApi
*/
delete(sessionId) {
const pathParamMap = {
session_id: sessionId
};
return this.restClient.delete('/agents/assistant/sessions/{session_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, AgentSessionResponse_1.default);
});
}
/**
* @summary Get Agent Session Details
* @param {string} sessionId Id of the session
* @param {string} xUserId User ID used to scope agent sessions
* @throws {BitmovinError}
* @memberof SessionsApi
*/
get(sessionId) {
const pathParamMap = {
session_id: sessionId
};
return this.restClient.get('/agents/assistant/sessions/{session_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, AgentSessionHistoryResponse_1.default);
});
}
/**
* @summary List Agent Sessions
* @param {string} xUserId User ID used to scope agent sessions
* @throws {BitmovinError}
* @memberof SessionsApi
*/
list() {
return this.restClient.get('/agents/assistant/sessions', {}).then((response) => {
return (0, Mapper_1.map)(response, AgentSessionListResponse_1.default);
});
}
}
exports.default = SessionsApi;