"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GridspaceClient = void 0;
const axios_1 = __importDefault(require("axios"));
class GridspaceClient {
    constructor({ accountId, clientSecret, }) {
        // base 64 encode the accountId and clientSecret in Basic Authentication format
        const token = Buffer.from(`${accountId}:${clientSecret}`).toString('base64');
        this.client = axios_1.default.create({
            baseURL: 'https://api.gridspace.com/v1',
            headers: {
                Authorization: `Basic ${token}`,
                'Content-Type': 'application/json',
                Accept: 'application/json',
            },
        });
    }
    async callWithGrace(workflowId, data) {
        const resp = await this.client.post(`/workflows/${workflowId}/run`, data);
        return resp.data;
    }
    async uploadContactsToCampaign(campaignId, data) {
        const response = await this.client.post(`/autodialer/${campaignId}/dialees`, data);
        return response.data;
    }
}
exports.GridspaceClient = GridspaceClient;
//# sourceMappingURL=client.js.map