docs: public ServiceCall<QueryResponse> federatedQuery(FederatedQueryOptions federatedQueryOptions) {
      Validator.notNull(federatedQueryOptions, "federatedQueryOptions cannot be null");
      String[] pathSegments = { "v1/environments", "query" };
      String[] pathParameters = { federatedQueryOptions.environmentId() };
      RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
          pathParameters));
      builder.query("version", versionDate);
      Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "federatedQuery");
      for (Entry<String, String> header : sdkHeaders.entrySet()) {
        builder.header(header.getKey(), header.getValue());
      }
      builder.header("Accept", "application/json");
      if (federatedQueryOptions.loggingOptOut() != null) {
        builder.header("X-Watson-Logging-Opt-Out", federatedQueryOptions.loggingOptOut());
      }
      final JsonObject contentJson = new JsonObject();
      if (federatedQueryOptions.filter() != null) {
        contentJson.addProperty("filter", federatedQueryOptions.filter());
      }
      if (federatedQueryOptions.query() != null) {
        contentJson.addProperty("query", federatedQueryOptions.query());
      }
      if (federatedQueryOptions.naturalLanguageQuery() != null) {
        contentJson.addProperty("natural_language_query", federatedQueryOptions.naturalLanguageQuery());
      }
      if (federatedQueryOptions.passages() != null) {
        contentJson.addProperty("passages", federatedQueryOptions.passages());
      }
      if (federatedQueryOptions.aggregation() != null) {
        contentJson.addProperty("aggregation", federatedQueryOptions.aggregation());
      }
      if (federatedQueryOptions.count() != null) {
        contentJson.addProperty("count", federatedQueryOptions.count());
      }
      if (federatedQueryOptions.returnFields() != null) {
        contentJson.addProperty("return", federatedQueryOptions.returnFields());
      }
      if (federatedQueryOptions.offset() != null) {
        contentJson.addProperty("offset", federatedQueryOptions.offset());
      }
      if (federatedQueryOptions.sort() != null) {
        contentJson.addProperty("sort", federatedQueryOptions.sort());
      }
      if (federatedQueryOptions.highlight() != null) {
        contentJson.addProperty("highlight", federatedQueryOptions.highlight());
      }
      if (federatedQueryOptions.passagesFields() != null) {
        contentJson.addProperty("passages.fields", federatedQueryOptions.passagesFields());
      }
      if (federatedQueryOptions.passagesCount() != null) {
        contentJson.addProperty("passages.count", federatedQueryOptions.passagesCount());
      }
      if (federatedQueryOptions.passagesCharacters() != null) {
        contentJson.addProperty("passages.characters", federatedQueryOptions.passagesCharacters());
      }
      if (federatedQueryOptions.deduplicate() != null) {
        contentJson.addProperty("deduplicate", federatedQueryOptions.deduplicate());
      }
      if (federatedQueryOptions.deduplicateField() != null) {
        contentJson.addProperty("deduplicate.field", federatedQueryOptions.deduplicateField());
      }
      if (federatedQueryOptions.collectionIds() != null) {
        contentJson.addProperty("collection_ids", federatedQueryOptions.collectionIds());
      }
      if (federatedQueryOptions.similar() != null) {
        contentJson.addProperty("similar", federatedQueryOptions.similar());
      }
      if (federatedQueryOptions.similarDocumentIds() != null) {
        contentJson.addProperty("similar.document_ids", federatedQueryOptions.similarDocumentIds());
      }
      if (federatedQueryOptions.similarFields() != null) {
        contentJson.addProperty("similar.fields", federatedQueryOptions.similarFields());
      }
      if (federatedQueryOptions.bias() != null) {
        contentJson.addProperty("bias", federatedQueryOptions.bias());
      }
      builder.bodyJson(contentJson);
      return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryResponse.class));
    }