Get client (by ID) API should include Field Filter
bhatmadhavi opened this issue · 1 comments
bhatmadhavi commented
Describe the problem you'd like to have solved
Current auth0-java
SDK does not provide filter option to "get Client By Id" API, which is available in auth0-management API
Please see attachment
This feature is useful if we intend to read only limited client fields.
Describe the ideal solution
Adding new method to ClientsEntity.java
, which accepts "FieldsFilter" parameter. This way it won't impact existing get
method
public Request<Client> get(String clientId, FieldsFilter filter) {
Asserts.assertNotNull(clientId, "client id");
HttpUrl.Builder builder = baseUrl
.newBuilder()
.addPathSegments("api/v2/clients")
.addPathSegment(clientId);
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
CustomRequest<Client> request = new CustomRequest<>(client, url, "GET", new TypeReference<Client>() {
});
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
Alternatives and current work-arounds
Additional information, if any
PR is created to address this #449
poovamraj commented
@bhatmadhavi we have merged the PR you raised - #449
Thanks a lot for your contribution. The changes will be reflected in the next release of the SDK. We will close this issue for now but please feel free to reopen it if you have any more suggestions.