"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FreshsalesApiClient = void 0;
const axios_1 = __importDefault(require("axios"));
class FreshsalesApiClient {
    constructor({ baseUrl, apiKey }) {
        this.client = axios_1.default.create({
            baseURL: baseUrl,
            headers: {
                Authorization: `Token token=${apiKey}`,
                'Content-Type': 'application/json',
            },
        });
    }
    async getLead(leadId) {
        const response = await this.client.get(`/leads/${leadId}`);
        return response;
    }
    async searchLeadByEmail(email) {
        const body = {
            filter_rule: [
                { attribute: 'lead_email.email', operator: 'equals', value: email },
            ],
        };
        const response = await this.client.post(`/filtered_search/lead`, body);
        return response;
    }
    async searchContactByEmail(email) {
        const body = {
            filter_rule: [
                { attribute: 'contact_email.email', operator: 'equals', value: email },
            ],
        };
        const response = await this.client.post(`/filtered_search/contact`, body);
        return response;
    }
}
exports.FreshsalesApiClient = FreshsalesApiClient;
//# sourceMappingURL=client.js.map