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

  // Get query information from the user
  const query = await getSearchQuery()
  // Prompt returns values in title case for UX readability. API only accepts lowercase values.
  query.statuses = query.statuses.map(status => status.toLowerCase())
  query.urgencies = query.urgencies.map(urgency => urgency.toLowerCase())
  await ux.spinner.start('🏃‍  Retrieving incidents')
  const incidents = await pd.getIncidents(query)

  // Nothing found; return early
  if (!incidents.length) {
    await ux.spinner.stop(magenta('🤷‍  No incidents found!'))
    return incidents
  }

  await ux.spinner.stop('✅  Retrieved incidents!')
  const titleStr = magenta('\nHere are the retrieved incidents:')
  const incidentsStr = incidents.map(printIncident)
  await ux.print(`${titleStr}\n${incidentsStr.join('')}`)
  await handleSuccess('Search Incidents', query)
}
/**
 * searchIncidents gathers a user query for incidents, executes it, and prints
 * the results.
 *
 * @param {object} authData The user's entered auth data
 * @param {object} user     The current SDK user
 */
searchIncidents gathers a user query for incidents, executes it, and prints
the results.

@param {object} authData The user's entered auth data
@param {object} user     The current SDK user
searchIncidents gathers a user query for incidents executes it and prints the results . @param { object } authData The user ' s entered auth data @param { object } user The current SDK user
async function searchIncidents(authData) {
  const { pagerDutyKey } = authData
  pd.initializePagerDuty(pagerDutyKey)
  const query = await getSearchQuery()
  query.statuses = query.statuses.map(status => status.toLowerCase())
  query.urgencies = query.urgencies.map(urgency => urgency.toLowerCase())
  await ux.spinner.start('🏃‍  Retrieving incidents')
  const incidents = await pd.getIncidents(query)
  if (!incidents.length) {
    await ux.spinner.stop(magenta('🤷‍  No incidents found!'))
    return incidents
  }
  await ux.spinner.stop('✅  Retrieved incidents!')
  const titleStr = magenta('\nHere are the retrieved incidents:')
  const incidentsStr = incidents.map(printIncident)
  await ux.print(`${titleStr}\n${incidentsStr.join('')}`)
  await handleSuccess('Search Incidents', query)
}
async function searchIncidents ( authData ) { const { pagerDutyKey } = authData pd . initializePagerDuty ( pagerDutyKey ) const query = await getSearchQuery ( ) query . statuses = query . statuses . map ( status => status . toLowerCase ( ) ) query . urgencies = query . urgencies . map ( urgency => urgency . toLowerCase ( ) ) await ux . spinner . start ( '🏃‍  Retrieving incidents') const incidents = await pd . getIncidents ( query ) if ( ! incidents . length ) { await ux . spinner . stop ( magenta ( '🤷‍  No incidents found!')) return incidents } await ux . spinner . stop ( '✅  Retrieved incidents!') const titleStr = magenta ( '\nHere are the retrieved incidents:' ) const incidentsStr = incidents . map ( printIncident ) await ux . print ( ` ${ titleStr } \n ${ incidentsStr . join ( '' ) } ` ) await handleSuccess ( 'Search Incidents' , query ) }
searchIncidents gathers a user query for incidents, executes it, and prints
 the results.
searchIncidents gathers a user query for incidents executes it and prints the results .
// Init our PD client // Get query information from the user // Prompt returns values in title case for UX readability. API only accepts lowercase values. // Nothing found; return early