lib/push/push.js
function registerPushDevice(registrationId, options) {
    if (options === void 0) { options = {}; }
    var user = server.getCurrentAuthorization().name;
    var pushInitOptions = init.initOptions.push;
    return device.ready.then(function (info) {
        var providerType;
        switch (info.platform.id) {
            case 'android':
                providerType = 'GCM';
                break;
            case 'ios':
                // when a senderID is configured,
                // iOS device is registered at APNS which generates a token registered in turn at GCM,
                // so that pushes are send using GCM to either type of device.
                providerType = pushInitOptions.ios.senderID ? 'GCM' : 'APNS';
                break;
            case 'windowsphone':
                providerType = 'WNS';
                break;
            case 'blackberry':
                providerType = 'PAP';
                break;
            default:
                providerType = 'MCAP';
                break;
        }
        diag.debug.assert(!!info.device, 'The current implementation supports mobile devices only!');
        return {
            uuid: null,
            providerType: providerType,
            token: registrationId,
            user: user,
            deviceIdentifier: info.uuid,
            vendor: info.device.manufacturer,
            name: info.device.name,
            osVersion: info.device.version,
            model: info.device.model,
            type: info.device.name,
            appPackageName: info.device.appIdentifier,
            appVersion: info.device.appVersionCode || info.device.appVersionName,
            attributes: options.attributes,
            tags: options.tags,
            badge: options.badge
        };
    }).then(function (device) {
        diag.debug.assert(device.providerType !== 'PAP', 'Relution Server does not yet support this!');
        diag.debug.assert(device.providerType !== 'MCAP', 'Relution SDK does not yet implement this!');
        return web.post(pushUrl + '/registration', device);
    });
}
function registerPushDevice(registrationId, options) {
    if (options === void 0) { options = {}; }
    var user = server.getCurrentAuthorization().name;
    var pushInitOptions = init.initOptions.push;
    return device.ready.then(function (info) {
        var providerType;
        switch (info.platform.id) {
            case 'android':
                providerType = 'GCM';
                break;
            case 'ios':
                // when a senderID is configured,
                // iOS device is registered at APNS which generates a token registered in turn at GCM,
                // so that pushes are send using GCM to either type of device.
                providerType = pushInitOptions.ios.senderID ? 'GCM' : 'APNS';
                break;
            case 'windowsphone':
                providerType = 'WNS';
                break;
            case 'blackberry':
                providerType = 'PAP';
                break;
            default:
                providerType = 'MCAP';
                break;
        }
        diag.debug.assert(!!info.device, 'The current implementation supports mobile devices only!');
        return {
            uuid: null,
            providerType: providerType,
            token: registrationId,
            user: user,
            deviceIdentifier: info.uuid,
            vendor: info.device.manufacturer,
            name: info.device.name,
            osVersion: info.device.version,
            model: info.device.model,
            type: info.device.name,
            appPackageName: info.device.appIdentifier,
            appVersion: info.device.appVersionCode || info.device.appVersionName,
            attributes: options.attributes,
            tags: options.tags,
            badge: options.badge
        };
    }).then(function (device) {
        diag.debug.assert(device.providerType !== 'PAP', 'Relution Server does not yet support this!');
        diag.debug.assert(device.providerType !== 'MCAP', 'Relution SDK does not yet implement this!');
        return web.post(pushUrl + '/registration', device);
    });
}
function registerPushDevice ( registrationId , options ) { if ( options === void 0 ) { options = { } ; } var user = server . getCurrentAuthorization ( ) . name ; var pushInitOptions = init . initOptions . push ; return device . ready . then ( function ( info ) { var providerType ; switch ( info . platform . id ) { case 'android' : providerType = 'GCM' ; break ; case 'ios' : // when a senderID is configured, // iOS device is registered at APNS which generates a token registered in turn at GCM, // so that pushes are send using GCM to either type of device. providerType = pushInitOptions . ios . senderID ? 'GCM' : 'APNS' ; break ; case 'windowsphone' : providerType = 'WNS' ; break ; case 'blackberry' : providerType = 'PAP' ; break ; default : providerType = 'MCAP' ; break ; } diag . debug . assert ( ! ! info . device , 'The current implementation supports mobile devices only!' ) ; return { uuid : null , providerType : providerType , token : registrationId , user : user , deviceIdentifier : info . uuid , vendor : info . device . manufacturer , name : info . device . name , osVersion : info . device . version , model : info . device . model , type : info . device . name , appPackageName : info . device . appIdentifier , appVersion : info . device . appVersionCode || info . device . appVersionName , attributes : options . attributes , tags : options . tags , badge : options . badge } ; } ) . then ( function ( device ) { diag . debug . assert ( device . providerType !== 'PAP' , 'Relution Server does not yet support this!' ) ; diag . debug . assert ( device . providerType !== 'MCAP' , 'Relution SDK does not yet implement this!' ) ; return web . post ( pushUrl + '/registration' , device ) ; } ) ; }
registers a target device with the current Relution server.

The implementation relies on backend code generated by CLI. That code attempts fetching an
existing device using the metadata information send as request body data. If it finds one, that
device is updated. Otherwise a new device is created and stored in the database. The updated
device registration record then is sent as response body data.

@param registrationId to register.
@return promise of registered device.

@internal SDK client code must call configurePushDevice() which obtains the token.
registers a target device with the current Relution server .