UNPKG

verimor-api-sdk

Version:
57 lines 2.59 kB
"use strict"; 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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InboxApi = void 0; const base_api_1 = require("./base-api"); const error_response_1 = require("../models/error-response"); /** * InboxApi class provides methods to interact with inbox-related endpoints. */ class InboxApi extends base_api_1.BaseApi { /** * Creates an instance of InboxApi. * @param username - The API username. * @param password - The API password. * @param proxyConfig - Optional proxy configuration. */ constructor(username, password, proxyConfig) { super(username, password, proxyConfig); } /** * Retrieves inbox messages. * @param fromTime - Start time for fetching messages (ISO 8601 format). * @param toTime - End time for fetching messages (ISO 8601 format). * @param greaterThan - Fetch messages with message_id greater than this value. * @returns Promise resolving to an array of InboxMessage. * @throws ErrorResponse if the API call fails. */ getInboxMessages(fromTime, toTime, greaterThan) { var _a; return __awaiter(this, void 0, void 0, function* () { try { const params = this.withCredentialsParams({ from_time: fromTime, to_time: toTime, greater_than: greaterThan, }); const response = yield this.apiClient.get('/inbound_messages', { params, }); return response.data; } catch (error) { throw new error_response_1.ErrorResponse(((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || error.message); } }); } } exports.InboxApi = InboxApi; //# sourceMappingURL=inbox-api.js.map