def get_all(name = nil, not_found = :reject, found = :return, options = {})
      # Event list never returns 404 or blocks, but may return an empty list
      @raw = send_get_request(@conn, ['/v1/event/list'], options, use_named_parameter('name', name))
      if JSON.parse(@raw.body).count.zero?
        case not_found
        when :reject
          raise Diplomat::EventNotFound, name
        when :return
          return []
        end
      else
        case found
        when :reject
          raise Diplomat::EventAlreadyExists, name
        when :return
          @raw = parse_body
          return return_payload
        end
      end

      @raw = wait_for_next_event(['/v1/event/list'], options, use_named_parameter('name', name))
      @raw = parse_body
      return_payload
    end
def get_all(name = nil, not_found = :reject, found = :return, options = {})
      # Event list never returns 404 or blocks, but may return an empty list
      @raw = send_get_request(@conn, ['/v1/event/list'], options, use_named_parameter('name', name))
      if JSON.parse(@raw.body).count.zero?
        case not_found
        when :reject
          raise Diplomat::EventNotFound, name
        when :return
          return []
        end
      else
        case found
        when :reject
          raise Diplomat::EventAlreadyExists, name
        when :return
          @raw = parse_body
          return return_payload
        end
      end

      @raw = wait_for_next_event(['/v1/event/list'], options, use_named_parameter('name', name))
      @raw = parse_body
      return_payload
    end
rubocop:enable Metrics/ParameterLists
 Get the list of events matching name
 @param name [String] the name of the event (regex)
 @param not_found [Symbol] behaviour if there are no events matching name;
   :reject with exception, :return degenerate value, or :wait for a non-empty list
 @param found [Symbol] behaviour if there are already events matching name;
   :reject with exception, :return its current value, or :wait for its next value
 @return [Array[hash]] The list of { :name, :payload } hashes
 @param options [Hash] options parameter hash
 @note
   Events are sent via the gossip protocol; there is no guarantee of delivery
   success or order, but the local agent will store up to 256 events that do
   arrive. This method lists those events.
   It has the same semantics as Kv::get, except the value returned is a list
   i.e. the current value is all events up until now, the next value is the
   current list plus the next event to arrive.
   To get a specific event in the sequence, @see #get
   When trying to get a list of events matching a name, there are two possibilities:
   - The list doesn't (yet) exist / is empty
   - The list exists / is non-empty
   The combination of not_found and found behaviour gives maximum possible
   flexibility. For X: reject, R: return, W: wait
   - X X - meaningless; never return a value
   - X R - "normal" non-blocking get operation. Default
   - X W - get the next value only (must have a current value)
   - R X - meaningless; never return a meaningful value
   - R R - "safe" non-blocking, non-throwing get-or-default operation
   - R W - get the next value or a default
   - W X - get the first value only (must not have a current value)
   - W R - get the first or current value; always return something, but
           block only when necessary
   - W W - get the first or next value; wait until there is an update