"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoogleSheets = void 0;
const API_VERSION = 'v4';
class GoogleSheets {
    constructor(request) {
        this.get = async (mappingSettings, range) => {
            return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values/${mappingSettings.spreadsheetName}!${range}`, {
                method: 'get',
                skipResponseCloning: true
            });
        };
        this.batchUpdate = async (mappingSettings, batchPayload) => {
            return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values:batchUpdate`, {
                method: 'post',
                skipResponseCloning: true,
                json: {
                    valueInputOption: mappingSettings.dataFormat,
                    data: batchPayload
                }
            });
        };
        this.append = async (mappingSettings, range, values) => {
            return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values/${mappingSettings.spreadsheetName}!${range}:append?valueInputOption=${mappingSettings.dataFormat}&insertDataOption=INSERT_ROWS`, {
                method: 'post',
                skipResponseCloning: true,
                json: {
                    values: values
                }
            });
        };
        this.request = request;
    }
}
exports.GoogleSheets = GoogleSheets;
//# sourceMappingURL=index.js.map