Skip to content

Get client (by ID) API should include Field Filter #448

@bhatmadhavi

Description

@bhatmadhavi

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
auth0-get-client-api
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA feature has been asked for or suggested by the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions