googleapis
Version:
Google APIs Client Library for Node.js
602 lines • 21.5 kB
JavaScript
"use strict";
/**
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var apirequest_1 = require("../../lib/apirequest");
// TODO: We will eventually get the `any` in here cleared out, but in the
// interim we want to turn on no-implicit-any.
// tslint:disable: no-any
// tslint:disable: class-name
// tslint:disable: variable-name
// tslint:disable: jsdoc-format
/**
* Google Sheets API
*
* Reads and writes Google Sheets.
*
* @example
* const google = require('googleapis');
* const sheets = google.sheets('v4');
*
* @namespace sheets
* @type {Function}
* @version v4
* @variation v4
* @param {object=} options Options for Sheets
*/
var Sheets = /** @class */ (function () {
function Sheets(options, google) {
this.root = this;
this._options = options || {};
this.google = google;
this.getRoot.bind(this);
this.spreadsheets = new Resource$Spreadsheets(this);
}
Sheets.prototype.getRoot = function () {
return this.root;
};
return Sheets;
}());
exports.Sheets = Sheets;
var Resource$Spreadsheets = /** @class */ (function () {
function Resource$Spreadsheets(root) {
this.root = root;
this.getRoot.bind(this);
this.developerMetadata = new Resource$Spreadsheets$Developermetadata(root);
this.sheets = new Resource$Spreadsheets$Sheets(root);
this.values = new Resource$Spreadsheets$Values(root);
}
Resource$Spreadsheets.prototype.getRoot = function () {
return this.root;
};
Resource$Spreadsheets.prototype.batchUpdate = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets/{spreadsheetId}:batchUpdate')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets.prototype.create = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: [],
pathParams: [],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets.prototype.get = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets/{spreadsheetId}')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets.prototype.getByDataFilter = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets/{spreadsheetId}:getByDataFilter')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Spreadsheets;
}());
exports.Resource$Spreadsheets = Resource$Spreadsheets;
var Resource$Spreadsheets$Developermetadata = /** @class */ (function () {
function Resource$Spreadsheets$Developermetadata(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Spreadsheets$Developermetadata.prototype.getRoot = function () {
return this.root;
};
Resource$Spreadsheets$Developermetadata.prototype.get = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/developerMetadata/{metadataId}')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['spreadsheetId', 'metadataId'],
pathParams: ['metadataId', 'spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Developermetadata.prototype.search = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/developerMetadata:search')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Spreadsheets$Developermetadata;
}());
exports.Resource$Spreadsheets$Developermetadata = Resource$Spreadsheets$Developermetadata;
var Resource$Spreadsheets$Sheets = /** @class */ (function () {
function Resource$Spreadsheets$Sheets(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Spreadsheets$Sheets.prototype.getRoot = function () {
return this.root;
};
Resource$Spreadsheets$Sheets.prototype.copyTo = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId', 'sheetId'],
pathParams: ['sheetId', 'spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Spreadsheets$Sheets;
}());
exports.Resource$Spreadsheets$Sheets = Resource$Spreadsheets$Sheets;
var Resource$Spreadsheets$Values = /** @class */ (function () {
function Resource$Spreadsheets$Values(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Spreadsheets$Values.prototype.getRoot = function () {
return this.root;
};
Resource$Spreadsheets$Values.prototype.append = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/values/{range}:append')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId', 'range'],
pathParams: ['range', 'spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.batchClear = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets/{spreadsheetId}/values:batchClear')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.batchClearByDataFilter = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/values:batchClearByDataFilter')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.batchGet = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets/{spreadsheetId}/values:batchGet')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.batchGetByDataFilter = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/values:batchGetByDataFilter')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.batchUpdate = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/values:batchUpdate')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.batchUpdateByDataFilter = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/values:batchUpdateByDataFilter')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId'],
pathParams: ['spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.clear = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/v4/spreadsheets/{spreadsheetId}/values/{range}:clear')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['spreadsheetId', 'range'],
pathParams: ['range', 'spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.get = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets/{spreadsheetId}/values/{range}')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['spreadsheetId', 'range'],
pathParams: ['range', 'spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
Resource$Spreadsheets$Values.prototype.update = function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof params === 'function') {
callback = params;
params = {};
}
options = options || {};
var rootUrl = options.rootUrl || 'https://sheets.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/spreadsheets/{spreadsheetId}/values/{range}')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'PUT'
}, options),
params: params,
requiredParams: ['spreadsheetId', 'range'],
pathParams: ['range', 'spreadsheetId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Spreadsheets$Values;
}());
exports.Resource$Spreadsheets$Values = Resource$Spreadsheets$Values;
//# sourceMappingURL=v4.js.map