private RequestBuilder buildProfileRequest(ProfileOptions options) { Validate.notNull(options, "options cannot be null"); Validate.isTrue( options.getText() != null || options.getContentItems() != null, "text, html or content items need to be specified"); final String contentType = options.getContentType(); final RequestBuilder request = RequestBuilder.post(PATH_PROFILE); if (options.getText() != null) { request.withBodyContent(options.getText(), contentType); } else { final Content content = new Content(); content.setContentItems(options.getContentItems()); String body = gson.toJson(content); request.withBodyContent(body, contentType); } if (options.getIncludeRaw() != null) request.withQuery(INCLUDE_RAW, options.getIncludeRaw()); if (options.getLanguage() != null) request.withHeader(HttpHeaders.CONTENT_LANGUAGE, options.getLanguage()); if (options.getAcceptLanguage() != null) request.withHeader(HttpHeaders.ACCEPT_LANGUAGE, options.getAcceptLanguage()); return request; }