googleapis
Version:
Google APIs Client Library for Node.js
338 lines • 11.6 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
/**
* Safe Browsing API
*
* Enables client applications to check web resources (most commonly URLs)
* against Google-generated lists of unsafe web resources.
*
* @example
* const google = require('googleapis');
* const safebrowsing = google.safebrowsing('v4');
*
* @namespace safebrowsing
* @type {Function}
* @version v4
* @variation v4
* @param {object=} options Options for Safebrowsing
*/
var Safebrowsing = /** @class */ (function () {
function Safebrowsing(options, google) {
this.root = this;
this._options = options || {};
this.google = google;
this.getRoot.bind(this);
this.encodedFullHashes = new Resource$Encodedfullhashes(this);
this.encodedUpdates = new Resource$Encodedupdates(this);
this.fullHashes = new Resource$Fullhashes(this);
this.threatHits = new Resource$Threathits(this);
this.threatLists = new Resource$Threatlists(this);
this.threatListUpdates = new Resource$Threatlistupdates(this);
this.threatMatches = new Resource$Threatmatches(this);
}
Safebrowsing.prototype.getRoot = function () {
return this.root;
};
return Safebrowsing;
}());
exports.Safebrowsing = Safebrowsing;
var Resource$Encodedfullhashes = /** @class */ (function () {
function Resource$Encodedfullhashes(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Encodedfullhashes.prototype.getRoot = function () {
return this.root;
};
Resource$Encodedfullhashes.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://safebrowsing.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/encodedFullHashes/{encodedRequest}')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['encodedRequest'],
pathParams: ['encodedRequest'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Encodedfullhashes;
}());
exports.Resource$Encodedfullhashes = Resource$Encodedfullhashes;
var Resource$Encodedupdates = /** @class */ (function () {
function Resource$Encodedupdates(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Encodedupdates.prototype.getRoot = function () {
return this.root;
};
Resource$Encodedupdates.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://safebrowsing.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/encodedUpdates/{encodedRequest}')
.replace(/([^:]\/)\/+/g, '$1'),
method: 'GET'
}, options),
params: params,
requiredParams: ['encodedRequest'],
pathParams: ['encodedRequest'],
context: this.getRoot()
};
if (callback) {
apirequest_1.createAPIRequest(parameters, callback);
}
else {
return apirequest_1.createAPIRequest(parameters);
}
};
return Resource$Encodedupdates;
}());
exports.Resource$Encodedupdates = Resource$Encodedupdates;
var Resource$Fullhashes = /** @class */ (function () {
function Resource$Fullhashes(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Fullhashes.prototype.getRoot = function () {
return this.root;
};
Resource$Fullhashes.prototype.find = 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://safebrowsing.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/fullHashes:find').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);
}
};
return Resource$Fullhashes;
}());
exports.Resource$Fullhashes = Resource$Fullhashes;
var Resource$Threathits = /** @class */ (function () {
function Resource$Threathits(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Threathits.prototype.getRoot = function () {
return this.root;
};
Resource$Threathits.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://safebrowsing.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/threatHits').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);
}
};
return Resource$Threathits;
}());
exports.Resource$Threathits = Resource$Threathits;
var Resource$Threatlists = /** @class */ (function () {
function Resource$Threatlists(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Threatlists.prototype.getRoot = function () {
return this.root;
};
Resource$Threatlists.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://safebrowsing.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/threatLists').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$Threatlists;
}());
exports.Resource$Threatlists = Resource$Threatlists;
var Resource$Threatlistupdates = /** @class */ (function () {
function Resource$Threatlistupdates(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Threatlistupdates.prototype.getRoot = function () {
return this.root;
};
Resource$Threatlistupdates.prototype.fetch = 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://safebrowsing.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/threatListUpdates:fetch')
.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);
}
};
return Resource$Threatlistupdates;
}());
exports.Resource$Threatlistupdates = Resource$Threatlistupdates;
var Resource$Threatmatches = /** @class */ (function () {
function Resource$Threatmatches(root) {
this.root = root;
this.getRoot.bind(this);
}
Resource$Threatmatches.prototype.getRoot = function () {
return this.root;
};
Resource$Threatmatches.prototype.find = 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://safebrowsing.googleapis.com/';
var parameters = {
options: Object.assign({
url: (rootUrl + '/v4/threatMatches:find')
.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);
}
};
return Resource$Threatmatches;
}());
exports.Resource$Threatmatches = Resource$Threatmatches;
//# sourceMappingURL=v4.js.map