module.exports = async function listApisAction(args, context) {
  const {apiClient, output, chalk} = context

  const client = apiClient({
    requireUser: true,
    requireProject: true
  })

  let endpoints
  try {
    endpoints = await client.request({
      url: `/apis/graphql`,
      method: 'GET'
    })
  } catch (err) {
    throw err
  }

  if (endpoints && endpoints.length > 0) {
    output.print('Here are the GraphQL endpoints deployed for this project:')
    endpoints.forEach((endpoint, index) => {
      output.print(`${index + 1}.  ${chalk.bold('Dataset:')}     ${endpoint.dataset}`)
      output.print(`    ${chalk.bold('Tag:')}         ${endpoint.tag}`)
      output.print(`    ${chalk.bold('Generation:')}  ${endpoint.generation}`)
      output.print(`    ${chalk.bold('Playground:')}  ${endpoint.playgroundEnabled}\n`)
    })
  } else {
    output.print("This project doesn't have any GraphQL endpoints deployed.")
  }
}

@@ -507,16 +507,116 @@
 x) =%3E %7B%0A
+      const %7Bdataset, tag%7D = endpoint%0A      const url = client.getUrl(%60graphql/$%7Bdataset%7D/$%7Btag%7D%60)%0A%0A
       ou
@@ -674,25 +674,16 @@
 %7D     $%7B
-endpoint.
 dataset%7D
@@ -741,25 +741,16 @@
       $%7B
-endpoint.
 tag%7D%60)%0A 
@@ -910,16 +910,72 @@
 Enabled%7D
+%60)%0A      output.print(%60    $%7Bchalk.bold('URL:')%7D  $%7Burl%7D
 %5Cn%60)%0A   

Add GraphQL endpoint URL to `sanity graphql list` action (#1905)