googleapis
Version:
Google APIs Client Library for Node.js
314 lines • 11.1 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 Analytics API
*
* Views and manages your Google Analytics data.
*
* @example
* const google = require('googleapis');
* const analytics = google.analytics('v2.4');
*
* @namespace analytics
* @type {Function}
* @version v2.4
* @variation v2.4
* @param {object=} options Options for Analytics
*/
var Analytics = /** @class */ (function () {
function Analytics(options, google) {
this.root = this;
this._options = options || {};
this.google = google;
this.getRoot.bind(this);
this.data = new Resource$Data(this);
this.management = new Resource$Management(this);
}
Analytics.prototype.getRoot = function () {
return this.root;
};
return Analytics;
}());
exports.Analytics = Analytics;
var Resource$Data = /** @class */ (function () {
function Resource$Data(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Data.prototype.getRoot = function () {
return this.root;
};
Resource$Data.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://www.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/analytics/v2.4/data')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['ids', 'start-date', 'end-date', 'metrics'],
pathParams: [],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Data;
}());
exports.Resource$Data = Resource$Data;
var Resource$Management = /** @class */ (function () {
function Resource$Management(root) {
this.root = root;
this.getRoot.bind(this);
this.accounts = new Resource$Management$Accounts(root);
this.goals = new Resource$Management$Goals(root);
this.profiles = new Resource$Management$Profiles(root);
this.segments = new Resource$Management$Segments(root);
this.webproperties = new Resource$Management$Webproperties(root);
}
Resource$Management.prototype.getRoot = function () {
return this.root;
};
return Resource$Management;
}());
exports.Resource$Management = Resource$Management;
var Resource$Management$Accounts = /** @class */ (function () {
function Resource$Management$Accounts(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Management$Accounts.prototype.getRoot = function () {
return this.root;
};
Resource$Management$Accounts.prototype.list = 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://www.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/analytics/v2.4/management/accounts')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: [],
pathParams: [],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Management$Accounts;
}());
exports.Resource$Management$Accounts = Resource$Management$Accounts;
var Resource$Management$Goals = /** @class */ (function () {
function Resource$Management$Goals(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Management$Goals.prototype.getRoot = function () {
return this.root;
};
Resource$Management$Goals.prototype.list = 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://www.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['accountId', 'webPropertyId', 'profileId'],
pathParams: ['accountId', 'profileId', 'webPropertyId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Management$Goals;
}());
exports.Resource$Management$Goals = Resource$Management$Goals;
var Resource$Management$Profiles = /** @class */ (function () {
function Resource$Management$Profiles(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Management$Profiles.prototype.getRoot = function () {
return this.root;
};
Resource$Management$Profiles.prototype.list = 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://www.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['accountId', 'webPropertyId'],
pathParams: ['accountId', 'webPropertyId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Management$Profiles;
}());
exports.Resource$Management$Profiles = Resource$Management$Profiles;
var Resource$Management$Segments = /** @class */ (function () {
function Resource$Management$Segments(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Management$Segments.prototype.getRoot = function () {
return this.root;
};
Resource$Management$Segments.prototype.list = 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://www.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/analytics/v2.4/management/segments')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: [],
pathParams: [],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Management$Segments;
}());
exports.Resource$Management$Segments = Resource$Management$Segments;
var Resource$Management$Webproperties = /** @class */ (function () {
function Resource$Management$Webproperties(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Management$Webproperties.prototype.getRoot = function () {
return this.root;
};
Resource$Management$Webproperties.prototype.list = 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://www.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl +
'/analytics/v2.4/management/accounts/{accountId}/webproperties')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Management$Webproperties;
}());
exports.Resource$Management$Webproperties = Resource$Management$Webproperties;
//# sourceMappingURL=v2.4.js.map