"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
const properties_1 = require("../properties");
const versioning_info_1 = require("../versioning-info");
class Client {
    constructor(request, objectType) {
        this.request = request;
        this.objectType = objectType;
    }
    async readProperties(sensitive) {
        const sensitivity = '?dataSensitivity=sensitive';
        const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_API_VERSION}/properties/${this.objectType}${sensitive ? sensitivity : ''}`, {
            method: 'GET',
            skipResponseCloning: true
        });
        return response;
    }
    async createPropertiesDefinition(json) {
        const response = this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_API_VERSION}/properties/${this.objectType}/batch/create`, {
            method: 'POST',
            skipResponseCloning: true,
            json
        });
        return response;
    }
    async batchObjectRequest(action, objectType, json) {
        const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_API_VERSION}/objects/${objectType}/batch/${action}`, {
            method: 'POST',
            json
        });
        return response;
    }
    async batchAssociationsRequest(json, toObjectType) {
        const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_ASSOCIATIONS_API_VERSION}/associations/${this.objectType}/${toObjectType}/batch/create`, {
            method: 'POST',
            json
        });
        return response;
    }
    async batchDissociationsRequest(json, toObjectType) {
        const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_ASSOCIATIONS_API_VERSION}/associations/${this.objectType}/${toObjectType}/batch/labels/archive`, {
            method: 'POST',
            json
        });
        return response;
    }
    async readList(name) {
        const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_API_VERSION}/lists/object-type-id/${this.objectType}/name/${name}`, {
            method: 'GET'
        });
        return response;
    }
    async createList(json) {
        const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_API_VERSION}/lists`, {
            method: 'POST',
            json
        });
        return response;
    }
    async addRemoveFromList(listId, json) {
        const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/crm/${versioning_info_1.HUBSPOT_CRM_API_VERSION}/lists/${listId}/memberships/add-and-remove`, {
            method: 'PUT',
            json
        });
        return response;
    }
}
exports.Client = Client;
//# sourceMappingURL=client.js.map