"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGroupMembers = void 0;
const tslib_1 = require("tslib");
const axios_1 = require("axios");
const helpers_1 = require("../helpers");
const constants_1 = require("../constants");
const getGroupMembers = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
    const { chatId, page = 1, limit = 20, env = constants_1.default.ENV.PROD } = options;
    try {
        if (!chatId) {
            throw new Error('Chat ID is required.');
        }
        const API_BASE_URL = (0, helpers_1.getAPIBaseUrls)(env);
        const requestUrl = `${API_BASE_URL}/v1/chat/groups/${chatId}/members?pageNumber=${page}&pageSize=${limit}`;
        const response = yield axios_1.default.get(requestUrl);
        return response.data.members;
    }
    catch (error) {
        console.error(`[Push SDK] - API - Error - API ${exports.getGroupMembers.name} -: `, error);
        throw new Error(`[Push SDK] - API - Error - API ${exports.getGroupMembers.name} -: ${error}`);
    }
});
exports.getGroupMembers = getGroupMembers;
//# sourceMappingURL=getGroupMembers.js.map