How to use the when/node.bindCallback function in when

To help you get started, we’ve selected a few when examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cronofy / cronofy-node / src / methods / availability.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / read-events.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / free-busy.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / authorize-with-service-account.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / delete-external-event.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / create-event.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / delete-notification-channel.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / refresh-access-token.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / revoke-authorization.js View on Github external
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);
}
github cronofy / cronofy-node / src / methods / profile-information.js View on Github external
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);
}