Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function availability (options, callback) {
const settings = {
method: 'POST',
path: options.urls.api + '/v1/availability',
headers: {
Authorization: 'Bearer ' + options.access_token,
'Content-Type': 'application/json'
},
entity: _.omit(options, ['access_token'])
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function readEvents (options, callback) {
const settings = {
method: 'GET',
path: options.next_page || options.urls.api + '/v1/events',
headers: {
Authorization: 'Bearer ' + options.access_token
},
params: _.omit(options, 'access_token', 'next_page')
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function freeBusy (options, callback) {
const settings = {
method: 'GET',
path: options.urls.api + '/v1/free_busy',
headers: {
Authorization: 'Bearer ' + options.access_token
},
params: _.omit(options, 'access_token')
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function authorizeWithServiceAccount (options, callback) {
const settings = {
method: 'POST',
path: options.urls.api + `/v1/service_account_authorizations/`,
headers: {
Authorization: 'Bearer ' + options.access_token
},
entity: _.omit(options, ['access_token'])
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function deleteExternalEvent (options, callback) {
const settings = {
method: 'DELETE',
path: options.urls.api + `/v1/calendars/${options.calendar_id}/events`,
headers: {
Authorization: 'Bearer ' + options.access_token
},
entity: _.omit(options, ['access_token', 'calendar_id'])
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function createEvent (options, callback) {
const settings = {
method: 'POST',
path: options.urls.api + `/v1/calendars/${options.calendar_id}/events`,
headers: {
Authorization: 'Bearer ' + options.access_token
},
entity: _.omit(options, ['access_token', 'calendar_id'])
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function deleteNotificationChannel (options, callback) {
const settings = {
method: 'DELETE',
path: options.urls.api + `/v1/channels/${options.channel_id}`,
headers: {
Authorization: 'Bearer ' + options.access_token
}
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function refreshAccessToken (options, callback) {
const settings = {
method: 'POST',
path: options.urls.api + '/oauth/token',
entity: options
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function revokeAuthorization (options, callback) {
const settings = {
method: 'POST',
path: options.urls.api + '/oauth/token/revoke',
entity: options
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}
function profileInformation (options, callback) {
const settings = {
method: 'GET',
path: options.urls.api + '/v1/profiles',
headers: {
Authorization: 'Bearer ' + options.access_token
}
};
const result = rest(settings).fold(reach, 'entity');
return nodefn.bindCallback(result, callback);
}