language
stringclasses 6
values | original_string
stringlengths 25
887k
| text
stringlengths 25
887k
|
---|---|---|
JavaScript | function addMarker(place)
{
// Create new marker
var myLatLng = new google.maps.LatLng(place['latitude'],place['longitude']);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: place['place_name'] +", "+ place['admin_name1'],
label: place['place_name'] +", "+ place['admin_name1'],
});
// Set marker on the map
marker.setMap(map);
// Looking for articles
$.getJSON("/articles", {geo: place['postal_code']}, function(articles) {
// Check if articles list is not empty
if (!$.isEmptyObject(articles))
{
// Start unordered List
var art_feed = "<ul>";
for (var article of articles)
{
art_feed += "<li><a target='_NEW' href='" + article['link']
+ "'>" + article['title'] + "</a></li>";
}
}
// Update articles feed
art_feed += "</ul>";
// Listen for clicks on marker
marker.addListener('click', function() {
showInfo(marker, art_feed);
});
});
// Append markers with new marker
markers.push(marker);
} | function addMarker(place)
{
// Create new marker
var myLatLng = new google.maps.LatLng(place['latitude'],place['longitude']);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: place['place_name'] +", "+ place['admin_name1'],
label: place['place_name'] +", "+ place['admin_name1'],
});
// Set marker on the map
marker.setMap(map);
// Looking for articles
$.getJSON("/articles", {geo: place['postal_code']}, function(articles) {
// Check if articles list is not empty
if (!$.isEmptyObject(articles))
{
// Start unordered List
var art_feed = "<ul>";
for (var article of articles)
{
art_feed += "<li><a target='_NEW' href='" + article['link']
+ "'>" + article['title'] + "</a></li>";
}
}
// Update articles feed
art_feed += "</ul>";
// Listen for clicks on marker
marker.addListener('click', function() {
showInfo(marker, art_feed);
});
});
// Append markers with new marker
markers.push(marker);
} |
JavaScript | function channelHasVideo(videoTitle, channel) {
return channel.videos.some(
(video) => video.title.toLowerCase() === videoTitle.toLowerCase()
);
} | function channelHasVideo(videoTitle, channel) {
return channel.videos.some(
(video) => video.title.toLowerCase() === videoTitle.toLowerCase()
);
} |
JavaScript | function BinaryImageChannel(imageData, threshold) {
threshold = threshold || 100;
this.width = imageData.width;
this.height = imageData.height;
var id = imageData.data;
this.data = new Uint8ClampedArray(this.width * this.height);
for (var i=0, ii=this.data.length; i<ii; i++) {
var j = i << 2;
// if a grayscale values is greater than threshold return 1 otherwise 0
this.data[i] = (0.34 * id[j]
+ 0.5 * id[j + 1]
+ 0.16 * id[j + 2]) > threshold ? 1 : 0;
}
} | function BinaryImageChannel(imageData, threshold) {
threshold = threshold || 100;
this.width = imageData.width;
this.height = imageData.height;
var id = imageData.data;
this.data = new Uint8ClampedArray(this.width * this.height);
for (var i=0, ii=this.data.length; i<ii; i++) {
var j = i << 2;
// if a grayscale values is greater than threshold return 1 otherwise 0
this.data[i] = (0.34 * id[j]
+ 0.5 * id[j + 1]
+ 0.16 * id[j + 2]) > threshold ? 1 : 0;
}
} |
JavaScript | function quit(client) {
return new Promise((resolve, reject) => {
client.quit((err, reply) => err ? reject(err) : resolve(reply));
});
} | function quit(client) {
return new Promise((resolve, reject) => {
client.quit((err, reply) => err ? reject(err) : resolve(reply));
});
} |
JavaScript | on(event, listener) {
// debug('Adding listener for %s', event);
return pify((resolve) => {
this.sub.subscribe(`${this.prefix}${event}`, () => {
this.event.addListener(event, listener);
resolve();
});
});
} | on(event, listener) {
// debug('Adding listener for %s', event);
return pify((resolve) => {
this.sub.subscribe(`${this.prefix}${event}`, () => {
this.event.addListener(event, listener);
resolve();
});
});
} |
JavaScript | off(event) {
return pify((done) => {
this.sub.unsubscribe(`${this.prefix}${event}`, () => {
this.event.removeAllListeners(event);
done();
});
});
} | off(event) {
return pify((done) => {
this.sub.unsubscribe(`${this.prefix}${event}`, () => {
this.event.removeAllListeners(event);
done();
});
});
} |
JavaScript | emit(event, ...args) {
return pify((done) => {
this.pub.publish(`${this.prefix}${event}`, this.encode(args), done);
});
} | emit(event, ...args) {
return pify((done) => {
this.pub.publish(`${this.prefix}${event}`, this.encode(args), done);
});
} |
JavaScript | static sendRegister(firstName, lastName, password, email, admin) {
return axiosInstance().post('register', {
first_name: firstName,
last_name: lastName,
password,
email,
admin,
});
} | static sendRegister(firstName, lastName, password, email, admin) {
return axiosInstance().post('register', {
first_name: firstName,
last_name: lastName,
password,
email,
admin,
});
} |
JavaScript | static sendCreateUser(firstName, lastName, password, email, admin) {
return axiosInstance().post(
'create-user',
{
first_name: firstName,
last_name: lastName,
password,
email,
admin,
},
{
headers: authHeader(),
}
);
} | static sendCreateUser(firstName, lastName, password, email, admin) {
return axiosInstance().post(
'create-user',
{
first_name: firstName,
last_name: lastName,
password,
email,
admin,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendLogin(email, password) {
return axiosInstance().post('login', {
email,
password,
});
} | static sendLogin(email, password) {
return axiosInstance().post('login', {
email,
password,
});
} |
JavaScript | static sendChangePassword(oldPassword, newPassword) {
return axiosInstance().post(
'change-password',
{
old_password: oldPassword,
new_password: newPassword,
},
{
headers: authHeader(),
}
);
} | static sendChangePassword(oldPassword, newPassword) {
return axiosInstance().post(
'change-password',
{
old_password: oldPassword,
new_password: newPassword,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendRefreshToken() {
return axiosInstance().post(
'refresh-token',
{},
{
headers: authHeader(true),
}
);
} | static sendRefreshToken() {
return axiosInstance().post(
'refresh-token',
{},
{
headers: authHeader(true),
}
);
} |
JavaScript | static sendAuthorizeUser(projectID, email) {
return axiosInstance().post(
'authorize-user',
{
project_id: projectID,
email,
},
{
headers: authHeader(),
}
);
} | static sendAuthorizeUser(projectID, email) {
return axiosInstance().post(
'authorize-user',
{
project_id: projectID,
email,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendDeauthorizeUser(projectID, email) {
return axiosInstance().post(
'deauthorize-user',
{
project_id: projectID,
email,
},
{
headers: authHeader(),
}
);
} | static sendDeauthorizeUser(projectID, email) {
return axiosInstance().post(
'deauthorize-user',
{
project_id: projectID,
email,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendCreateProject(projectName, projectType) {
return axiosInstance().post(
'create-project',
{
project_name: projectName,
project_type: projectType,
},
{ headers: authHeader() }
);
} | static sendCreateProject(projectName, projectType) {
return axiosInstance().post(
'create-project',
{
project_name: projectName,
project_type: projectType,
},
{ headers: authHeader() }
);
} |
JavaScript | static sendDeleteProject(projectID) {
return axiosInstance().delete('delete-project', {
headers: authHeader(),
data: { project_id: projectID },
});
} | static sendDeleteProject(projectID) {
return axiosInstance().delete('delete-project', {
headers: authHeader(),
data: { project_id: projectID },
});
} |
JavaScript | static sendDeleteUser(email) {
return axiosInstance().delete('delete-user', {
headers: authHeader(),
data: { email },
});
} | static sendDeleteUser(email) {
return axiosInstance().delete('delete-user', {
headers: authHeader(),
data: { email },
});
} |
JavaScript | static sendGetUserName() {
return axiosInstance().get('get-user-name', {
headers: authHeader(),
});
} | static sendGetUserName() {
return axiosInstance().get('get-user-name', {
headers: authHeader(),
});
} |
JavaScript | static sendGetUsers() {
return axiosInstance().get('get-users', {
headers: authHeader(),
});
} | static sendGetUsers() {
return axiosInstance().get('get-users', {
headers: authHeader(),
});
} |
JavaScript | static sendAddNewImageData(projectID, JSONFile, imageFiles) {
const formData = new FormData();
formData.append('project_id', projectID);
formData.append('json_file', JSONFile);
[...imageFiles].forEach((img) => formData.append('images', img));
return axiosInstance().post('add-image-data', formData, {
headers: { 'Content-type': 'multipart/form-data', ...authHeader() },
});
} | static sendAddNewImageData(projectID, JSONFile, imageFiles) {
const formData = new FormData();
formData.append('project_id', projectID);
formData.append('json_file', JSONFile);
[...imageFiles].forEach((img) => formData.append('images', img));
return axiosInstance().post('add-image-data', formData, {
headers: { 'Content-type': 'multipart/form-data', ...authHeader() },
});
} |
JavaScript | static sendGetData(projectID, amount = 1) {
return axiosInstance().get('get-data', {
headers: authHeader(),
params: { project_id: projectID, amount },
});
} | static sendGetData(projectID, amount = 1) {
return axiosInstance().get('get-data', {
headers: authHeader(),
params: { project_id: projectID, amount },
});
} |
JavaScript | static sendCreateDocumentClassificationLabel(dataID, label) {
return axiosInstance().post(
'label-document',
{
data_id: dataID,
label,
},
{
headers: authHeader(),
}
);
} | static sendCreateDocumentClassificationLabel(dataID, label) {
return axiosInstance().post(
'label-document',
{
data_id: dataID,
label,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendCreateSequenceLabel(dataID, label, begin, end) {
return axiosInstance().post(
'label-sequence',
{
data_id: dataID,
label,
begin,
end,
},
{
headers: authHeader(),
}
);
} | static sendCreateSequenceLabel(dataID, label, begin, end) {
return axiosInstance().post(
'label-sequence',
{
data_id: dataID,
label,
begin,
end,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendCreateSequenceToSequenceLabel(dataID, label) {
return axiosInstance().post(
'label-sequence-to-sequence',
{
data_id: dataID,
label,
},
{
headers: authHeader(),
}
);
} | static sendCreateSequenceToSequenceLabel(dataID, label) {
return axiosInstance().post(
'label-sequence-to-sequence',
{
data_id: dataID,
label,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendCreateImageClassificationLabel(dataID, label, x1, y1, x2, y2) {
return axiosInstance().post(
'label-image',
{
data_id: dataID,
label,
x1,
y1,
x2,
y2,
},
{
headers: authHeader(),
}
);
} | static sendCreateImageClassificationLabel(dataID, label, x1, y1, x2, y2) {
return axiosInstance().post(
'label-image',
{
data_id: dataID,
label,
x1,
y1,
x2,
y2,
},
{
headers: authHeader(),
}
);
} |
JavaScript | static sendRemoveLabel(labelID) {
return axiosInstance().delete('remove-label', {
headers: authHeader(),
data: { label_id: labelID },
});
} | static sendRemoveLabel(labelID) {
return axiosInstance().delete('remove-label', {
headers: authHeader(),
data: { label_id: labelID },
});
} |
JavaScript | static sendGetImageData(dataID) {
return axiosInstance().get('get-image-data', {
headers: authHeader(),
params: { data_id: dataID },
});
} | static sendGetImageData(dataID) {
return axiosInstance().get('get-image-data', {
headers: authHeader(),
params: { data_id: dataID },
});
} |
JavaScript | async function handleLoginWithWebauthn(email) {
try {
let didToken = await magic.webauthn.login({ username: email });
await authenticateWithServer(didToken);
} catch (error) {
try {
let didToken = await magic.webauthn.registerNewUser({ username: email });
await authenticateWithServer(didToken);
} catch (err) {
alert(
'Failed to authenticate. Must be using a supported device and a username not already taken.'
);
console.log(err);
}
}
} | async function handleLoginWithWebauthn(email) {
try {
let didToken = await magic.webauthn.login({ username: email });
await authenticateWithServer(didToken);
} catch (error) {
try {
let didToken = await magic.webauthn.registerNewUser({ username: email });
await authenticateWithServer(didToken);
} catch (err) {
alert(
'Failed to authenticate. Must be using a supported device and a username not already taken.'
);
console.log(err);
}
}
} |
JavaScript | function Runtimeconfig(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.projects = {
configs: {
/**
* runtimeconfig.projects.configs.update
*
* @desc Updates the config resource object. RuntimeConfig object must already exist.
*
* @alias runtimeconfig.projects.configs.update
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the config resource to update. Required. Must be a valid config resource.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.get
*
* @desc Gets the config resource object.
*
* @alias runtimeconfig.projects.configs.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the RuntimeConfig resource object to retrieve.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.create
*
* @desc CreateConfig creates a new config resource object. The configuration name must be unique within project.
*
* @alias runtimeconfig.projects.configs.create
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.parent The cloud project to which configuration belongs. Required. Must be a valid GCP project.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/configs',
method: 'POST'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.list
*
* @desc Lists all the config objects within project.
*
* @alias runtimeconfig.projects.configs.list
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.pageSize List pagination support. The size of the page to return. We may return fewer elements.
* @param {string} params.parent The cloud project, whose configuration resources we want to list. Required. Must be a valid GCP project.
* @param {string=} params.pageToken The token for pagination.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/configs',
method: 'GET'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.delete
*
* @desc Deletes the config object.
*
* @alias runtimeconfig.projects.configs.delete
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The configuration resource object to delete. Required. Must be a valid GCP project.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
variables: {
/**
* runtimeconfig.projects.configs.variables.watch
*
* @desc WatchVariable watches for a variable to change and then returns the new value or times out. If variable is deleted while being watched, VariableState will be DELETED and the Value will contain the last known value. If the operation deadline is set to a larger value than internal timeout existing, current variable value will be returned and Variable state will be VARIABLE_STATE_UNSPECIFIED.
*
* @alias runtimeconfig.projects.configs.variables.watch
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the variable to retrieve.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
watch: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}:watch',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.list
*
* @desc Lists variables within given RuntimeConfig object, matching optionally provided filter. List contains only variable metadata, but not values.
*
* @alias runtimeconfig.projects.configs.variables.list
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.pageSize List pagination support. The size of the page to return. We may return fewer elements.
* @param {string=} params.filter List only variables matching filter prefix exactly. e.g. `projects/{project_id}/config/{config_id}/variables/{variable/id}`.
* @param {string} params.parent Which RuntimeConfig object to list for variables.
* @param {string=} params.pageToken The token for pagination.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/variables',
method: 'GET'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.get
*
* @desc Gets the variable resource object.
*
* @alias runtimeconfig.projects.configs.variables.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name What variable to return.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.create
*
* @desc Creates a variable within the given configuration. Create variable will create all required intermediate path elements. It is a FAILED_PRECONDITION error to create a variable with a name that is a prefix of an existing variable name, or that has an existing variable name as a prefix.
*
* @alias runtimeconfig.projects.configs.variables.create
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.parent The configuration parent, that will own the variable. Required, must a valid configuration name within project_id.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/variables',
method: 'POST'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.update
*
* @desc Updates an existing variable with a new value.
*
* @alias runtimeconfig.projects.configs.variables.update
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the variable to update. In the format of: "projects/{project_id}/configs/{config_id}/variables/{variable_id}"
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.delete
*
* @desc Deletes variable or variables. If name denotes a variable, that variable is deleted. If name is a prefix and recursive is true, then all variables with that prefix are deleted, it's a FAILED_PRECONDITION to delete a prefix without recursive being true.
*
* @alias runtimeconfig.projects.configs.variables.delete
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {boolean=} params.recursive If recursive is false and name is a prefix of other variables, then the request will fail.
* @param {string} params.name The name of the variable to delete.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
waiters: {
/**
* runtimeconfig.projects.configs.waiters.get
*
* @desc Gets the Waiter resource with the specified name.
*
* @alias runtimeconfig.projects.configs.waiters.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The fully-qualified name of the Waiter resource object to retrieve.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.waiters.create
*
* @desc Creates a Waiter resource. This operation returns a long-running Operation resource which can be polled for completion. However, a Waiter with the given name will exist (and can be retrieved) prior to the resultant Operation completing. If the resultant Operation indicates a failure, the failed Waiter resource will still exist and must be deleted prior to subsequent creation attempts.
*
* @alias runtimeconfig.projects.configs.waiters.create
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.parent The fully-qualified name of the configuration that will own the waiter. Required. Must be a valid configuration name.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/waiters',
method: 'POST'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.waiters.list
*
* @desc List Waiters within the given RuntimeConfig resource.
*
* @alias runtimeconfig.projects.configs.waiters.list
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.pageSize List pagination support. The size of the page to return. We may return fewer elements.
* @param {string} params.parent The fully-qualified name of the configuration to list. Required. Must be a valid configuration name.
* @param {string=} params.pageToken The token for pagination.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/waiters',
method: 'GET'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.waiters.delete
*
* @desc Deletes the Waiter with the specified name.
*
* @alias runtimeconfig.projects.configs.waiters.delete
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The Waiter resource to delete.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
operations: {
/**
* runtimeconfig.projects.configs.operations.get
*
* @desc Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
*
* @alias runtimeconfig.projects.configs.operations.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the operation resource.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
}
};
} | function Runtimeconfig(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.projects = {
configs: {
/**
* runtimeconfig.projects.configs.update
*
* @desc Updates the config resource object. RuntimeConfig object must already exist.
*
* @alias runtimeconfig.projects.configs.update
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the config resource to update. Required. Must be a valid config resource.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.get
*
* @desc Gets the config resource object.
*
* @alias runtimeconfig.projects.configs.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the RuntimeConfig resource object to retrieve.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.create
*
* @desc CreateConfig creates a new config resource object. The configuration name must be unique within project.
*
* @alias runtimeconfig.projects.configs.create
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.parent The cloud project to which configuration belongs. Required. Must be a valid GCP project.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/configs',
method: 'POST'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.list
*
* @desc Lists all the config objects within project.
*
* @alias runtimeconfig.projects.configs.list
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.pageSize List pagination support. The size of the page to return. We may return fewer elements.
* @param {string} params.parent The cloud project, whose configuration resources we want to list. Required. Must be a valid GCP project.
* @param {string=} params.pageToken The token for pagination.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/configs',
method: 'GET'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.delete
*
* @desc Deletes the config object.
*
* @alias runtimeconfig.projects.configs.delete
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The configuration resource object to delete. Required. Must be a valid GCP project.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
variables: {
/**
* runtimeconfig.projects.configs.variables.watch
*
* @desc WatchVariable watches for a variable to change and then returns the new value or times out. If variable is deleted while being watched, VariableState will be DELETED and the Value will contain the last known value. If the operation deadline is set to a larger value than internal timeout existing, current variable value will be returned and Variable state will be VARIABLE_STATE_UNSPECIFIED.
*
* @alias runtimeconfig.projects.configs.variables.watch
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the variable to retrieve.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
watch: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}:watch',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.list
*
* @desc Lists variables within given RuntimeConfig object, matching optionally provided filter. List contains only variable metadata, but not values.
*
* @alias runtimeconfig.projects.configs.variables.list
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.pageSize List pagination support. The size of the page to return. We may return fewer elements.
* @param {string=} params.filter List only variables matching filter prefix exactly. e.g. `projects/{project_id}/config/{config_id}/variables/{variable/id}`.
* @param {string} params.parent Which RuntimeConfig object to list for variables.
* @param {string=} params.pageToken The token for pagination.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/variables',
method: 'GET'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.get
*
* @desc Gets the variable resource object.
*
* @alias runtimeconfig.projects.configs.variables.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name What variable to return.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.create
*
* @desc Creates a variable within the given configuration. Create variable will create all required intermediate path elements. It is a FAILED_PRECONDITION error to create a variable with a name that is a prefix of an existing variable name, or that has an existing variable name as a prefix.
*
* @alias runtimeconfig.projects.configs.variables.create
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.parent The configuration parent, that will own the variable. Required, must a valid configuration name within project_id.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/variables',
method: 'POST'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.update
*
* @desc Updates an existing variable with a new value.
*
* @alias runtimeconfig.projects.configs.variables.update
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the variable to update. In the format of: "projects/{project_id}/configs/{config_id}/variables/{variable_id}"
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.variables.delete
*
* @desc Deletes variable or variables. If name denotes a variable, that variable is deleted. If name is a prefix and recursive is true, then all variables with that prefix are deleted, it's a FAILED_PRECONDITION to delete a prefix without recursive being true.
*
* @alias runtimeconfig.projects.configs.variables.delete
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {boolean=} params.recursive If recursive is false and name is a prefix of other variables, then the request will fail.
* @param {string} params.name The name of the variable to delete.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
waiters: {
/**
* runtimeconfig.projects.configs.waiters.get
*
* @desc Gets the Waiter resource with the specified name.
*
* @alias runtimeconfig.projects.configs.waiters.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The fully-qualified name of the Waiter resource object to retrieve.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.waiters.create
*
* @desc Creates a Waiter resource. This operation returns a long-running Operation resource which can be polled for completion. However, a Waiter with the given name will exist (and can be retrieved) prior to the resultant Operation completing. If the resultant Operation indicates a failure, the failed Waiter resource will still exist and must be deleted prior to subsequent creation attempts.
*
* @alias runtimeconfig.projects.configs.waiters.create
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.parent The fully-qualified name of the configuration that will own the waiter. Required. Must be a valid configuration name.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/waiters',
method: 'POST'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.waiters.list
*
* @desc List Waiters within the given RuntimeConfig resource.
*
* @alias runtimeconfig.projects.configs.waiters.list
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.pageSize List pagination support. The size of the page to return. We may return fewer elements.
* @param {string} params.parent The fully-qualified name of the configuration to list. Required. Must be a valid configuration name.
* @param {string=} params.pageToken The token for pagination.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{parent}/waiters',
method: 'GET'
},
params: params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* runtimeconfig.projects.configs.waiters.delete
*
* @desc Deletes the Waiter with the specified name.
*
* @alias runtimeconfig.projects.configs.waiters.delete
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The Waiter resource to delete.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
operations: {
/**
* runtimeconfig.projects.configs.operations.get
*
* @desc Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
*
* @alias runtimeconfig.projects.configs.operations.get
* @memberOf! runtimeconfig(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the operation resource.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://runtimeconfig.googleapis.com/v1beta1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
}
};
} |
JavaScript | function Iam(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.projects = {
serviceAccounts: {
/**
* iam.projects.serviceAccounts.list
*
* @desc Lists service accounts for a project.
*
* @alias iam.projects.serviceAccounts.list
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name Required. The resource name of the project associated with the service accounts, such as "projects/123"
* @param {integer=} params.pageSize Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the [ListServiceAccountsResponse.next_page_token] in a subsequent request.
* @param {string=} params.pageToken Optional pagination token returned in an earlier [ListServiceAccountsResponse.next_page_token].
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/serviceAccounts',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.get
*
* @desc Gets a ServiceAccount
*
* @alias iam.projects.serviceAccounts.get
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.create
*
* @desc Creates a service account and returns it.
*
* @alias iam.projects.serviceAccounts.create
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name Required. The resource name of the project associated with the service accounts, such as "projects/123"
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/serviceAccounts',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.update
*
* @desc Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory.
*
* @alias iam.projects.serviceAccounts.update
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}".
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.delete
*
* @desc Deletes a service acount.
*
* @alias iam.projects.serviceAccounts.delete
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.signBlob
*
* @desc Signs a blob using a service account.
*
* @alias iam.projects.serviceAccounts.signBlob
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
signBlob: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}:signBlob',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.getIamPolicy
*
* @desc Returns the IAM access control policy for specified IAM resource.
*
* @alias iam.projects.serviceAccounts.getIamPolicy
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.resource_ REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/xprojectx/zones/xzonex/disks/xdisk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getIamPolicy: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{resource}:getIamPolicy',
method: 'POST'
},
params: params,
requiredParams: ['resource'],
pathParams: ['resource'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.setIamPolicy
*
* @desc Sets the IAM access control policy for the specified IAM resource.
*
* @alias iam.projects.serviceAccounts.setIamPolicy
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.resource_ REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/xprojectx/zones/xzonex/disks/xdisk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
setIamPolicy: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{resource}:setIamPolicy',
method: 'POST'
},
params: params,
requiredParams: ['resource'],
pathParams: ['resource'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.testIamPermissions
*
* @desc Tests the specified permissions against the IAM access control policy for the specified IAM resource.
*
* @alias iam.projects.serviceAccounts.testIamPermissions
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.resource_ REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/xprojectx/zones/xzonex/disks/xdisk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
testIamPermissions: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{resource}:testIamPermissions',
method: 'POST'
},
params: params,
requiredParams: ['resource'],
pathParams: ['resource'],
context: self
};
return createAPIRequest(parameters, callback);
},
keys: {
/**
* iam.projects.serviceAccounts.keys.list
*
* @desc Lists service account keys
*
* @alias iam.projects.serviceAccounts.keys.list
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {string=} params.keyTypes The type of keys the user wants to list. If empty, all key types are included in the response. Duplicate key types are not allowed.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/keys',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.keys.get
*
* @desc Gets the ServiceAccountKey by key id.
*
* @alias iam.projects.serviceAccounts.keys.get
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.keys.create
*
* @desc Creates a service account key and returns it.
*
* @alias iam.projects.serviceAccounts.keys.create
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/keys',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.keys.delete
*
* @desc Deletes a service account key.
*
* @alias iam.projects.serviceAccounts.keys.delete
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
}
};
} | function Iam(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.projects = {
serviceAccounts: {
/**
* iam.projects.serviceAccounts.list
*
* @desc Lists service accounts for a project.
*
* @alias iam.projects.serviceAccounts.list
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name Required. The resource name of the project associated with the service accounts, such as "projects/123"
* @param {integer=} params.pageSize Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the [ListServiceAccountsResponse.next_page_token] in a subsequent request.
* @param {string=} params.pageToken Optional pagination token returned in an earlier [ListServiceAccountsResponse.next_page_token].
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/serviceAccounts',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.get
*
* @desc Gets a ServiceAccount
*
* @alias iam.projects.serviceAccounts.get
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.create
*
* @desc Creates a service account and returns it.
*
* @alias iam.projects.serviceAccounts.create
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name Required. The resource name of the project associated with the service accounts, such as "projects/123"
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/serviceAccounts',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.update
*
* @desc Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory.
*
* @alias iam.projects.serviceAccounts.update
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}".
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.delete
*
* @desc Deletes a service acount.
*
* @alias iam.projects.serviceAccounts.delete
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.signBlob
*
* @desc Signs a blob using a service account.
*
* @alias iam.projects.serviceAccounts.signBlob
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
signBlob: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}:signBlob',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.getIamPolicy
*
* @desc Returns the IAM access control policy for specified IAM resource.
*
* @alias iam.projects.serviceAccounts.getIamPolicy
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.resource_ REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/xprojectx/zones/xzonex/disks/xdisk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
getIamPolicy: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{resource}:getIamPolicy',
method: 'POST'
},
params: params,
requiredParams: ['resource'],
pathParams: ['resource'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.setIamPolicy
*
* @desc Sets the IAM access control policy for the specified IAM resource.
*
* @alias iam.projects.serviceAccounts.setIamPolicy
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.resource_ REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/xprojectx/zones/xzonex/disks/xdisk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
setIamPolicy: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{resource}:setIamPolicy',
method: 'POST'
},
params: params,
requiredParams: ['resource'],
pathParams: ['resource'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.testIamPermissions
*
* @desc Tests the specified permissions against the IAM access control policy for the specified IAM resource.
*
* @alias iam.projects.serviceAccounts.testIamPermissions
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.resource_ REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/xprojectx/zones/xzonex/disks/xdisk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
testIamPermissions: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{resource}:testIamPermissions',
method: 'POST'
},
params: params,
requiredParams: ['resource'],
pathParams: ['resource'],
context: self
};
return createAPIRequest(parameters, callback);
},
keys: {
/**
* iam.projects.serviceAccounts.keys.list
*
* @desc Lists service account keys
*
* @alias iam.projects.serviceAccounts.keys.list
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {string=} params.keyTypes The type of keys the user wants to list. If empty, all key types are included in the response. Duplicate key types are not allowed.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/keys',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.keys.get
*
* @desc Gets the ServiceAccountKey by key id.
*
* @alias iam.projects.serviceAccounts.keys.get
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'GET'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.keys.create
*
* @desc Creates a service account key and returns it.
*
* @alias iam.projects.serviceAccounts.keys.create
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
create: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}/keys',
method: 'POST'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* iam.projects.serviceAccounts.keys.delete
*
* @desc Deletes a service account key.
*
* @alias iam.projects.serviceAccounts.keys.delete
* @memberOf! iam(v1)
*
* @param {object} params Parameters for request
* @param {string} params.name The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://iam.googleapis.com/v1/{name}',
method: 'DELETE'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
}
};
} |
JavaScript | function first(list, condition) {
for (var i = 0, len = list && list.length || 0; i < len; i++) {
if (condition(list[i])) {
return list[i];
}
}
return null;
} | function first(list, condition) {
for (var i = 0, len = list && list.length || 0; i < len; i++) {
if (condition(list[i])) {
return list[i];
}
}
return null;
} |
JavaScript | function isErrorMessage(message) {
var level = message.fatal ? 2 : message.severity;
if (Array.isArray(level)) {
level = level[0];
}
return (level > 1);
} | function isErrorMessage(message) {
var level = message.fatal ? 2 : message.severity;
if (Array.isArray(level)) {
level = level[0];
}
return (level > 1);
} |
JavaScript | function Consumersurveys(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.results = {
/**
* consumersurveys.results.get
*
* @desc Retrieves any survey results that have been produced so far. Results are formatted as an Excel file.
*
* @alias consumersurveys.results.get
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{surveyUrlId}/results',
method: 'GET'
},
params: params,
requiredParams: ['surveyUrlId'],
pathParams: ['surveyUrlId'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.surveys = {
/**
* consumersurveys.surveys.get
*
* @desc Retrieves information about the specified survey.
*
* @alias consumersurveys.surveys.get
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{surveyUrlId}',
method: 'GET'
},
params: params,
requiredParams: ['surveyUrlId'],
pathParams: ['surveyUrlId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.insert
*
* @desc Creates a survey.
*
* @alias consumersurveys.surveys.insert
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys',
method: 'POST'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.list
*
* @desc Lists the surveys owned by the authenticated user.
*
* @alias consumersurveys.surveys.list
* @memberOf! consumersurveys(v2)
*
* @param {object=} params Parameters for request
* @param {integer=} params.maxResults
* @param {integer=} params.startIndex
* @param {string=} params.token
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.start
*
* @desc Begins running a survey.
*
* @alias consumersurveys.surveys.start
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.resourceId
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
start: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{resourceId}/start',
method: 'POST'
},
params: params,
requiredParams: ['resourceId'],
pathParams: ['resourceId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.stop
*
* @desc Stops a running survey.
*
* @alias consumersurveys.surveys.stop
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.resourceId
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
stop: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{resourceId}/stop',
method: 'POST'
},
params: params,
requiredParams: ['resourceId'],
pathParams: ['resourceId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.update
*
* @desc Updates a survey. Currently the only property that can be updated is the owners property.
*
* @alias consumersurveys.surveys.update
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{surveyUrlId}',
method: 'PUT'
},
params: params,
requiredParams: ['surveyUrlId'],
pathParams: ['surveyUrlId'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} | function Consumersurveys(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.results = {
/**
* consumersurveys.results.get
*
* @desc Retrieves any survey results that have been produced so far. Results are formatted as an Excel file.
*
* @alias consumersurveys.results.get
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{surveyUrlId}/results',
method: 'GET'
},
params: params,
requiredParams: ['surveyUrlId'],
pathParams: ['surveyUrlId'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.surveys = {
/**
* consumersurveys.surveys.get
*
* @desc Retrieves information about the specified survey.
*
* @alias consumersurveys.surveys.get
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{surveyUrlId}',
method: 'GET'
},
params: params,
requiredParams: ['surveyUrlId'],
pathParams: ['surveyUrlId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.insert
*
* @desc Creates a survey.
*
* @alias consumersurveys.surveys.insert
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys',
method: 'POST'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.list
*
* @desc Lists the surveys owned by the authenticated user.
*
* @alias consumersurveys.surveys.list
* @memberOf! consumersurveys(v2)
*
* @param {object=} params Parameters for request
* @param {integer=} params.maxResults
* @param {integer=} params.startIndex
* @param {string=} params.token
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.start
*
* @desc Begins running a survey.
*
* @alias consumersurveys.surveys.start
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.resourceId
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
start: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{resourceId}/start',
method: 'POST'
},
params: params,
requiredParams: ['resourceId'],
pathParams: ['resourceId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.stop
*
* @desc Stops a running survey.
*
* @alias consumersurveys.surveys.stop
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.resourceId
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
stop: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{resourceId}/stop',
method: 'POST'
},
params: params,
requiredParams: ['resourceId'],
pathParams: ['resourceId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* consumersurveys.surveys.update
*
* @desc Updates a survey. Currently the only property that can be updated is the owners property.
*
* @alias consumersurveys.surveys.update
* @memberOf! consumersurveys(v2)
*
* @param {object} params Parameters for request
* @param {string} params.surveyUrlId External URL ID for the survey.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/consumersurveys/v2/surveys/{surveyUrlId}',
method: 'PUT'
},
params: params,
requiredParams: ['surveyUrlId'],
pathParams: ['surveyUrlId'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} |
JavaScript | function Prediction(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.hostedmodels = {
/**
* prediction.hostedmodels.predict
*
* @desc Submit input and request an output against a hosted model
*
* @alias prediction.hostedmodels.predict
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.hostedModelName The name of a hosted model
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
predict: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/hostedmodels/{hostedModelName}/predict',
method: 'POST'
},
params: params,
requiredParams: ['hostedModelName'],
pathParams: ['hostedModelName'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.training = {
/**
* prediction.training.delete
*
* @desc Delete a trained model
*
* @alias prediction.training.delete
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}',
method: 'DELETE'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.get
*
* @desc Check training status of your model
*
* @alias prediction.training.get
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}',
method: 'GET'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.insert
*
* @desc Begin training your model
*
* @alias prediction.training.insert
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training',
method: 'POST'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.predict
*
* @desc Submit data and request a prediction
*
* @alias prediction.training.predict
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
predict: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}/predict',
method: 'POST'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.update
*
* @desc Add new data to a trained model
*
* @alias prediction.training.update
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}',
method: 'PUT'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} | function Prediction(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.hostedmodels = {
/**
* prediction.hostedmodels.predict
*
* @desc Submit input and request an output against a hosted model
*
* @alias prediction.hostedmodels.predict
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.hostedModelName The name of a hosted model
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
predict: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/hostedmodels/{hostedModelName}/predict',
method: 'POST'
},
params: params,
requiredParams: ['hostedModelName'],
pathParams: ['hostedModelName'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.training = {
/**
* prediction.training.delete
*
* @desc Delete a trained model
*
* @alias prediction.training.delete
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}',
method: 'DELETE'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.get
*
* @desc Check training status of your model
*
* @alias prediction.training.get
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}',
method: 'GET'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.insert
*
* @desc Begin training your model
*
* @alias prediction.training.insert
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training',
method: 'POST'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.predict
*
* @desc Submit data and request a prediction
*
* @alias prediction.training.predict
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
predict: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}/predict',
method: 'POST'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* prediction.training.update
*
* @desc Add new data to a trained model
*
* @alias prediction.training.update
* @memberOf! prediction(v1.3)
*
* @param {object} params Parameters for request
* @param {string} params.data mybucket/mydata resource in Google Storage
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/prediction/v1.3/training/{data}',
method: 'PUT'
},
params: params,
requiredParams: ['data'],
pathParams: ['data'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} |
JavaScript | function Replicapool(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.pools = {
/**
* replicapool.pools.delete
*
* @desc Deletes a replica pool.
*
* @alias replicapool.pools.delete
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.get
*
* @desc Gets information about a single replica pool.
*
* @alias replicapool.pools.get
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.insert
*
* @desc Inserts a new replica pool.
*
* @alias replicapool.pools.insert
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone'],
pathParams: ['projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.list
*
* @desc List all replica pools.
*
* @alias replicapool.pools.list
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.maxResults Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)
* @param {string=} params.pageToken Set this to the nextPageToken value returned by a previous list request to obtain the next page of results from the previous list request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.zone The zone for this replica pool.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone'],
pathParams: ['projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.resize
*
* @desc Resize a pool. This is an asynchronous operation, and multiple overlapping resize requests can be made. Replica Pools will use the information from the last resize request.
*
* @alias replicapool.pools.resize
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.numReplicas The desired number of replicas to resize to. If this number is larger than the existing number of replicas, new replicas will be added. If the number is smaller, then existing replicas will be deleted.
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
resize: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/resize',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.updatetemplate
*
* @desc Update the template used by the pool.
*
* @alias replicapool.pools.updatetemplate
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
updatetemplate: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/updateTemplate',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.replicas = {
/**
* replicapool.replicas.delete
*
* @desc Deletes a replica from the pool.
*
* @alias replicapool.replicas.delete
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.replicaName The name of the replica for this request.
* @param {string} params.zone The zone where the replica lives.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName', 'replicaName'],
pathParams: ['poolName', 'projectName', 'replicaName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.replicas.get
*
* @desc Gets information about a specific replica.
*
* @alias replicapool.replicas.get
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.replicaName The name of the replica for this request.
* @param {string} params.zone The zone where the replica lives.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName', 'replicaName'],
pathParams: ['poolName', 'projectName', 'replicaName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.replicas.list
*
* @desc Lists all replicas in a pool.
*
* @alias replicapool.replicas.list
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.maxResults Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)
* @param {string=} params.pageToken Set this to the nextPageToken value returned by a previous list request to obtain the next page of results from the previous list request.
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.zone The zone where the replica pool lives.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.replicas.restart
*
* @desc Restarts a replica in a pool.
*
* @alias replicapool.replicas.restart
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.replicaName The name of the replica for this request.
* @param {string} params.zone The zone where the replica lives.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
restart: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}/restart',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName', 'replicaName'],
pathParams: ['poolName', 'projectName', 'replicaName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} | function Replicapool(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.pools = {
/**
* replicapool.pools.delete
*
* @desc Deletes a replica pool.
*
* @alias replicapool.pools.delete
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.get
*
* @desc Gets information about a single replica pool.
*
* @alias replicapool.pools.get
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.insert
*
* @desc Inserts a new replica pool.
*
* @alias replicapool.pools.insert
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone'],
pathParams: ['projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.list
*
* @desc List all replica pools.
*
* @alias replicapool.pools.list
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.maxResults Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)
* @param {string=} params.pageToken Set this to the nextPageToken value returned by a previous list request to obtain the next page of results from the previous list request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.zone The zone for this replica pool.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone'],
pathParams: ['projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.resize
*
* @desc Resize a pool. This is an asynchronous operation, and multiple overlapping resize requests can be made. Replica Pools will use the information from the last resize request.
*
* @alias replicapool.pools.resize
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.numReplicas The desired number of replicas to resize to. If this number is larger than the existing number of replicas, new replicas will be added. If the number is smaller, then existing replicas will be deleted.
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
resize: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/resize',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.pools.updatetemplate
*
* @desc Update the template used by the pool.
*
* @alias replicapool.pools.updatetemplate
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The name of the replica pool for this request.
* @param {string} params.projectName The project ID for this replica pool.
* @param {string} params.zone The zone for this replica pool.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
updatetemplate: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/updateTemplate',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.replicas = {
/**
* replicapool.replicas.delete
*
* @desc Deletes a replica from the pool.
*
* @alias replicapool.replicas.delete
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.replicaName The name of the replica for this request.
* @param {string} params.zone The zone where the replica lives.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName', 'replicaName'],
pathParams: ['poolName', 'projectName', 'replicaName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.replicas.get
*
* @desc Gets information about a specific replica.
*
* @alias replicapool.replicas.get
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.replicaName The name of the replica for this request.
* @param {string} params.zone The zone where the replica lives.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName', 'replicaName'],
pathParams: ['poolName', 'projectName', 'replicaName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.replicas.list
*
* @desc Lists all replicas in a pool.
*
* @alias replicapool.replicas.list
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {integer=} params.maxResults Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)
* @param {string=} params.pageToken Set this to the nextPageToken value returned by a previous list request to obtain the next page of results from the previous list request.
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.zone The zone where the replica pool lives.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas',
method: 'GET'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName'],
pathParams: ['poolName', 'projectName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* replicapool.replicas.restart
*
* @desc Restarts a replica in a pool.
*
* @alias replicapool.replicas.restart
* @memberOf! replicapool(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.poolName The replica pool name for this request.
* @param {string} params.projectName The project ID for this request.
* @param {string} params.replicaName The name of the replica for this request.
* @param {string} params.zone The zone where the replica lives.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
restart: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/replicapool/v1beta1/projects/{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}/restart',
method: 'POST'
},
params: params,
requiredParams: ['projectName', 'zone', 'poolName', 'replicaName'],
pathParams: ['poolName', 'projectName', 'replicaName', 'zone'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} |
JavaScript | function Clouderrorreporting(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.projects = {
/**
* clouderrorreporting.projects.deleteEvents
*
* @desc Deletes all error events of a given project.
*
* @alias clouderrorreporting.projects.deleteEvents
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.projectName The resource name of the Google Cloud Platform project. Required. Example: `projects/my-project`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
deleteEvents: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events',
method: 'DELETE'
},
params: params,
requiredParams: ['projectName'],
pathParams: ['projectName'],
context: self
};
return createAPIRequest(parameters, callback);
},
events: {
/**
* clouderrorreporting.projects.events.list
*
* @desc Lists the specified events.
*
* @alias clouderrorreporting.projects.events.list
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string=} params.timeRange.period Restricts the query to the specified time range.
* @param {string} params.projectName The resource name of the Google Cloud Platform project. Required. Example: projects/my-project
* @param {string=} params.serviceFilter.service The exact value to match against [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
* @param {string=} params.groupId The group for which events shall be returned. Required.
* @param {string=} params.serviceFilter.version The exact value to match against [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
* @param {integer=} params.pageSize The maximum number of results to return per response.
* @param {string=} params.pageToken A `next_page_token` provided by a previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events',
method: 'GET'
},
params: params,
requiredParams: ['projectName'],
pathParams: ['projectName'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
groups: {
/**
* clouderrorreporting.projects.groups.update
*
* @desc Replace the data for the specified group. Fails if the group does not exist.
*
* @alias clouderrorreporting.projects.groups.update
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name Group resource name. Example: `projects/my-project-123/groups/my-groupid`
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* clouderrorreporting.projects.groups.get
*
* @desc Get the specified group.
*
* @alias clouderrorreporting.projects.groups.get
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.groupName Group resource name. Required. Example: `projects/my-project-123/groups/my-group`
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{groupName}',
method: 'GET'
},
params: params,
requiredParams: ['groupName'],
pathParams: ['groupName'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
groupStats: {
/**
* clouderrorreporting.projects.groupStats.list
*
* @desc Lists the specified groups.
*
* @alias clouderrorreporting.projects.groupStats.list
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string=} params.alignment The alignment of the timed counts to be returned. Default is `ALIGNMENT_EQUAL_AT_END`.
* @param {string=} params.timeRange.period Restricts the query to the specified time range.
* @param {string} params.projectName The resource name of the Google Cloud Platform project. Written as `projects/` plus the [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840). Required. Example: `projects/my-project-123`.
* @param {string=} params.order The sort order in which the results are returned. Default is `COUNT_DESC`.
* @param {string=} params.groupId List all `ErrorGroupStats` with these IDs. If not specified, all error group stats with a non-zero error count for the given selection criteria are returned.
* @param {string=} params.serviceFilter.service The exact value to match against [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
* @param {string=} params.alignmentTime Time where the timed counts shall be aligned if rounded alignment is chosen. Default is 00:00 UTC.
* @param {string=} params.serviceFilter.version The exact value to match against [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
* @param {integer=} params.pageSize The maximum number of results to return per response. Default is 20.
* @param {string=} params.timedCountDuration The preferred duration for a single returned `TimedCount`. If not set, no timed counts are returned.
* @param {string=} params.pageToken A `next_page_token` provided by a previous response. To view additional results, pass this token along with the identical query parameters as the first request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/groupStats',
method: 'GET'
},
params: params,
requiredParams: ['projectName'],
pathParams: ['projectName'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
};
} | function Clouderrorreporting(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.projects = {
/**
* clouderrorreporting.projects.deleteEvents
*
* @desc Deletes all error events of a given project.
*
* @alias clouderrorreporting.projects.deleteEvents
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.projectName The resource name of the Google Cloud Platform project. Required. Example: `projects/my-project`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
deleteEvents: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events',
method: 'DELETE'
},
params: params,
requiredParams: ['projectName'],
pathParams: ['projectName'],
context: self
};
return createAPIRequest(parameters, callback);
},
events: {
/**
* clouderrorreporting.projects.events.list
*
* @desc Lists the specified events.
*
* @alias clouderrorreporting.projects.events.list
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string=} params.timeRange.period Restricts the query to the specified time range.
* @param {string} params.projectName The resource name of the Google Cloud Platform project. Required. Example: projects/my-project
* @param {string=} params.serviceFilter.service The exact value to match against [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
* @param {string=} params.groupId The group for which events shall be returned. Required.
* @param {string=} params.serviceFilter.version The exact value to match against [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
* @param {integer=} params.pageSize The maximum number of results to return per response.
* @param {string=} params.pageToken A `next_page_token` provided by a previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events',
method: 'GET'
},
params: params,
requiredParams: ['projectName'],
pathParams: ['projectName'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
groups: {
/**
* clouderrorreporting.projects.groups.update
*
* @desc Replace the data for the specified group. Fails if the group does not exist.
*
* @alias clouderrorreporting.projects.groups.update
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.name Group resource name. Example: `projects/my-project-123/groups/my-groupid`
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{name}',
method: 'PUT'
},
params: params,
requiredParams: ['name'],
pathParams: ['name'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* clouderrorreporting.projects.groups.get
*
* @desc Get the specified group.
*
* @alias clouderrorreporting.projects.groups.get
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.groupName Group resource name. Required. Example: `projects/my-project-123/groups/my-group`
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{groupName}',
method: 'GET'
},
params: params,
requiredParams: ['groupName'],
pathParams: ['groupName'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
groupStats: {
/**
* clouderrorreporting.projects.groupStats.list
*
* @desc Lists the specified groups.
*
* @alias clouderrorreporting.projects.groupStats.list
* @memberOf! clouderrorreporting(v1beta1)
*
* @param {object} params Parameters for request
* @param {string=} params.alignment The alignment of the timed counts to be returned. Default is `ALIGNMENT_EQUAL_AT_END`.
* @param {string=} params.timeRange.period Restricts the query to the specified time range.
* @param {string} params.projectName The resource name of the Google Cloud Platform project. Written as `projects/` plus the [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840). Required. Example: `projects/my-project-123`.
* @param {string=} params.order The sort order in which the results are returned. Default is `COUNT_DESC`.
* @param {string=} params.groupId List all `ErrorGroupStats` with these IDs. If not specified, all error group stats with a non-zero error count for the given selection criteria are returned.
* @param {string=} params.serviceFilter.service The exact value to match against [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
* @param {string=} params.alignmentTime Time where the timed counts shall be aligned if rounded alignment is chosen. Default is 00:00 UTC.
* @param {string=} params.serviceFilter.version The exact value to match against [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
* @param {integer=} params.pageSize The maximum number of results to return per response. Default is 20.
* @param {string=} params.timedCountDuration The preferred duration for a single returned `TimedCount`. If not set, no timed counts are returned.
* @param {string=} params.pageToken A `next_page_token` provided by a previous response. To view additional results, pass this token along with the identical query parameters as the first request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/groupStats',
method: 'GET'
},
params: params,
requiredParams: ['projectName'],
pathParams: ['projectName'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
};
} |
JavaScript | function Adexchangeseller(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.accounts = {
/**
* adexchangeseller.accounts.get
*
* @desc Get information about the selected Ad Exchange account.
*
* @alias adexchangeseller.accounts.get
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to get information about. Tip: 'myaccount' is a valid ID.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.list
*
* @desc List all accounts available to this Ad Exchange account.
*
* @alias adexchangeseller.accounts.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object=} params Parameters for request
* @param {integer=} params.maxResults The maximum number of accounts to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
adclients: {
/**
* adexchangeseller.accounts.adclients.list
*
* @desc List all ad clients in this Ad Exchange account.
*
* @alias adexchangeseller.accounts.adclients.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {integer=} params.maxResults The maximum number of ad clients to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
alerts: {
/**
* adexchangeseller.accounts.alerts.list
*
* @desc List the alerts for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.alerts.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the alerts.
* @param {string=} params.locale The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/alerts',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
customchannels: {
/**
* adexchangeseller.accounts.customchannels.get
*
* @desc Get the specified custom channel from the specified ad client.
*
* @alias adexchangeseller.accounts.customchannels.get
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {string} params.adClientId Ad client which contains the custom channel.
* @param {string} params.customChannelId Custom channel to retrieve.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'adClientId', 'customChannelId'],
pathParams: ['accountId', 'adClientId', 'customChannelId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.customchannels.list
*
* @desc List all custom channels in the specified ad client for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.customchannels.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {string} params.adClientId Ad client for which to list custom channels.
* @param {integer=} params.maxResults The maximum number of custom channels to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients/{adClientId}/customchannels',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'adClientId'],
pathParams: ['accountId', 'adClientId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
metadata: {
dimensions: {
/**
* adexchangeseller.accounts.metadata.dimensions.list
*
* @desc List the metadata for the dimensions available to this AdExchange account.
*
* @alias adexchangeseller.accounts.metadata.dimensions.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account with visibility to the dimensions.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/metadata/dimensions',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
metrics: {
/**
* adexchangeseller.accounts.metadata.metrics.list
*
* @desc List the metadata for the metrics available to this AdExchange account.
*
* @alias adexchangeseller.accounts.metadata.metrics.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account with visibility to the metrics.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/metadata/metrics',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
},
preferreddeals: {
/**
* adexchangeseller.accounts.preferreddeals.get
*
* @desc Get information about the selected Ad Exchange Preferred Deal.
*
* @alias adexchangeseller.accounts.preferreddeals.get
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the deal.
* @param {string} params.dealId Preferred deal to get information about.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/preferreddeals/{dealId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'dealId'],
pathParams: ['accountId', 'dealId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.preferreddeals.list
*
* @desc List the preferred deals for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.preferreddeals.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the deals.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/preferreddeals',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
reports: {
/**
* adexchangeseller.accounts.reports.generate
*
* @desc Generate an Ad Exchange report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
*
* @alias adexchangeseller.accounts.reports.generate
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account which owns the generated report.
* @param {string=} params.dimension Dimensions to base the report on.
* @param {string} params.endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
* @param {string=} params.filter Filters to be run on the report.
* @param {string=} params.locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
* @param {integer=} params.maxResults The maximum number of rows of report data to return.
* @param {string=} params.metric Numeric columns to include in the report.
* @param {string=} params.sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
* @param {string} params.startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
* @param {integer=} params.startIndex Index of the first row of report data to return.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generate: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/reports',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'startDate', 'endDate'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
},
saved: {
/**
* adexchangeseller.accounts.reports.saved.generate
*
* @desc Generate an Ad Exchange report based on the saved report ID sent in the query parameters.
*
* @alias adexchangeseller.accounts.reports.saved.generate
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the saved report.
* @param {string=} params.locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
* @param {integer=} params.maxResults The maximum number of rows of report data to return.
* @param {string} params.savedReportId The saved report to retrieve.
* @param {integer=} params.startIndex Index of the first row of report data to return.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generate: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/reports/{savedReportId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'savedReportId'],
pathParams: ['accountId', 'savedReportId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.reports.saved.list
*
* @desc List all saved reports in this Ad Exchange account.
*
* @alias adexchangeseller.accounts.reports.saved.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the saved reports.
* @param {integer=} params.maxResults The maximum number of saved reports to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/reports/saved',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
},
urlchannels: {
/**
* adexchangeseller.accounts.urlchannels.list
*
* @desc List all URL channels in the specified ad client for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.urlchannels.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {string} params.adClientId Ad client for which to list URL channels.
* @param {integer=} params.maxResults The maximum number of URL channels to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients/{adClientId}/urlchannels',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'adClientId'],
pathParams: ['accountId', 'adClientId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
};
} | function Adexchangeseller(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.accounts = {
/**
* adexchangeseller.accounts.get
*
* @desc Get information about the selected Ad Exchange account.
*
* @alias adexchangeseller.accounts.get
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to get information about. Tip: 'myaccount' is a valid ID.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.list
*
* @desc List all accounts available to this Ad Exchange account.
*
* @alias adexchangeseller.accounts.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object=} params Parameters for request
* @param {integer=} params.maxResults The maximum number of accounts to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
},
adclients: {
/**
* adexchangeseller.accounts.adclients.list
*
* @desc List all ad clients in this Ad Exchange account.
*
* @alias adexchangeseller.accounts.adclients.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {integer=} params.maxResults The maximum number of ad clients to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
alerts: {
/**
* adexchangeseller.accounts.alerts.list
*
* @desc List the alerts for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.alerts.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the alerts.
* @param {string=} params.locale The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/alerts',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
customchannels: {
/**
* adexchangeseller.accounts.customchannels.get
*
* @desc Get the specified custom channel from the specified ad client.
*
* @alias adexchangeseller.accounts.customchannels.get
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {string} params.adClientId Ad client which contains the custom channel.
* @param {string} params.customChannelId Custom channel to retrieve.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'adClientId', 'customChannelId'],
pathParams: ['accountId', 'adClientId', 'customChannelId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.customchannels.list
*
* @desc List all custom channels in the specified ad client for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.customchannels.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {string} params.adClientId Ad client for which to list custom channels.
* @param {integer=} params.maxResults The maximum number of custom channels to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients/{adClientId}/customchannels',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'adClientId'],
pathParams: ['accountId', 'adClientId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
metadata: {
dimensions: {
/**
* adexchangeseller.accounts.metadata.dimensions.list
*
* @desc List the metadata for the dimensions available to this AdExchange account.
*
* @alias adexchangeseller.accounts.metadata.dimensions.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account with visibility to the dimensions.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/metadata/dimensions',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
metrics: {
/**
* adexchangeseller.accounts.metadata.metrics.list
*
* @desc List the metadata for the metrics available to this AdExchange account.
*
* @alias adexchangeseller.accounts.metadata.metrics.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account with visibility to the metrics.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/metadata/metrics',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
},
preferreddeals: {
/**
* adexchangeseller.accounts.preferreddeals.get
*
* @desc Get information about the selected Ad Exchange Preferred Deal.
*
* @alias adexchangeseller.accounts.preferreddeals.get
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the deal.
* @param {string} params.dealId Preferred deal to get information about.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/preferreddeals/{dealId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'dealId'],
pathParams: ['accountId', 'dealId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.preferreddeals.list
*
* @desc List the preferred deals for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.preferreddeals.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the deals.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/preferreddeals',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
reports: {
/**
* adexchangeseller.accounts.reports.generate
*
* @desc Generate an Ad Exchange report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
*
* @alias adexchangeseller.accounts.reports.generate
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account which owns the generated report.
* @param {string=} params.dimension Dimensions to base the report on.
* @param {string} params.endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
* @param {string=} params.filter Filters to be run on the report.
* @param {string=} params.locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
* @param {integer=} params.maxResults The maximum number of rows of report data to return.
* @param {string=} params.metric Numeric columns to include in the report.
* @param {string=} params.sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
* @param {string} params.startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
* @param {integer=} params.startIndex Index of the first row of report data to return.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generate: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/reports',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'startDate', 'endDate'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
},
saved: {
/**
* adexchangeseller.accounts.reports.saved.generate
*
* @desc Generate an Ad Exchange report based on the saved report ID sent in the query parameters.
*
* @alias adexchangeseller.accounts.reports.saved.generate
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the saved report.
* @param {string=} params.locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
* @param {integer=} params.maxResults The maximum number of rows of report data to return.
* @param {string} params.savedReportId The saved report to retrieve.
* @param {integer=} params.startIndex Index of the first row of report data to return.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
generate: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/reports/{savedReportId}',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'savedReportId'],
pathParams: ['accountId', 'savedReportId'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* adexchangeseller.accounts.reports.saved.list
*
* @desc List all saved reports in this Ad Exchange account.
*
* @alias adexchangeseller.accounts.reports.saved.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account owning the saved reports.
* @param {integer=} params.maxResults The maximum number of saved reports to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/reports/saved',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
},
urlchannels: {
/**
* adexchangeseller.accounts.urlchannels.list
*
* @desc List all URL channels in the specified ad client for this Ad Exchange account.
*
* @alias adexchangeseller.accounts.urlchannels.list
* @memberOf! adexchangeseller(v2.0)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account to which the ad client belongs.
* @param {string} params.adClientId Ad client for which to list URL channels.
* @param {integer=} params.maxResults The maximum number of URL channels to include in the response, used for paging.
* @param {string=} params.pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/adexchangeseller/v2.0/accounts/{accountId}/adclients/{adClientId}/urlchannels',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'adClientId'],
pathParams: ['accountId', 'adClientId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
};
} |
JavaScript | function Webfonts(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.webfonts = {
/**
* webfonts.webfonts.list
*
* @desc Retrieves the list of fonts currently served by the Google Fonts Developer API
*
* @alias webfonts.webfonts.list
* @memberOf! webfonts(v1)
*
* @param {object=} params Parameters for request
* @param {string=} params.sort Enables sorting of the list
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/webfonts/v1/webfonts',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} | function Webfonts(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.webfonts = {
/**
* webfonts.webfonts.list
*
* @desc Retrieves the list of fonts currently served by the Google Fonts Developer API
*
* @alias webfonts.webfonts.list
* @memberOf! webfonts(v1)
*
* @param {object=} params Parameters for request
* @param {string=} params.sort Enables sorting of the list
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/webfonts/v1/webfonts',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} |
JavaScript | function Analytics(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.data = {
/**
* analytics.data.get
*
* @desc Returns Analytics report data for a view (profile).
*
* @alias analytics.data.get
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string=} params.dimensions A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.
* @param {string} params.end-date End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.
* @param {string=} params.filters A comma-separated list of dimension or metric filters to be applied to the report data.
* @param {string} params.ids Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
* @param {integer=} params.max-results The maximum number of entries to include in this feed.
* @param {string} params.metrics A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric must be specified to retrieve a valid Analytics report.
* @param {string=} params.segment An Analytics advanced segment to be applied to the report data.
* @param {string=} params.sort A comma-separated list of dimensions or metrics that determine the sort order for the report data.
* @param {string} params.start-date Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-DD.
* @param {integer=} params.start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/data',
method: 'GET'
},
params: params,
requiredParams: ['ids', 'start-date', 'end-date', 'metrics'],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.management = {
accounts: {
/**
* analytics.management.accounts.list
*
* @desc Lists all accounts to which the user has access.
*
* @alias analytics.management.accounts.list
* @memberOf! analytics(v2.4)
*
* @param {object=} params Parameters for request
* @param {integer=} params.max-results The maximum number of accounts to include in this response.
* @param {integer=} params.start-index An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
},
goals: {
/**
* analytics.management.goals.list
*
* @desc Lists goals to which the user has access.
*
* @alias analytics.management.goals.list
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
* @param {integer=} params.max-results The maximum number of goals to include in this response.
* @param {string} params.profileId View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which refers to all the views (profiles) that user has access to.
* @param {integer=} params.start-index An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {string} params.webPropertyId Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'webPropertyId', 'profileId'],
pathParams: ['accountId', 'profileId', 'webPropertyId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
profiles: {
/**
* analytics.management.profiles.list
*
* @desc Lists views (profiles) to which the user has access.
*
* @alias analytics.management.profiles.list
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.
* @param {integer=} params.max-results The maximum number of views (profiles) to include in this response.
* @param {integer=} params.start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {string} params.webPropertyId Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'webPropertyId'],
pathParams: ['accountId', 'webPropertyId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
segments: {
/**
* analytics.management.segments.list
*
* @desc Lists advanced segments to which the user has access.
*
* @alias analytics.management.segments.list
* @memberOf! analytics(v2.4)
*
* @param {object=} params Parameters for request
* @param {integer=} params.max-results The maximum number of advanced segments to include in this response.
* @param {integer=} params.start-index An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/segments',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
},
webproperties: {
/**
* analytics.management.webproperties.list
*
* @desc Lists web properties to which the user has access.
*
* @alias analytics.management.webproperties.list
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
* @param {integer=} params.max-results The maximum number of web properties to include in this response.
* @param {integer=} params.start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
};
} | function Analytics(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.data = {
/**
* analytics.data.get
*
* @desc Returns Analytics report data for a view (profile).
*
* @alias analytics.data.get
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string=} params.dimensions A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.
* @param {string} params.end-date End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.
* @param {string=} params.filters A comma-separated list of dimension or metric filters to be applied to the report data.
* @param {string} params.ids Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
* @param {integer=} params.max-results The maximum number of entries to include in this feed.
* @param {string} params.metrics A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric must be specified to retrieve a valid Analytics report.
* @param {string=} params.segment An Analytics advanced segment to be applied to the report data.
* @param {string=} params.sort A comma-separated list of dimensions or metrics that determine the sort order for the report data.
* @param {string} params.start-date Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-DD.
* @param {integer=} params.start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/data',
method: 'GET'
},
params: params,
requiredParams: ['ids', 'start-date', 'end-date', 'metrics'],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.management = {
accounts: {
/**
* analytics.management.accounts.list
*
* @desc Lists all accounts to which the user has access.
*
* @alias analytics.management.accounts.list
* @memberOf! analytics(v2.4)
*
* @param {object=} params Parameters for request
* @param {integer=} params.max-results The maximum number of accounts to include in this response.
* @param {integer=} params.start-index An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
},
goals: {
/**
* analytics.management.goals.list
*
* @desc Lists goals to which the user has access.
*
* @alias analytics.management.goals.list
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
* @param {integer=} params.max-results The maximum number of goals to include in this response.
* @param {string} params.profileId View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which refers to all the views (profiles) that user has access to.
* @param {integer=} params.start-index An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {string} params.webPropertyId Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'webPropertyId', 'profileId'],
pathParams: ['accountId', 'profileId', 'webPropertyId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
profiles: {
/**
* analytics.management.profiles.list
*
* @desc Lists views (profiles) to which the user has access.
*
* @alias analytics.management.profiles.list
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.
* @param {integer=} params.max-results The maximum number of views (profiles) to include in this response.
* @param {integer=} params.start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {string} params.webPropertyId Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles',
method: 'GET'
},
params: params,
requiredParams: ['accountId', 'webPropertyId'],
pathParams: ['accountId', 'webPropertyId'],
context: self
};
return createAPIRequest(parameters, callback);
}
},
segments: {
/**
* analytics.management.segments.list
*
* @desc Lists advanced segments to which the user has access.
*
* @alias analytics.management.segments.list
* @memberOf! analytics(v2.4)
*
* @param {object=} params Parameters for request
* @param {integer=} params.max-results The maximum number of advanced segments to include in this response.
* @param {integer=} params.start-index An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/segments',
method: 'GET'
},
params: params,
requiredParams: [],
pathParams: [],
context: self
};
return createAPIRequest(parameters, callback);
}
},
webproperties: {
/**
* analytics.management.webproperties.list
*
* @desc Lists web properties to which the user has access.
*
* @alias analytics.management.webproperties.list
* @memberOf! analytics(v2.4)
*
* @param {object} params Parameters for request
* @param {string} params.accountId Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
* @param {integer=} params.max-results The maximum number of web properties to include in this response.
* @param {integer=} params.start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties',
method: 'GET'
},
params: params,
requiredParams: ['accountId'],
pathParams: ['accountId'],
context: self
};
return createAPIRequest(parameters, callback);
}
}
};
} |
JavaScript | function Serviceregistry(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.endpoints = {
/**
* serviceregistry.endpoints.delete
*
* @desc Deletes an endpoint.
*
* @alias serviceregistry.endpoints.delete
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'DELETE'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.get
*
* @desc Gets an endpoint.
*
* @alias serviceregistry.endpoints.get
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'GET'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.insert
*
* @desc Creates an endpoint.
*
* @alias serviceregistry.endpoints.insert
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.project The project ID for this request.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints',
method: 'POST'
},
params: params,
requiredParams: ['project'],
pathParams: ['project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.list
*
* @desc Lists endpoints for a project.
*
* @alias serviceregistry.endpoints.list
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string=} params.filter Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance. Compute Engine Beta API Only: When filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values. The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
* @param {integer=} params.maxResults The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
* @param {string=} params.orderBy Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.
* @param {string=} params.pageToken Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints',
method: 'GET'
},
params: params,
requiredParams: ['project'],
pathParams: ['project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.patch
*
* @desc Updates an endpoint. This method supports patch semantics.
*
* @alias serviceregistry.endpoints.patch
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'PATCH'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.update
*
* @desc Updates an endpoint.
*
* @alias serviceregistry.endpoints.update
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'PUT'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.operations = {
/**
* serviceregistry.operations.get
*
* @desc Gets information about a specific operation.
*
* @alias serviceregistry.operations.get
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.operation The name of the operation for this request.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/operations/{operation}',
method: 'GET'
},
params: params,
requiredParams: ['project', 'operation'],
pathParams: ['operation', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.operations.list
*
* @desc Lists all operations for a project.
*
* @alias serviceregistry.operations.list
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string=} params.filter Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance. Compute Engine Beta API Only: When filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values. The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
* @param {integer=} params.maxResults The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
* @param {string=} params.orderBy Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.
* @param {string=} params.pageToken Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/operations',
method: 'GET'
},
params: params,
requiredParams: ['project'],
pathParams: ['project'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} | function Serviceregistry(options) { // eslint-disable-line
var self = this;
self._options = options || {};
self.endpoints = {
/**
* serviceregistry.endpoints.delete
*
* @desc Deletes an endpoint.
*
* @alias serviceregistry.endpoints.delete
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
delete: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'DELETE'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.get
*
* @desc Gets an endpoint.
*
* @alias serviceregistry.endpoints.get
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'GET'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.insert
*
* @desc Creates an endpoint.
*
* @alias serviceregistry.endpoints.insert
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.project The project ID for this request.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
insert: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints',
method: 'POST'
},
params: params,
requiredParams: ['project'],
pathParams: ['project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.list
*
* @desc Lists endpoints for a project.
*
* @alias serviceregistry.endpoints.list
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string=} params.filter Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance. Compute Engine Beta API Only: When filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values. The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
* @param {integer=} params.maxResults The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
* @param {string=} params.orderBy Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.
* @param {string=} params.pageToken Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints',
method: 'GET'
},
params: params,
requiredParams: ['project'],
pathParams: ['project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.patch
*
* @desc Updates an endpoint. This method supports patch semantics.
*
* @alias serviceregistry.endpoints.patch
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
patch: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'PATCH'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.endpoints.update
*
* @desc Updates an endpoint.
*
* @alias serviceregistry.endpoints.update
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.endpoint The name of the endpoint for this request.
* @param {string} params.project The project ID for this request.
* @param {object} params.resource Request body data
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
update: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}',
method: 'PUT'
},
params: params,
requiredParams: ['project', 'endpoint'],
pathParams: ['endpoint', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
self.operations = {
/**
* serviceregistry.operations.get
*
* @desc Gets information about a specific operation.
*
* @alias serviceregistry.operations.get
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string} params.operation The name of the operation for this request.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
get: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/operations/{operation}',
method: 'GET'
},
params: params,
requiredParams: ['project', 'operation'],
pathParams: ['operation', 'project'],
context: self
};
return createAPIRequest(parameters, callback);
},
/**
* serviceregistry.operations.list
*
* @desc Lists all operations for a project.
*
* @alias serviceregistry.operations.list
* @memberOf! serviceregistry(alpha)
*
* @param {object} params Parameters for request
* @param {string=} params.filter Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance. Compute Engine Beta API Only: When filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values. The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
* @param {integer=} params.maxResults The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
* @param {string=} params.orderBy Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.
* @param {string=} params.pageToken Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
* @param {string} params.project The project ID for this request.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
list: function (params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/operations',
method: 'GET'
},
params: params,
requiredParams: ['project'],
pathParams: ['project'],
context: self
};
return createAPIRequest(parameters, callback);
}
};
} |
JavaScript | function Toaster() {
/**
* @type {Toast[]}
*/
this.toasts = [];
/**
* Keeps the timeouts of toasts which are removed.
* @type {Map}
*/
this.timeouts = new Map();
} | function Toaster() {
/**
* @type {Toast[]}
*/
this.toasts = [];
/**
* Keeps the timeouts of toasts which are removed.
* @type {Map}
*/
this.timeouts = new Map();
} |
JavaScript | function configureToasts() {
var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
Object.assign(options, newOptions);
} | function configureToasts() {
var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
Object.assign(options, newOptions);
} |
JavaScript | function Toaster () {
/**
* @type {Toast[]}
*/
this.toasts = [];
/**
* Keeps the timeouts of toasts which are removed.
* @type {Map}
*/
this.timeouts = new Map();
} | function Toaster () {
/**
* @type {Toast[]}
*/
this.toasts = [];
/**
* Keeps the timeouts of toasts which are removed.
* @type {Map}
*/
this.timeouts = new Map();
} |
JavaScript | handleChange(name, value) {
this.setState({[name]: value}, () => {
this.updateTotalCurrentAccts();
});
} | handleChange(name, value) {
this.setState({[name]: value}, () => {
this.updateTotalCurrentAccts();
});
} |
JavaScript | handleClickEmergency(evt) {
evt.preventDefault();
// We find the number of months by dividing the user's total accounts by their monthly expenses. Their monthly income is not a part of this calculation.
const emergencyMonths = (this.state.totalCurrentAccts / this.props.expenseTotalMonthly).toFixed(2);
this.setState({ emergencyMonths: emergencyMonths}, () => {
this.setState({ showEmergencyMonths: true })
});
} | handleClickEmergency(evt) {
evt.preventDefault();
// We find the number of months by dividing the user's total accounts by their monthly expenses. Their monthly income is not a part of this calculation.
const emergencyMonths = (this.state.totalCurrentAccts / this.props.expenseTotalMonthly).toFixed(2);
this.setState({ emergencyMonths: emergencyMonths}, () => {
this.setState({ showEmergencyMonths: true })
});
} |
JavaScript | handleClickSavingsGoal(evt) {
evt.preventDefault();
// Declaring variable that will be modified by if/else statement
let savingsGoalMonths;
// If the user puts a savings goal that they've already reached, we tell them so.
// Note - added Number() to fix bug where numbers were being treated incorrectly (i.e. 2000 < 300)
if (Number(this.state.savingsGoal) <= Number(this.state.totalCurrentAccts)) {
console.log("goal is less than current accounts");
savingsGoalMonths = "You Already Did It!"
} else {
// Otherwise, calculate the number of months until they reach goal
let number = ((this.state.savingsGoal - this.state.totalCurrentAccts) / this.props.cashFlowTotalMonthly).toFixed(2);
savingsGoalMonths = `${number} Months`
}
this.setState({ savingsGoalMonths: savingsGoalMonths}, () => {
this.setState({ showSavingsGoalMonths: true })
});
} | handleClickSavingsGoal(evt) {
evt.preventDefault();
// Declaring variable that will be modified by if/else statement
let savingsGoalMonths;
// If the user puts a savings goal that they've already reached, we tell them so.
// Note - added Number() to fix bug where numbers were being treated incorrectly (i.e. 2000 < 300)
if (Number(this.state.savingsGoal) <= Number(this.state.totalCurrentAccts)) {
console.log("goal is less than current accounts");
savingsGoalMonths = "You Already Did It!"
} else {
// Otherwise, calculate the number of months until they reach goal
let number = ((this.state.savingsGoal - this.state.totalCurrentAccts) / this.props.cashFlowTotalMonthly).toFixed(2);
savingsGoalMonths = `${number} Months`
}
this.setState({ savingsGoalMonths: savingsGoalMonths}, () => {
this.setState({ showSavingsGoalMonths: true })
});
} |
JavaScript | handleClickNegativeMonths(evt) {
evt.preventDefault();
const negativeMonths = (-1 * (this.state.totalCurrentAccts / this.props.cashFlowTotalMonthly)).toFixed(2);
this.setState({ negativeMonths: negativeMonths}, () => {
this.setState({ showNegativeMonths: true });
});
} | handleClickNegativeMonths(evt) {
evt.preventDefault();
const negativeMonths = (-1 * (this.state.totalCurrentAccts / this.props.cashFlowTotalMonthly)).toFixed(2);
this.setState({ negativeMonths: negativeMonths}, () => {
this.setState({ showNegativeMonths: true });
});
} |
JavaScript | handleOnBlur() {
let cleanValue = this.state.value;
if (cleanValue === "") cleanValue = 0;
cleanValue = Number(this.state.value).toFixed(2);
this.setState({ value: cleanValue });
this.props.handleChange(this.props.id, cleanValue)
} | handleOnBlur() {
let cleanValue = this.state.value;
if (cleanValue === "") cleanValue = 0;
cleanValue = Number(this.state.value).toFixed(2);
this.setState({ value: cleanValue });
this.props.handleChange(this.props.id, cleanValue)
} |
JavaScript | handleOnBlur() {
let cleanValue = this.state.value;
if (cleanValue === "") cleanValue = 0;
cleanValue = Number(this.state.value).toFixed(2);
this.setState({ value: cleanValue });
this.props.handleChange(this.props.title, cleanValue, this.props.categoryTitle)
} | handleOnBlur() {
let cleanValue = this.state.value;
if (cleanValue === "") cleanValue = 0;
cleanValue = Number(this.state.value).toFixed(2);
this.setState({ value: cleanValue });
this.props.handleChange(this.props.title, cleanValue, this.props.categoryTitle)
} |
JavaScript | function cleanupMarkdown(input) {
const trailingSpaces = / +\n/g
const excessiveNewLines = /\n{3,}/g
if (!input) {
return input
}
var result = input.replace(trailingSpaces, '\n')
result = result.replace(excessiveNewLines, '\n\n')
return result
} | function cleanupMarkdown(input) {
const trailingSpaces = / +\n/g
const excessiveNewLines = /\n{3,}/g
if (!input) {
return input
}
var result = input.replace(trailingSpaces, '\n')
result = result.replace(excessiveNewLines, '\n\n')
return result
} |
JavaScript | FunctionDeclaration(d) {
output.push(
`function ${gen(d.func)}(${gen(d.func.parameters).join(
", "
)}) {`
);
gen(d.body);
output.push("}");
} | FunctionDeclaration(d) {
output.push(
`function ${gen(d.func)}(${gen(d.func.parameters).join(
", "
)}) {`
);
gen(d.body);
output.push("}");
} |
JavaScript | function tag(node) {
if (tags.has(node) || typeof node !== "object" || node === null) return;
if (node.constructor === Token) {
// Tokens are not tagged themselves, but their values might be
tag(node?.value);
} else {
// Non-tokens are tagged
tags.set(node, tags.size + 1);
for (const child of Object.values(node)) {
Array.isArray(child) ? child.forEach(tag) : tag(child);
}
}
} | function tag(node) {
if (tags.has(node) || typeof node !== "object" || node === null) return;
if (node.constructor === Token) {
// Tokens are not tagged themselves, but their values might be
tag(node?.value);
} else {
// Non-tokens are tagged
tags.set(node, tags.size + 1);
for (const child of Object.values(node)) {
Array.isArray(child) ? child.forEach(tag) : tag(child);
}
}
} |
JavaScript | function checkPostType(){
if(document.forms["post-form"]["type"].value == "shot") {
show("image-upload");
document.forms["post-form"]["file"].setAttribute("required", "");
} else {
hide("image-upload");
document.forms["post-form"]["file"].removeAttribute("required");
}
} | function checkPostType(){
if(document.forms["post-form"]["type"].value == "shot") {
show("image-upload");
document.forms["post-form"]["file"].setAttribute("required", "");
} else {
hide("image-upload");
document.forms["post-form"]["file"].removeAttribute("required");
}
} |
JavaScript | function checkType(){
if(document.forms["user-form"]["type"].value == "user") {
show("username-input");
show("bio-input");
document.forms["user-form"]["username"].setAttribute("required", "");
} else {
hide("username-input");
hide("bio-input");
document.forms["user-form"]["username"].removeAttribute("required");
}
} | function checkType(){
if(document.forms["user-form"]["type"].value == "user") {
show("username-input");
show("bio-input");
document.forms["user-form"]["username"].setAttribute("required", "");
} else {
hide("username-input");
hide("bio-input");
document.forms["user-form"]["username"].removeAttribute("required");
}
} |
JavaScript | function openEdit(elem) {
//Hide edit and delete buttons
elem.parentNode.classList.add("hide");
//hide comment body
elem.parentNode.parentNode.childNodes[0].childNodes[0].classList.add("hide");
//show form
elem.parentNode.parentNode.childNodes[0].childNodes[2].classList.remove("hide");
} | function openEdit(elem) {
//Hide edit and delete buttons
elem.parentNode.classList.add("hide");
//hide comment body
elem.parentNode.parentNode.childNodes[0].childNodes[0].classList.add("hide");
//show form
elem.parentNode.parentNode.childNodes[0].childNodes[2].classList.remove("hide");
} |
JavaScript | function closeEdit(elem) {
//hide form
elem.parentNode.classList.add("hide");
//show comment body
elem.parentNode.parentNode.childNodes[0].classList.remove("hide");
//show edit and delete buttons
elem.parentNode.parentNode.parentNode.childNodes[2].classList.remove("hide");
} | function closeEdit(elem) {
//hide form
elem.parentNode.classList.add("hide");
//show comment body
elem.parentNode.parentNode.childNodes[0].classList.remove("hide");
//show edit and delete buttons
elem.parentNode.parentNode.parentNode.childNodes[2].classList.remove("hide");
} |
JavaScript | function preload() {
leftShoulderImage = loadImage('assets/bb/leftShoulderbb.png');
rightShoulderImage = loadImage('assets/bb/rightShoulderbb.png');
leftWristImage = loadImage('assets/bb/leftWristbb.png');
rightWristImage = loadImage('assets/bb/rightWristbb.png');
leftElbowImage = loadImage('assets/bb/leftElbowbb.png');
rightElbowImage = loadImage('assets/bb/rightElbowbb.png');
leftKneeImage = loadImage('assets/bb/leftKneebb.png');
rightKneeImage = loadImage('assets/bb/rightKneebb.png');
leftAnkleImage = loadImage('assets/bb/leftAnklebb.png');
rightAnkleImage = loadImage('assets/bb/rightAnklebb.png');
rightHipImage = loadImage('assets/bb/leftHipbb.png');
leftHipImage = loadImage('assets/bb/rightHipbb.png');
torsoImage = loadImage('assets/bb/torsobb.png')
} | function preload() {
leftShoulderImage = loadImage('assets/bb/leftShoulderbb.png');
rightShoulderImage = loadImage('assets/bb/rightShoulderbb.png');
leftWristImage = loadImage('assets/bb/leftWristbb.png');
rightWristImage = loadImage('assets/bb/rightWristbb.png');
leftElbowImage = loadImage('assets/bb/leftElbowbb.png');
rightElbowImage = loadImage('assets/bb/rightElbowbb.png');
leftKneeImage = loadImage('assets/bb/leftKneebb.png');
rightKneeImage = loadImage('assets/bb/rightKneebb.png');
leftAnkleImage = loadImage('assets/bb/leftAnklebb.png');
rightAnkleImage = loadImage('assets/bb/rightAnklebb.png');
rightHipImage = loadImage('assets/bb/leftHipbb.png');
leftHipImage = loadImage('assets/bb/rightHipbb.png');
torsoImage = loadImage('assets/bb/torsobb.png')
} |
JavaScript | function preload() {
noseImage = loadImage('assets/hybrid/nose.png');
rightEyeImage = loadImage('assets/hybrid/leftEye.png');
leftEyeImage = loadImage('assets/hybrid/rightEye.png');
leftEarImage = loadImage('assets/hybrid/rightEar.png');
rightEarImage = loadImage('assets/hybrid/leftEar.png');
leftShoulderImage = loadImage('assets/hybrid/rightShoulder.png');
rightShoulderImage = loadImage('assets/hybrid/leftShoulder.png');
leftWristImage = loadImage('assets/hybrid/rightWrist.png');
rightWristImage = loadImage('assets/hybrid/leftWrist.png');
leftElbowImage = loadImage('assets/hybrid/leftElbow.png');
rightElbowImage = loadImage('assets/hybrid/rightElbow.png');
leftKneeImage = loadImage('assets/knees/rightKnee.png');
rightKneeImage = loadImage('assets/knees/leftKnee.png');
leftAnkleImage = loadImage('assets/ankles/rightAnkle.png');
rightAnkleImage = loadImage('assets/ankles/leftAnkle.png');
rightHipImage = loadImage('assets/hips/leftHip.png');
leftHipImage = loadImage('assets/hips/rightHip.png');
torsoImage = loadImage('assets/torso/torso.png')
} | function preload() {
noseImage = loadImage('assets/hybrid/nose.png');
rightEyeImage = loadImage('assets/hybrid/leftEye.png');
leftEyeImage = loadImage('assets/hybrid/rightEye.png');
leftEarImage = loadImage('assets/hybrid/rightEar.png');
rightEarImage = loadImage('assets/hybrid/leftEar.png');
leftShoulderImage = loadImage('assets/hybrid/rightShoulder.png');
rightShoulderImage = loadImage('assets/hybrid/leftShoulder.png');
leftWristImage = loadImage('assets/hybrid/rightWrist.png');
rightWristImage = loadImage('assets/hybrid/leftWrist.png');
leftElbowImage = loadImage('assets/hybrid/leftElbow.png');
rightElbowImage = loadImage('assets/hybrid/rightElbow.png');
leftKneeImage = loadImage('assets/knees/rightKnee.png');
rightKneeImage = loadImage('assets/knees/leftKnee.png');
leftAnkleImage = loadImage('assets/ankles/rightAnkle.png');
rightAnkleImage = loadImage('assets/ankles/leftAnkle.png');
rightHipImage = loadImage('assets/hips/leftHip.png');
leftHipImage = loadImage('assets/hips/rightHip.png');
torsoImage = loadImage('assets/torso/torso.png')
} |
JavaScript | list() {
return this.find()
.populate('userId')
.populate('countryId')
.populate('categoryId')
.exec();
} | list() {
return this.find()
.populate('userId')
.populate('countryId')
.populate('categoryId')
.exec();
} |
JavaScript | list() {
return this.find()
.populate('tenderUploader')
.populate('country')
.populate('category')
.exec();
} | list() {
return this.find()
.populate('tenderUploader')
.populate('country')
.populate('category')
.exec();
} |
JavaScript | function load(req, res, next, id) { // eslint-disable-line
Tender.get(id)
.then((tender) => {
req.tender = tender;
return next();
})
.catch(e => next(e));
} | function load(req, res, next, id) { // eslint-disable-line
Tender.get(id)
.then((tender) => {
req.tender = tender;
return next();
})
.catch(e => next(e));
} |
JavaScript | function load(req, res, next, id) {
Country.get(id)
.then((country) => {
if (!country) {
req.error = 'No such country exists!';
return next();
}
req.country = country; // eslint-disable-line no-param-reassign
return next();
})
.catch(e => next(e));
} | function load(req, res, next, id) {
Country.get(id)
.then((country) => {
if (!country) {
req.error = 'No such country exists!';
return next();
}
req.country = country; // eslint-disable-line no-param-reassign
return next();
})
.catch(e => next(e));
} |
JavaScript | function load(req, res, next, id) {
Category.get(id)
.then((category) => {
if (!category) {
req.error = 'No such category exists!';
return next();
}
req.category = category; // eslint-disable-line no-param-reassign
return next();
})
.catch(e => next(e));
} | function load(req, res, next, id) {
Category.get(id)
.then((category) => {
if (!category) {
req.error = 'No such category exists!';
return next();
}
req.category = category; // eslint-disable-line no-param-reassign
return next();
})
.catch(e => next(e));
} |
JavaScript | search(...keywords) {
const result = [];
for (const [name, options] of this._setArgvOptionsMap) {
let isHit = true;
for (const keyword of keywords) {
if (name.indexOf(keyword) > -1) {
continue;
}
if (options.short && options.short.indexOf(keyword) > -1) {
continue;
}
if (options.description && options.description.indexOf(keyword) > -1) {
continue;
}
isHit = false;
break;
}
if (isHit) {
result.push(name);
}
}
return result;
} | search(...keywords) {
const result = [];
for (const [name, options] of this._setArgvOptionsMap) {
let isHit = true;
for (const keyword of keywords) {
if (name.indexOf(keyword) > -1) {
continue;
}
if (options.short && options.short.indexOf(keyword) > -1) {
continue;
}
if (options.description && options.description.indexOf(keyword) > -1) {
continue;
}
isHit = false;
break;
}
if (isHit) {
result.push(name);
}
}
return result;
} |
JavaScript | stringToOptionName(key) {
if (/^-[^-]/.test(key)) {
const short = key.slice(1);
for (const [optionNames, options] of this._setArgvOptionsMap) {
if (options.short === short) {
return optionNames;
}
}
}
else {
const resultName = key.replace(/^--/, '');
if (this._setArgvOptionsMap.has(resultName)) {
return resultName;
}
}
throw Error(`Unknown command options '${key}'.`);
} | stringToOptionName(key) {
if (/^-[^-]/.test(key)) {
const short = key.slice(1);
for (const [optionNames, options] of this._setArgvOptionsMap) {
if (options.short === short) {
return optionNames;
}
}
}
else {
const resultName = key.replace(/^--/, '');
if (this._setArgvOptionsMap.has(resultName)) {
return resultName;
}
}
throw Error(`Unknown command options '${key}'.`);
} |
JavaScript | showVersion() {
if (packageObject.version) {
this._clOptsOptions.logger.log('version:', paintType(packageObject.version));
}
else {
this._clOptsOptions.logger.log('version is undefined.');
}
return this;
} | showVersion() {
if (packageObject.version) {
this._clOptsOptions.logger.log('version:', paintType(packageObject.version));
}
else {
this._clOptsOptions.logger.log('version is undefined.');
}
return this;
} |
JavaScript | showUsage() {
this._clOptsOptions.logger.group('Usage:');
const messages = [this._clOptsOptions.command];
if (this._entries.length > 0) {
const entries = this._entries.map(name => `[${name}]`);
messages.push(`${green}${entries.join(' ')}${reset}`);
}
messages.push(`${blue}<options>${reset}`);
const message = messages.join(' ');
this._clOptsOptions.logger.log(message);
this._clOptsOptions.logger.groupEnd();
return this;
} | showUsage() {
this._clOptsOptions.logger.group('Usage:');
const messages = [this._clOptsOptions.command];
if (this._entries.length > 0) {
const entries = this._entries.map(name => `[${name}]`);
messages.push(`${green}${entries.join(' ')}${reset}`);
}
messages.push(`${blue}<options>${reset}`);
const message = messages.join(' ');
this._clOptsOptions.logger.log(message);
this._clOptsOptions.logger.groupEnd();
return this;
} |
JavaScript | showOptions(...names) {
this._clOptsOptions.logger.group('Options:');
const showNames = names = names.length < 1
? [...this._setArgvOptionsMap.keys()]
: names.map(name => this.stringToOptionName(name));
const helps = showNames.map(name => {
const options = this.getOptions(name);
return {
name: `--${name}`,
short: options.short ? `-${options.short}` : '',
type: Array.isArray(options.value) ? 'array' : typeof options.value,
value: options.value,
required: options.required,
description: options.description || ''
};
});
const maxNameLength = Math.max(...helps.map(i => i.name.length));
const maxShortLength = Math.max(...helps.map(i => i.short.length));
const maxTypeLength = Math.max(...helps.map(i => i.type.length));
for (const help of helps) {
const name = `${blue}${help.name.padEnd(maxNameLength)}${reset}`;
const short = `${blue}${help.short.padEnd(maxShortLength)}${reset}`;
let message = `${name} ${short}`;
if (this._clOptsOptions.showType) {
const type = `${green}${help.type.padEnd(maxTypeLength)}${reset}`;
message += ` ${type}`;
}
message += ` ${help.description}`;
if (this._clOptsOptions.showDefault && !help.required) {
const value = `${blue}(default:${reset} ${paintType(help.value)}${blue})${reset}`;
message += ` ${value}`;
}
this._clOptsOptions.logger.log(message);
}
this._clOptsOptions.logger.groupEnd();
return this;
} | showOptions(...names) {
this._clOptsOptions.logger.group('Options:');
const showNames = names = names.length < 1
? [...this._setArgvOptionsMap.keys()]
: names.map(name => this.stringToOptionName(name));
const helps = showNames.map(name => {
const options = this.getOptions(name);
return {
name: `--${name}`,
short: options.short ? `-${options.short}` : '',
type: Array.isArray(options.value) ? 'array' : typeof options.value,
value: options.value,
required: options.required,
description: options.description || ''
};
});
const maxNameLength = Math.max(...helps.map(i => i.name.length));
const maxShortLength = Math.max(...helps.map(i => i.short.length));
const maxTypeLength = Math.max(...helps.map(i => i.type.length));
for (const help of helps) {
const name = `${blue}${help.name.padEnd(maxNameLength)}${reset}`;
const short = `${blue}${help.short.padEnd(maxShortLength)}${reset}`;
let message = `${name} ${short}`;
if (this._clOptsOptions.showType) {
const type = `${green}${help.type.padEnd(maxTypeLength)}${reset}`;
message += ` ${type}`;
}
message += ` ${help.description}`;
if (this._clOptsOptions.showDefault && !help.required) {
const value = `${blue}(default:${reset} ${paintType(help.value)}${blue})${reset}`;
message += ` ${value}`;
}
this._clOptsOptions.logger.log(message);
}
this._clOptsOptions.logger.groupEnd();
return this;
} |
JavaScript | function errHandler(err, req, res, next) {
if (err instanceof multer.MulterError) {
res.json({
errorMessage: err.message
});
}
} | function errHandler(err, req, res, next) {
if (err instanceof multer.MulterError) {
res.json({
errorMessage: err.message
});
}
} |
JavaScript | static buildDependencies() {
let logger = new Logger();
logger.info(`Building the app's dependencies...`);
let storageBasePath = `${MainBundlePath}/data`;
let instrumentManager = new InstrumentManager({
logger,
instrumentStorage: new FileSystemJsonStorage({ logger, directoryPath: `${storageBasePath}/instruments` }),
fileInfoStorage: new FileInfoStorage({ logger, directoryPath: `${storageBasePath}/fileInfo` })
});
const voxophone = new VoxophoneEngine({ logger });
// Go ahead and set the initial instrument voice.
logger.info('Getting the instruments...');
instrumentManager.getInstruments()
.then(instruments => voxophone.setInstrument({ instrument: instruments[0] }));
let dependencies = {
logger,
voxophone,
instrumentManager
};
return dependencies;
} | static buildDependencies() {
let logger = new Logger();
logger.info(`Building the app's dependencies...`);
let storageBasePath = `${MainBundlePath}/data`;
let instrumentManager = new InstrumentManager({
logger,
instrumentStorage: new FileSystemJsonStorage({ logger, directoryPath: `${storageBasePath}/instruments` }),
fileInfoStorage: new FileInfoStorage({ logger, directoryPath: `${storageBasePath}/fileInfo` })
});
const voxophone = new VoxophoneEngine({ logger });
// Go ahead and set the initial instrument voice.
logger.info('Getting the instruments...');
instrumentManager.getInstruments()
.then(instruments => voxophone.setInstrument({ instrument: instruments[0] }));
let dependencies = {
logger,
voxophone,
instrumentManager
};
return dependencies;
} |
JavaScript | _cycleMarginAnimation() {
Animated.sequence([
Animated.timing(this.state.margin, {
toValue: MARGIN_MAX,
duration: MARGIN_ANIMATION_DURATION
}),
Animated.timing(this.state.margin, {
toValue: MARGIN_MIN,
duration: MARGIN_ANIMATION_DURATION
})
]).start(() => this._cycleMarginAnimation());
} | _cycleMarginAnimation() {
Animated.sequence([
Animated.timing(this.state.margin, {
toValue: MARGIN_MAX,
duration: MARGIN_ANIMATION_DURATION
}),
Animated.timing(this.state.margin, {
toValue: MARGIN_MIN,
duration: MARGIN_ANIMATION_DURATION
})
]).start(() => this._cycleMarginAnimation());
} |
JavaScript | _noteOff() {
let delayPerRing = NOTE_OFF_TRANSITION_MILLISECONDS / this.state.rings.length;
// Sequentially erase each ring, adding a delay between each to stretch it out to the desired time.
return this.state.rings.reduce((promise, ring) => {
return promise
.then(() => {
ring.isVisible = false;
this.setState({
rings: this.state.rings
});
return delay(delayPerRing);
});
}, Promise.resolve());
} | _noteOff() {
let delayPerRing = NOTE_OFF_TRANSITION_MILLISECONDS / this.state.rings.length;
// Sequentially erase each ring, adding a delay between each to stretch it out to the desired time.
return this.state.rings.reduce((promise, ring) => {
return promise
.then(() => {
ring.isVisible = false;
this.setState({
rings: this.state.rings
});
return delay(delayPerRing);
});
}, Promise.resolve());
} |
JavaScript | _blink() {
return delay(2000)
.then(() => {
this._noteIsOn = !this._noteIsOn;
return this._noteIsOn ? this._noteOn('C#') : this._noteOff();
})
.then(() => this._blink());
} | _blink() {
return delay(2000)
.then(() => {
this._noteIsOn = !this._noteIsOn;
return this._noteIsOn ? this._noteOn('C#') : this._noteOff();
})
.then(() => this._blink());
} |
JavaScript | @action
startup(element) {
if (this.args.onInsert) this.args.onInsert(element);
this.notifyOnChange(element.selectedIndex);
} | @action
startup(element) {
if (this.args.onInsert) this.args.onInsert(element);
this.notifyOnChange(element.selectedIndex);
} |
JavaScript | get sanitizedValue() {
var value = this.args.content.value;
if (typeof value === "string" || typeof value === "number") return value;
var options = this.options;
let result = options[0] ? (options[0].value || "") : "";
debug(`oxifield-select (${this.args.content.name}): sanitizedValue ("${this.args.content.value}" -> "${result}")`);
return result;
} | get sanitizedValue() {
var value = this.args.content.value;
if (typeof value === "string" || typeof value === "number") return value;
var options = this.options;
let result = options[0] ? (options[0].value || "") : "";
debug(`oxifield-select (${this.args.content.name}): sanitizedValue ("${this.args.content.value}" -> "${result}")`);
return result;
} |
JavaScript | @action
navigateTo(page, event) {
if (event) { event.stopPropagation(); event.preventDefault() }
this.router.transitionTo('openxpki', page, { queryParams: { force: (new Date()).valueOf() } });
} | @action
navigateTo(page, event) {
if (event) { event.stopPropagation(); event.preventDefault() }
this.router.transitionTo('openxpki', page, { queryParams: { force: (new Date()).valueOf() } });
} |
JavaScript | _setLoadingBanner(message) {
// note that we cannot use the Ember "loading" event as this would only
// trigger on route changes, but not if we do updateRequest()
if (message) {
// remove focus from button to prevent user from doing another
// submit by hitting enter
document.activeElement.blur();
}
this.loadingBanner = message;
} | _setLoadingBanner(message) {
// note that we cannot use the Ember "loading" event as this would only
// trigger on route changes, but not if we do updateRequest()
if (message) {
// remove focus from button to prevent user from doing another
// submit by hitting enter
document.activeElement.blur();
}
this.loadingBanner = message;
} |
JavaScript | _encodeAllFields({ includeEmpty = false }) {
return this._encodeFields({
includeEmpty,
fieldNames: this.uniqueFieldNames,
});
} | _encodeAllFields({ includeEmpty = false }) {
return this._encodeFields({
includeEmpty,
fieldNames: this.uniqueFieldNames,
});
} |
JavaScript | @action
encodeFields(fieldNames, renameMap) {
debug(`oxi-section/form (${this.args.def.action}): encodeFields ()`);
return this._encodeFields({ fieldNames, renameMap, includeEmpty: true });
} | @action
encodeFields(fieldNames, renameMap) {
debug(`oxi-section/form (${this.args.def.action}): encodeFields ()`);
return this._encodeFields({ fieldNames, renameMap, includeEmpty: true });
} |
JavaScript | quads(x, y, w, h, cb) {
let t = this,
q = t.q,
hzMid = t.x + t.w / 2,
vtMid = t.y + t.h / 2,
startIsNorth = y < vtMid,
startIsWest = x < hzMid,
endIsEast = x + w > hzMid,
endIsSouth = y + h > vtMid;
// top-right quad
startIsNorth && endIsEast && cb(q[0]);
// top-left quad
startIsWest && startIsNorth && cb(q[1]);
// bottom-left quad
startIsWest && endIsSouth && cb(q[2]);
// bottom-right quad
endIsEast && endIsSouth && cb(q[3]);
} | quads(x, y, w, h, cb) {
let t = this,
q = t.q,
hzMid = t.x + t.w / 2,
vtMid = t.y + t.h / 2,
startIsNorth = y < vtMid,
startIsWest = x < hzMid,
endIsEast = x + w > hzMid,
endIsSouth = y + h > vtMid;
// top-right quad
startIsNorth && endIsEast && cb(q[0]);
// top-left quad
startIsWest && startIsNorth && cb(q[1]);
// bottom-left quad
startIsWest && endIsSouth && cb(q[2]);
// bottom-right quad
endIsEast && endIsSouth && cb(q[3]);
} |
JavaScript | @computed("data", "formattedColumns", "pager.reverse")
get sortedData() {
// server-side sorting
if (this.hasPager) return this.data;
// client-side sorting
let data = this.data.toArray();
let column = this.formattedColumns.findBy("isSorted");
let sortNum = this.formattedColumns.indexOf(column);
if (sortNum >= 0) {
let re = /^[0-9.]+$/;
data.sort(function(a, b) {
a = a.data[sortNum].value;
b = b.data[sortNum].value;
if (re.test(a) && re.test(b)) {
a = parseFloat(a, 10);
b = parseFloat(b, 10);
}
return (a > b) ? 1 : -1;
});
if (this.pager.reverse) {
data.reverseObjects();
}
}
return data;
} | @computed("data", "formattedColumns", "pager.reverse")
get sortedData() {
// server-side sorting
if (this.hasPager) return this.data;
// client-side sorting
let data = this.data.toArray();
let column = this.formattedColumns.findBy("isSorted");
let sortNum = this.formattedColumns.indexOf(column);
if (sortNum >= 0) {
let re = /^[0-9.]+$/;
data.sort(function(a, b) {
a = a.data[sortNum].value;
b = b.data[sortNum].value;
if (re.test(a) && re.test(b)) {
a = parseFloat(a, 10);
b = parseFloat(b, 10);
}
return (a > b) ? 1 : -1;
});
if (this.pager.reverse) {
data.reverseObjects();
}
}
return data;
} |
JavaScript | function onRequest(request, response) {
var path = request.url;
system.stderr.writeLine('Serving ' + path);
if (path == VIRTUAL_PAGE) {
response.writeHead(200, {
'Cache': 'no-cache',
'Content-Type': 'text/html;charset=utf-8'
});
response.write(virtualPageHtml);
response.closeGracefully();
} else if (path.indexOf(RUNFILES_PREFIX) == 0) {
path = '../' + path.substr(RUNFILES_PREFIX.length);
if (!fs.exists(path)) {
send404(request, response);
return;
}
var contentType = guessContentType(path);
var mode = undefined;
if (contentType.indexOf('charset') != -1) {
response.setEncoding('binary');
mode = 'b';
}
response.writeHead(200, {
'Cache': 'no-cache',
'Content-Type': contentType
});
response.write(fs.read(path, mode));
response.closeGracefully();
} else {
send404(request, response);
}
} | function onRequest(request, response) {
var path = request.url;
system.stderr.writeLine('Serving ' + path);
if (path == VIRTUAL_PAGE) {
response.writeHead(200, {
'Cache': 'no-cache',
'Content-Type': 'text/html;charset=utf-8'
});
response.write(virtualPageHtml);
response.closeGracefully();
} else if (path.indexOf(RUNFILES_PREFIX) == 0) {
path = '../' + path.substr(RUNFILES_PREFIX.length);
if (!fs.exists(path)) {
send404(request, response);
return;
}
var contentType = guessContentType(path);
var mode = undefined;
if (contentType.indexOf('charset') != -1) {
response.setEncoding('binary');
mode = 'b';
}
response.writeHead(200, {
'Cache': 'no-cache',
'Content-Type': contentType
});
response.write(fs.read(path, mode));
response.closeGracefully();
} else {
send404(request, response);
}
} |
JavaScript | function send404(request, response) {
system.stderr.writeLine('NOT FOUND ' + request.url);
response.writeHead(404, {
'Cache': 'no-cache',
'Content-Type': 'text/plain;charset=utf-8'
});
response.write('Not Found');
response.closeGracefully();
} | function send404(request, response) {
system.stderr.writeLine('NOT FOUND ' + request.url);
response.writeHead(404, {
'Cache': 'no-cache',
'Content-Type': 'text/plain;charset=utf-8'
});
response.write('Not Found');
response.closeGracefully();
} |
JavaScript | function onConsoleMessage(message, line, source) {
message = message.replace(/\r?\n/, '\n-> ');
if (line && source) {
system.stderr.writeLine('-> ' + source + ':' + line + '] ' + message);
} else {
system.stderr.writeLine('-> ' + message);
}
} | function onConsoleMessage(message, line, source) {
message = message.replace(/\r?\n/, '\n-> ');
if (line && source) {
system.stderr.writeLine('-> ' + source + ':' + line + '] ' + message);
} else {
system.stderr.writeLine('-> ' + message);
}
} |
JavaScript | function onLoadFinished(status) {
if (status != 'success') {
system.stderr.writeLine('Load Failed: ' + status);
retry();
}
} | function onLoadFinished(status) {
if (status != 'success') {
system.stderr.writeLine('Load Failed: ' + status);
retry();
}
} |
JavaScript | function onCallback(succeeded) {
page.close();
if (succeeded) {
phantom.exit();
} else {
phantom.exit(1);
}
} | function onCallback(succeeded) {
page.close();
if (succeeded) {
phantom.exit();
} else {
phantom.exit(1);
}
} |
JavaScript | function retry() {
page.close();
server.close();
if (++flakes == 3) {
system.stderr.writeLine('too many flakes; giving up');
phantom.exit(1);
}
main();
} | function retry() {
page.close();
server.close();
if (++flakes == 3) {
system.stderr.writeLine('too many flakes; giving up');
phantom.exit(1);
}
main();
} |
JavaScript | function main() {
// construct the web page
var body = fs.read(system.args[1]);
if (body.match(/^<!/)) {
system.stderr.writeLine('ERROR: Test html file must not have a doctype');
phantom.exit(1);
}
var html = ['<!doctype html>', body];
html.push('<script>\n' +
' // goog.require does not need to fetch sources from the local\n' +
' // server because everything is being loaded explicitly below\n' +
' var CLOSURE_NO_DEPS = true;\n' +
' var CLOSURE_UNCOMPILED_DEFINES = {\n' +
// TODO(hochhaus): Set goog.ENABLE_DEBUG_LOADER=false
// https://github.com/google/closure-compiler/issues/1815
// ' "goog.ENABLE_DEBUG_LOADER": false\n' +
' };\n' +
'</script>\n');
for (var i = 2; i < system.args.length; i++) {
var js = system.args[i];
html.push('<script src="' + RUNFILES_PREFIX + js + '"></script>\n');
}
virtualPageHtml = html.join('');
// start a local webserver
var port = Math.floor(Math.random() * (60000 - 32768)) + 32768;
server = webserver.create();
server.listen('127.0.0.1:' + port, onRequest);
url = 'http://localhost:' + port + VIRTUAL_PAGE;
system.stderr.writeLine('Listening ' + url);
// run the web page
page = webpage.create();
page.onAlert = onAlert;
page.onCallback = onCallback;
page.onConsoleMessage = onConsoleMessage;
page.onError = onError;
page.onLoadFinished = onLoadFinished;
page.onResourceTimeout = onResourceTimeout;
// XXX: If PhantomJS croaks, fail sooner rather than later.
// https://github.com/ariya/phantomjs/issues/10652
page.settings.resourceTimeout = 2000;
page.open(url);
} | function main() {
// construct the web page
var body = fs.read(system.args[1]);
if (body.match(/^<!/)) {
system.stderr.writeLine('ERROR: Test html file must not have a doctype');
phantom.exit(1);
}
var html = ['<!doctype html>', body];
html.push('<script>\n' +
' // goog.require does not need to fetch sources from the local\n' +
' // server because everything is being loaded explicitly below\n' +
' var CLOSURE_NO_DEPS = true;\n' +
' var CLOSURE_UNCOMPILED_DEFINES = {\n' +
// TODO(hochhaus): Set goog.ENABLE_DEBUG_LOADER=false
// https://github.com/google/closure-compiler/issues/1815
// ' "goog.ENABLE_DEBUG_LOADER": false\n' +
' };\n' +
'</script>\n');
for (var i = 2; i < system.args.length; i++) {
var js = system.args[i];
html.push('<script src="' + RUNFILES_PREFIX + js + '"></script>\n');
}
virtualPageHtml = html.join('');
// start a local webserver
var port = Math.floor(Math.random() * (60000 - 32768)) + 32768;
server = webserver.create();
server.listen('127.0.0.1:' + port, onRequest);
url = 'http://localhost:' + port + VIRTUAL_PAGE;
system.stderr.writeLine('Listening ' + url);
// run the web page
page = webpage.create();
page.onAlert = onAlert;
page.onCallback = onCallback;
page.onConsoleMessage = onConsoleMessage;
page.onError = onError;
page.onLoadFinished = onLoadFinished;
page.onResourceTimeout = onResourceTimeout;
// XXX: If PhantomJS croaks, fail sooner rather than later.
// https://github.com/ariya/phantomjs/issues/10652
page.settings.resourceTimeout = 2000;
page.open(url);
} |
JavaScript | async function parseJSON(response) {
return response.json().catch(error => {
console.warn(`API Response wasn't JSON serializable:`, error);
throw new Error('API Response was not JSON serializable.');
});
} | async function parseJSON(response) {
return response.json().catch(error => {
console.warn(`API Response wasn't JSON serializable:`, error);
throw new Error('API Response was not JSON serializable.');
});
} |
JavaScript | async function createRequest({ method = 'GET', endpoint = '', data = null }) {
const url = `${Config.API_URL}/${endpoint}`;
const params = {
method,
headers: {
'Content-Type': 'application/json',
'x-access-token': Cookie.get('qc-token'),
},
mode: 'cors',
};
if (data) {
params.body = JSON.stringify(data);
}
if (!Cookie.get('qc-token')) {
return Promise.reject();
}
return fetch(url, params);
} | async function createRequest({ method = 'GET', endpoint = '', data = null }) {
const url = `${Config.API_URL}/${endpoint}`;
const params = {
method,
headers: {
'Content-Type': 'application/json',
'x-access-token': Cookie.get('qc-token'),
},
mode: 'cors',
};
if (data) {
params.body = JSON.stringify(data);
}
if (!Cookie.get('qc-token')) {
return Promise.reject();
}
return fetch(url, params);
} |
JavaScript | function classActive() {
document
.querySelector('nav a[href^="/' + location.pathname.split('/')[1] + '"]')
.classList.add('active');
} | function classActive() {
document
.querySelector('nav a[href^="/' + location.pathname.split('/')[1] + '"]')
.classList.add('active');
} |
JavaScript | static get defaultOptions() {
const options = super.defaultOptions;
options.template = "public/modules/ffg-roller/templates/roller-window.html";
options.width = 150;
options.height = "auto";
return options;
} | static get defaultOptions() {
const options = super.defaultOptions;
options.template = "public/modules/ffg-roller/templates/roller-window.html";
options.width = 150;
options.height = "auto";
return options;
} |
JavaScript | chatResultFace(faces) {
let output = "";
let src = "";
let path = "modules/ffg-roller/images/";
let imgTag = '<img src="fPath" width="36" height="36"/>';
//ability dice
for (let i = 0; i < faces.abil.length; i++) {
if (faces.abil[i] > 0) {
switch (i) {
case 0:
src = path + "Ability_Blank.png";
break;
case 1:
src = path + "Ability_Success.png";
break;
case 2:
src = path + "Ability_Success_2.png";
break;
case 3:
src = path + "Ability_Advantage.png";
break;
case 4:
src = path + "Ability_Advantage_2.png";
break;
case 5:
src = path + "Ability_Combo.png";
break;
default:
break;
}
for (let j = faces.abil[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//proficiency dice
for (let i = 0; i < faces.prof.length; i++) {
if (faces.prof[i] > 0) {
switch (i) {
case 0:
src = path + "Proficiency_Blank.png";
break;
case 1:
src = path + "Proficiency_Success.png";
break;
case 2:
src = path + "Proficiency_Success_2.png";
break;
case 3:
src = path + "Proficiency_Advantage.png";
break;
case 4:
src = path + "Proficiency_Advantage_2.png";
break;
case 5:
src = path + "Proficiency_Combo.png";
break;
case 6:
src = path + "Proficiency_Triumph.png";
break;
default:
break;
}
for (let j = faces.prof[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Boost dice
for (let i = 0; i < faces.boost.length; i++) {
if (faces.boost[i] > 0) {
switch (i) {
case 0:
src = path + "Boost_Blank.png";
break;
case 1:
src = path + "Boost_Success.png";
break;
case 2:
src = path + "Boost_Advantage.png";
break;
case 3:
src = path + "Boost_Advantage_2.png";
break;
case 4:
src = path + "Boost_Combo.png";
break;
default:
break;
}
for (let j = faces.boost[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//difficulty dice
for (let i = 0; i < faces.diff.length; i++) {
if (faces.diff[i] > 0) {
switch (i) {
case 0:
src = path + "Difficulty_Blank.png";
break;
case 1:
src = path + "Difficulty_Fail.png";
break;
case 2:
src = path + "Difficulty_Fail_2.png";
break;
case 3:
src = path + "Difficulty_Threat.png";
break;
case 4:
src = path + "Difficulty_Threat_2.png";
break;
case 5:
src = path + "Difficulty_Combo.png";
break;
default:
break;
}
for (let j = faces.diff[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Challenge dice
for (let i = 0; i < faces.chal.length; i++) {
if (faces.chal[i] > 0) {
switch (i) {
case 0:
src = path + "Challenge_Blank.png";
break;
case 1:
src = path + "Challenge_Fail.png";
break;
case 2:
src = path + "Challenge_Fail_2.png";
break;
case 3:
src = path + "Challenge_Threat.png";
break;
case 4:
src = path + "Challenge_Threat_2.png";
break;
case 5:
src = path + "Challenge_Combo.png";
break;
case 6:
src = path + "Challenge_Dispair.png";
break;
default:
break;
}
for (let j = faces.chal[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Setback dice
for (let i = 0; i < faces.setback.length; i++) {
if (faces.setback[i] > 0) {
switch (i) {
case 0:
src = path + "Setback_Blank.png";
break;
case 1:
src = path + "Setback_Fail.png";
break;
case 2:
src = path + "Setback_Threat.png";
break;
default:
break;
}
for (let j = faces.setback[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Force dice
for (let i = 0; i < faces.force.length; i++) {
if (faces.force[i] > 0) {
switch (i) {
case 0:
src = path + "Force_1B.png";
break;
case 1:
src = path + "Force_2B.png";
break;
case 2:
src = path + "Force_1W.png";
break;
case 3:
src = path + "Force_2W.png";
break;
default:
break;
}
for (let j = faces.force[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
return output;
} //end chatResultFace | chatResultFace(faces) {
let output = "";
let src = "";
let path = "modules/ffg-roller/images/";
let imgTag = '<img src="fPath" width="36" height="36"/>';
//ability dice
for (let i = 0; i < faces.abil.length; i++) {
if (faces.abil[i] > 0) {
switch (i) {
case 0:
src = path + "Ability_Blank.png";
break;
case 1:
src = path + "Ability_Success.png";
break;
case 2:
src = path + "Ability_Success_2.png";
break;
case 3:
src = path + "Ability_Advantage.png";
break;
case 4:
src = path + "Ability_Advantage_2.png";
break;
case 5:
src = path + "Ability_Combo.png";
break;
default:
break;
}
for (let j = faces.abil[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//proficiency dice
for (let i = 0; i < faces.prof.length; i++) {
if (faces.prof[i] > 0) {
switch (i) {
case 0:
src = path + "Proficiency_Blank.png";
break;
case 1:
src = path + "Proficiency_Success.png";
break;
case 2:
src = path + "Proficiency_Success_2.png";
break;
case 3:
src = path + "Proficiency_Advantage.png";
break;
case 4:
src = path + "Proficiency_Advantage_2.png";
break;
case 5:
src = path + "Proficiency_Combo.png";
break;
case 6:
src = path + "Proficiency_Triumph.png";
break;
default:
break;
}
for (let j = faces.prof[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Boost dice
for (let i = 0; i < faces.boost.length; i++) {
if (faces.boost[i] > 0) {
switch (i) {
case 0:
src = path + "Boost_Blank.png";
break;
case 1:
src = path + "Boost_Success.png";
break;
case 2:
src = path + "Boost_Advantage.png";
break;
case 3:
src = path + "Boost_Advantage_2.png";
break;
case 4:
src = path + "Boost_Combo.png";
break;
default:
break;
}
for (let j = faces.boost[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//difficulty dice
for (let i = 0; i < faces.diff.length; i++) {
if (faces.diff[i] > 0) {
switch (i) {
case 0:
src = path + "Difficulty_Blank.png";
break;
case 1:
src = path + "Difficulty_Fail.png";
break;
case 2:
src = path + "Difficulty_Fail_2.png";
break;
case 3:
src = path + "Difficulty_Threat.png";
break;
case 4:
src = path + "Difficulty_Threat_2.png";
break;
case 5:
src = path + "Difficulty_Combo.png";
break;
default:
break;
}
for (let j = faces.diff[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Challenge dice
for (let i = 0; i < faces.chal.length; i++) {
if (faces.chal[i] > 0) {
switch (i) {
case 0:
src = path + "Challenge_Blank.png";
break;
case 1:
src = path + "Challenge_Fail.png";
break;
case 2:
src = path + "Challenge_Fail_2.png";
break;
case 3:
src = path + "Challenge_Threat.png";
break;
case 4:
src = path + "Challenge_Threat_2.png";
break;
case 5:
src = path + "Challenge_Combo.png";
break;
case 6:
src = path + "Challenge_Dispair.png";
break;
default:
break;
}
for (let j = faces.chal[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Setback dice
for (let i = 0; i < faces.setback.length; i++) {
if (faces.setback[i] > 0) {
switch (i) {
case 0:
src = path + "Setback_Blank.png";
break;
case 1:
src = path + "Setback_Fail.png";
break;
case 2:
src = path + "Setback_Threat.png";
break;
default:
break;
}
for (let j = faces.setback[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
//Force dice
for (let i = 0; i < faces.force.length; i++) {
if (faces.force[i] > 0) {
switch (i) {
case 0:
src = path + "Force_1B.png";
break;
case 1:
src = path + "Force_2B.png";
break;
case 2:
src = path + "Force_1W.png";
break;
case 3:
src = path + "Force_2W.png";
break;
default:
break;
}
for (let j = faces.force[i]; j > 0; j--) {
output += imgTag.replace('fPath', src);
}
}
}
return output;
} //end chatResultFace |
JavaScript | chatResultCalc(calcArray) {
let output = "";
let path = "modules/ffg-roller/images/";
let src = "";
for (let i = 0; i < calcArray.length; i++) {
if (calcArray[i] > 0) { //good dice
switch (i) {
case 0:
src = path + "Success.png";
break;
case 1:
src = path + "Advantage.png"
break;
case 2:
src = path + "Triumph.png"
break;
case 3:
src = path + "Dispair.png"//this should never come up this value is neg or 0
break;
case 4:
src = path + "White.png"
break;
case 5:
src = path + "Black.png" //this should never come up this value is neg or 0
break;
default:
break;
}
for (let j = calcArray[i]; j > 0; j--) {
let stringTemp = `<img src="${src}" width="36" height="36"/>`;
output += stringTemp;
}
} else if (calcArray[i] < 0) { //bad dice
switch (i) {
case 0:
src = path + "Fail.png";
break;
case 1:
src = path + "Threat.png"
break;
case 2:
src = path + "Triumph.png"//this should never come up this value is pos or 0
break;
case 3:
src = path + "Dispair.png"
break;
case 4:
src = path + "White.png" //this should never come up this value is pos or 0
break;
case 5:
src = path + "Black.png"
break;
default:
break;
}
for (let j = calcArray[i]; j < 0; j++) {
let stringTemp = `<img src="${src}" width="36" height="36"/>`;
output += stringTemp;
}
}
}
return output;
} //end chatResultCalc | chatResultCalc(calcArray) {
let output = "";
let path = "modules/ffg-roller/images/";
let src = "";
for (let i = 0; i < calcArray.length; i++) {
if (calcArray[i] > 0) { //good dice
switch (i) {
case 0:
src = path + "Success.png";
break;
case 1:
src = path + "Advantage.png"
break;
case 2:
src = path + "Triumph.png"
break;
case 3:
src = path + "Dispair.png"//this should never come up this value is neg or 0
break;
case 4:
src = path + "White.png"
break;
case 5:
src = path + "Black.png" //this should never come up this value is neg or 0
break;
default:
break;
}
for (let j = calcArray[i]; j > 0; j--) {
let stringTemp = `<img src="${src}" width="36" height="36"/>`;
output += stringTemp;
}
} else if (calcArray[i] < 0) { //bad dice
switch (i) {
case 0:
src = path + "Fail.png";
break;
case 1:
src = path + "Threat.png"
break;
case 2:
src = path + "Triumph.png"//this should never come up this value is pos or 0
break;
case 3:
src = path + "Dispair.png"
break;
case 4:
src = path + "White.png" //this should never come up this value is pos or 0
break;
case 5:
src = path + "Black.png"
break;
default:
break;
}
for (let j = calcArray[i]; j < 0; j++) {
let stringTemp = `<img src="${src}" width="36" height="36"/>`;
output += stringTemp;
}
}
}
return output;
} //end chatResultCalc |
JavaScript | function flipCard() {
// If we are already sliding return and do nothing
if (sliding) return;
// Saving primaryCard into oldPrimary because it will change
let oldPrimary = primaryCard;
// Assigning new primary card to the incoming random one
let newPrimary = randomCard();
// However, if we select the existing primary card try again by calling this function again
if (newPrimary == primaryCard) return flipCard();
sliding = true;
// Update primaryCard variable to the new card selected
primaryCard = newPrimary;
primaryCard.className = "card primary sliding";
window.setTimeout(function() {
oldPrimary.className = "card";
primaryCard.className = "card primary";
sliding = false;
}, 600);
} | function flipCard() {
// If we are already sliding return and do nothing
if (sliding) return;
// Saving primaryCard into oldPrimary because it will change
let oldPrimary = primaryCard;
// Assigning new primary card to the incoming random one
let newPrimary = randomCard();
// However, if we select the existing primary card try again by calling this function again
if (newPrimary == primaryCard) return flipCard();
sliding = true;
// Update primaryCard variable to the new card selected
primaryCard = newPrimary;
primaryCard.className = "card primary sliding";
window.setTimeout(function() {
oldPrimary.className = "card";
primaryCard.className = "card primary";
sliding = false;
}, 600);
} |
JavaScript | function initWebSocket() {
var gateway = `ws://${window.location.hostname}/ws`;
console.log(gateway)
websocket = new WebSocket(gateway);
websocket.onopen = onWebSocketOpen;
websocket.onclose = onWebSocketClose;
websocket.onmessage = onWebSocketMessage;
} | function initWebSocket() {
var gateway = `ws://${window.location.hostname}/ws`;
console.log(gateway)
websocket = new WebSocket(gateway);
websocket.onopen = onWebSocketOpen;
websocket.onclose = onWebSocketClose;
websocket.onmessage = onWebSocketMessage;
} |
JavaScript | function hashPassword (user, options) {
if (!user.changed('password')) {
return
}
return bcrypt.hash(user.password, SALT_ROUNDS)
.then(function (hashedPassword) {
user.setDataValue('password', hashedPassword)
})
} | function hashPassword (user, options) {
if (!user.changed('password')) {
return
}
return bcrypt.hash(user.password, SALT_ROUNDS)
.then(function (hashedPassword) {
user.setDataValue('password', hashedPassword)
})
} |
JavaScript | async me(fields, token){
let url = `${host}me?fields=${fields.join(',')}&access_token=${token}`
return new Promise((resolve, reject) => {
request.get(url, (error, result, body) => {
if(error) return reject(error, null)
try{
body = JSON.parse(body)
if(!body || body.error)
return reject('cannot parse object from fb')
resolve(body)
} catch(e) {
Logger.error('Facebook verify token', e)
reject(e)
}
})
})
} | async me(fields, token){
let url = `${host}me?fields=${fields.join(',')}&access_token=${token}`
return new Promise((resolve, reject) => {
request.get(url, (error, result, body) => {
if(error) return reject(error, null)
try{
body = JSON.parse(body)
if(!body || body.error)
return reject('cannot parse object from fb')
resolve(body)
} catch(e) {
Logger.error('Facebook verify token', e)
reject(e)
}
})
})
} |
JavaScript | async verify_token(id, token, cb){
let url = `${host}debug_token?access_token=${app_id}|${app_secret}&input_token=${token}&format=json`
return new Promise((resolve, reject) => {
request.get(url, (error, result, body) => {
if(error) return reject(error)
try{
body = JSON.parse(body)
if(!body || !body.data || (body.data && body.data.error))
return resolve(false)
let { data } = body
resolve(data.user_id == id && data.is_valid)
} catch(e) {
Logger.error('Facebook verify token', e)
reject(e)
}
})
})
} | async verify_token(id, token, cb){
let url = `${host}debug_token?access_token=${app_id}|${app_secret}&input_token=${token}&format=json`
return new Promise((resolve, reject) => {
request.get(url, (error, result, body) => {
if(error) return reject(error)
try{
body = JSON.parse(body)
if(!body || !body.data || (body.data && body.data.error))
return resolve(false)
let { data } = body
resolve(data.user_id == id && data.is_valid)
} catch(e) {
Logger.error('Facebook verify token', e)
reject(e)
}
})
})
} |
JavaScript | function playClueSequence() {
guessCounter = 0;
//set delay to initial wait time
let delay = nextClueWaitTime;
// progress keeps track of which turn we are on
for (let i = 0; i <= progress; i++) {
// for each clue that is revealed so far
console.log("play single clue: " + pattern[i] + " in " + delay + "ms");
setTimeout(playSingleClue, delay, pattern[i]); // set a timeout to play that clue
// keeps running total of how long to play the next clue
delay += clueHoldTime;
delay += cluePauseTime;
}
} | function playClueSequence() {
guessCounter = 0;
//set delay to initial wait time
let delay = nextClueWaitTime;
// progress keeps track of which turn we are on
for (let i = 0; i <= progress; i++) {
// for each clue that is revealed so far
console.log("play single clue: " + pattern[i] + " in " + delay + "ms");
setTimeout(playSingleClue, delay, pattern[i]); // set a timeout to play that clue
// keeps running total of how long to play the next clue
delay += clueHoldTime;
delay += cluePauseTime;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.