src/sessions/sessionAPI.js
function genSession (baseUrl, devId, authHash, platform) {
  let url = baseUrl + 'createsessionjson/' + devId + '/' +
    authHash + '/' + util.getUtcTime()
  return new Promise((resolve, reject) => {
    request(url, (error, response, body) => {
      if (!error && response.statusCode === 200) {
        let sessionID = JSON.parse(body)
        switch (platform) {
          case 'smitePC':
            process.env.SMITE_PC_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'smiteXBOX':
            process.env.SMITE_XBOX_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'smitePS4':
            process.env.SMITE_PS4_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'paladinsPC':
            process.env.PALADINS_PC_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'paladinsXBOX':
            process.env.PALADINS_XBOX_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'paladinsPS4':
            process.env.PALADINS_PS4_SESSION = sessionID.session_id
            resolve(sessionID)
        }
      } else {
        reject(error)
      }
    })
  })
}
function genSession (baseUrl, devId, authHash, platform) {
  let url = baseUrl + 'createsessionjson/' + devId + '/' +
    authHash + '/' + util.getUtcTime()
  return new Promise((resolve, reject) => {
    request(url, (error, response, body) => {
      if (!error && response.statusCode === 200) {
        let sessionID = JSON.parse(body)
        switch (platform) {
          case 'smitePC':
            process.env.SMITE_PC_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'smiteXBOX':
            process.env.SMITE_XBOX_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'smitePS4':
            process.env.SMITE_PS4_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'paladinsPC':
            process.env.PALADINS_PC_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'paladinsXBOX':
            process.env.PALADINS_XBOX_SESSION = sessionID.session_id
            resolve(sessionID)
            break
          case 'paladinsPS4':
            process.env.PALADINS_PS4_SESSION = sessionID.session_id
            resolve(sessionID)
        }
      } else {
        reject(error)
      }
    })
  })
}
function genSession ( baseUrl , devId , authHash , platform ) { let url = baseUrl + 'createsessionjson/' + devId + '/' + authHash + '/' + util . getUtcTime ( ) return new Promise ( ( resolve , reject ) => { request ( url , ( error , response , body ) => { if ( ! error && response . statusCode === 200 ) { let sessionID = JSON . parse ( body ) switch ( platform ) { case 'smitePC' : process . env . SMITE_PC_SESSION = sessionID . session_id resolve ( sessionID ) break case 'smiteXBOX' : process . env . SMITE_XBOX_SESSION = sessionID . session_id resolve ( sessionID ) break case 'smitePS4' : process . env . SMITE_PS4_SESSION = sessionID . session_id resolve ( sessionID ) break case 'paladinsPC' : process . env . PALADINS_PC_SESSION = sessionID . session_id resolve ( sessionID ) break case 'paladinsXBOX' : process . env . PALADINS_XBOX_SESSION = sessionID . session_id resolve ( sessionID ) break case 'paladinsPS4' : process . env . PALADINS_PS4_SESSION = sessionID . session_id resolve ( sessionID ) } } else { reject ( error ) } } ) } ) }
Generate a new Session
Generate a new Session