code: public Collection<SingularitySlave> getSlaves(Optional<MachineState> slaveState) {
      final Function<String, String> requestUri = (host) -> String.format(SLAVES_FORMAT, getApiBase(host));
  
      Optional<Map<String, Object>> maybeQueryParams = Optional.absent();
  
      String type = "slaves";
  
      if (slaveState.isPresent()) {
        maybeQueryParams = Optional.of(ImmutableMap.of("state", slaveState.get().toString()));
  
        type = String.format("%s slaves", slaveState.get().toString());
      }
  
      return getCollectionWithParams(requestUri, type, maybeQueryParams, SLAVES_COLLECTION);
    }
docs: Retrieve the list of all known slaves, optionally filtering by a particular slave state
  
  @param slaveState
  Optionally specify a particular state to filter slaves by
  @return
  A collection of {@link SingularitySlave}