async function whoOnCall(authData) {
  // Init our PD client
  const { pagerDutyKey } = authData
  pd.initializePagerDuty(pagerDutyKey)

  // Pretty print the on call users for each policy
  // Concatenated strings before printing for ux.print
  const onCalls = await pd.getOnCall()
  Object.keys(onCalls).forEach(async policy => {
    const policyTitle = magenta(
      `\nThe following people are on call for the '${policy}' policy:\n`
    )
    const policyDetails = onCalls[policy].map(person => {
      let personStr = `\n\t${person.name} - Escalation Level: ${person.escalation_level}`
      if (person.end) {
        const endingTime = new Date(person.end)
        const formattedTimeStamp = endingTime.toUTCString()
        personStr += `\n\t${callOutCyan(
          `Rotational on-call ending on: ${formattedTimeStamp}`
        )}`
      }
      return personStr
    })
    await ux.print(`${policyTitle}${policyDetails.join('')}`)
  })
}
/**
 * whoOnCall retrieves users on call with PagerDuty and prints them out
 *
 * @param {object} authData The user's entered auth data
 */
whoOnCall retrieves users on call with PagerDuty and prints them out
@param {object} authData The user's entered auth data
whoOnCall retrieves users on call with PagerDuty and prints them out @param { object } authData The user ' s entered auth data
async function whoOnCall(authData) {
  const { pagerDutyKey } = authData
  pd.initializePagerDuty(pagerDutyKey)
  const onCalls = await pd.getOnCall()
  Object.keys(onCalls).forEach(async policy => {
    const policyTitle = magenta(
      `\nThe following people are on call for the '${policy}' policy:\n`
    )
    const policyDetails = onCalls[policy].map(person => {
      let personStr = `\n\t${person.name} - Escalation Level: ${person.escalation_level}`
      if (person.end) {
        const endingTime = new Date(person.end)
        const formattedTimeStamp = endingTime.toUTCString()
        personStr += `\n\t${callOutCyan(
          `Rotational on-call ending on: ${formattedTimeStamp}`
        )}`
      }
      return personStr
    })
    await ux.print(`${policyTitle}${policyDetails.join('')}`)
  })
}
async function whoOnCall ( authData ) { const { pagerDutyKey } = authData pd . initializePagerDuty ( pagerDutyKey ) const onCalls = await pd . getOnCall ( ) Object . keys ( onCalls ) . forEach ( async policy => { const policyTitle = magenta ( ` \n ${ policy } \n ` ) const policyDetails = onCalls [ policy ] . map ( person => { let personStr = ` \n \t ${ person . name } ${ person . escalation_level } ` if ( person . end ) { const endingTime = new Date ( person . end ) const formattedTimeStamp = endingTime . toUTCString ( ) personStr += ` \n \t ${ callOutCyan ( ` ${ formattedTimeStamp } ` ) } ` } return personStr } ) await ux . print ( ` ${ policyTitle } ${ policyDetails . join ( '' ) } ` ) } ) }
whoOnCall retrieves users on call with PagerDuty and prints them out
 @param {object} authData The user's entered auth data
whoOnCall retrieves users on call with PagerDuty and prints them out @param { object } authData The user ' s entered auth data
// Init our PD client // Pretty print the on call users for each policy // Concatenated strings before printing for ux.print