# Welcome to the SourceHut GraphQL explorer!
# You can use this to run test requests against the GraphQL API.
# To view the GraphQL schema, expand the button on the bottom of this page.
# Here's a sample query to get you started:
query {
  # Fetch info about the authenticated user (you):
  me {
    # Grab their canonical name:
    canonicalName
    # And a list of repositories:
    repositories(filter: { count: 5 }) {
      # This resource is paginated, so it has a cursor. If you pass this value
      # into repositories(cursor:"...") in a subsequent request, you'll get the
      # next page.
      cursor
      # These are the actual results. Grab the resource id, name, and updated
      # fields from each repository.
      results {
        rid, name, updated
      }
    }
  }

  # Also fetch the API version. Please note that the GraphQL API is considered
  # experimental: as long as this returns 0.0.0, the API is subject to change
  # without notice.
  version {
    major, minor, patch
  }

  # The same results as with this Web utility you can get with `hut`
  # utility (https://sr.ht/~xenrox/hut/)
  #
  # echo 'query { me { canonicalName } }' | hut graphql git
  #
  # Or, use `hut graphql git` to edit GraphQL queries with
  # your $EDITOR.
}
