lib/applications.js
function bootstrap (client) {
  return function bootstrap (pushApp) {
    const req = {
      url: `${client.baseUrl}/rest/applications/bootstrap`,
      method: 'POST'
    };

    const data = pushApp;

    // If they send in a string, then lets assume that is the location of the cert file
    // Otherwise, we will assume it is a Stream or Buffer and can just pass it along
    if (data.iosVariantName) {
      if (typeof data.iosCertificate === 'string') {
        data.iosCertificate = fs.createReadStream(data.iosCertificate);
      }

      data.iosProduction = data.iosProduction ? 'true' : 'false';
    }

    req.formData = data;

    return request(client, req)
      .then((response) => {
        if (response.resp.statusCode !== 201) {
          return Promise.reject(response.body);
        }

        return Promise.resolve(response.body);
      });
  };
}
function bootstrap (client) {
  return function bootstrap (pushApp) {
    const req = {
      url: `${client.baseUrl}/rest/applications/bootstrap`,
      method: 'POST'
    };

    const data = pushApp;

    // If they send in a string, then lets assume that is the location of the cert file
    // Otherwise, we will assume it is a Stream or Buffer and can just pass it along
    if (data.iosVariantName) {
      if (typeof data.iosCertificate === 'string') {
        data.iosCertificate = fs.createReadStream(data.iosCertificate);
      }

      data.iosProduction = data.iosProduction ? 'true' : 'false';
    }

    req.formData = data;

    return request(client, req)
      .then((response) => {
        if (response.resp.statusCode !== 201) {
          return Promise.reject(response.body);
        }

        return Promise.resolve(response.body);
      });
  };
}
function bootstrap ( client ) { return function bootstrap ( pushApp ) { const req = { url : ` ${ client . baseUrl } ` , method : 'POST' } ; const data = pushApp ; // If they send in a string, then lets assume that is the location of the cert file // Otherwise, we will assume it is a Stream or Buffer and can just pass it along if ( data . iosVariantName ) { if ( typeof data . iosCertificate === 'string' ) { data . iosCertificate = fs . createReadStream ( data . iosCertificate ) ; } data . iosProduction = data . iosProduction ? 'true' : 'false' ; } req . formData = data ; return request ( client , req ) . then ( ( response ) => { if ( response . resp . statusCode !== 201 ) { return Promise . reject ( response . body ) ; } return Promise . resolve ( response . body ) ; } ) ; } ; }
A Convenience function to create a complete Push Application with a set of variants
@param {object} pushApp - The push application object
@param {string} pushApp.pushApplicationName - The name of the Push Application
@param {string} [pushApp.androidVariantName] - Android Variant Name
@param {string} [pushApp.androidGoogleKey] - The Google Cloud Messaging Key. Required For Android
@param {string} [pushApp.androidProjectNumber] - The Google Project Number
@param {string} [pushApp.iosVariantName] - iOS Variant Name
@param {string} [pushApp.iosProduction] - defaults to false - flag to indicate if a connection to Apples production or sandbox APNS server
@param {string} [pushApp.iosPassphrase] - The APNs passphrase that is needed to establish a connection to any of Apple's APNs Push Servers.
@param {string|Buffer|Stream} [pushApp.iosCertificate] - the full location of the APNs certificate that is needed to establish a connection to any of Apple's APNs Push Servers.
@param {string} [pushApp.windowsType] - mpns or wns
@param {string} [pushApp.windowsVariantName] - Windows Variant Name
@param {string} [pushApp.windowsSid] - *for wns only* - (Package security identifier) used to connect to the windows push notification services
@param {string} [pushApp.windowsClientSecret] - *for wns only* - The client secret (password) to connect to the windows push notification services
@param {string} [pushApp.simplePushVariantName] - SimplePush Variant Name
@param {string} [pushApp.admVariantName] - Amazon Variant Name
@param {string} [pushApp.admClientId] - The client id to connect to the Amazon Device Messaging services
@param {string} [pushApp.admClientSecret] - The client secret (password) to connect to the Amazon Device Messaging services
@returns {Promise} A promise that resolves with the update Push Application
@example
adminClient(baseUrl, settings)
.then((client) => {
client.applications.boostrap(pushApp)
.then((pushApplicaiton) => {
console.log(pushApplication); // {...}
})
})
A Convenience function to create a complete Push Application with a set of variants