"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MolocoAPIClient = void 0;
class MolocoAPIClient {
    constructor(request, settings) {
        this.platformId = settings.platformId;
        this.platformName = settings.platformName ?? '';
        this.apiKey = settings.apiKey;
        this.request = request;
        this.url = this.getEndpoint();
    }
    getEndpoint() {
        const nameOrId = this.platformName ? this.platformName : this.platformId;
        return `https://${nameOrId.replace(/_/g, '-')}-evt.rmp-api.moloco.com/cdp/SEGMENT`;
    }
    async sendEvent(body) {
        const headers = {
            'x-api-key': this.apiKey,
            'x-platform-id': this.platformId,
            'Content-Type': 'application/json'
        };
        return await this.request(this.url, {
            method: 'POST',
            headers,
            json: body
        });
    }
}
exports.MolocoAPIClient = MolocoAPIClient;
//# sourceMappingURL=request-client.js.map