query groupEvents(
  $urlname: String!
  $cursor: String
  $first: Int = 1000
  $status: [EventStatus!]
  $date_after: DateTime
  $date_before: DateTime
) {
  groupByUrlname(urlname: $urlname) {
    id
    name
    events(
      after: $cursor
      first: $first
      filter: {
        status: $status
        afterDateTime: $date_after
        beforeDateTime: $date_before
      }
    ) {
      pageInfo {
        hasNextPage
        endCursor
      }
      totalCount
      edges {
        cursor
        node {
          ...eventFields
        }
      }
    }
  }
}

fragment eventFields on Event {
  id
  title
  eventUrl
  createdTime
  status
  dateTime
  duration
  description
  
  group {
    id
    name
    urlname
  }
  
  venues {
    id
    name
    address
    city
    state
    postalCode
    country
    lat
    lon
    venueType
  }
  
  rsvps(first: 1) {
    totalCount
  }
  
  featuredEventPhoto {
    baseUrl
  }
  
  feeSettings {
    required
    amount
    currency
    accepts
    refundPolicy {
      notes
      days
    }
  }
  
  << extra_graphql >>
}