@mimamch/qontak
Version:
Mekari Qontak API
25 lines (24 loc) • 1.49 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIntegrationWhatsappChannels = void 0;
const getIntegrationWhatsappChannels = (options) => (props) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
yield options.authenticate();
const response = yield options.axios.get("/api/open/v1/integrations", {
params: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.pagination), { target_channel: (_a = props === null || props === void 0 ? void 0 : props.target_channel) !== null && _a !== void 0 ? _a : "wa_cloud" }),
});
return {
channels: response.data.data,
pagination: response.data.meta.pagination,
};
});
exports.getIntegrationWhatsappChannels = getIntegrationWhatsappChannels;