Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - returning response headers in SearchResult #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Z14tk0
Copy link
Contributor

@Z14tk0 Z14tk0 commented Nov 4, 2024

Summary:
This PR introduces support for returning HTTP headers in SearchResult, allowing the devs which use midpoint-client-java to read headers from response.

Use Case example:
When querying a paginated list of users (e.g., with offset=0 and maxSize=20), it's often useful to know the total count of available records. While there are several ways to return this (e.g., in headers, an envelope, or a separate endpoint), adding it to the headers is the least disruptive to the existing API.

Example Usage:

SearchResult<? extends ObjectType> searchResult = service.users().search().queryFor(UserType.class).get();
MultivaluedMap<String, Object> responseHeaders = searchResult.getHeaders();

This change enables fetching totalCount and other response metadata directly from headers without modifying the response body structure. (Note: Midpoint doesn’t currently return totalCount, but a subsequent PR will address this.)

Let me know if any adjustments or refactoring are needed.

Thank you,
Best regards

@Z14tk0 Z14tk0 force-pushed the feature/search_response_http_headers branch 2 times, most recently from f1ba901 to 68dad9f Compare November 4, 2024 15:09
@Z14tk0 Z14tk0 force-pushed the feature/search_response_http_headers branch from 68dad9f to 1d7f3da Compare November 4, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant