Skip to content
New issue

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

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

Already on GitHub? # to your account

Feature: Improve ReductClient initialization #41

Closed
1 task done
atimin opened this issue Aug 21, 2024 · 1 comment · Fixed by #52
Closed
1 task done

Feature: Improve ReductClient initialization #41

atimin opened this issue Aug 21, 2024 · 1 comment · Fixed by #52
Assignees
Labels
enhancement New feature or request

Comments

@atimin
Copy link
Member

atimin commented Aug 21, 2024

Current problem

Client initialization is verbose and counter-intuitive:

        ServerProperties properties = new ServerProperties(false, "127.0.0.1", 8383);
        HttpClient httpClient = HttpClient.newHttpClient();
        ReductClient client = new ReductClient(properties, httpClient, "my-token");

Possible solution

Let's pass the URL and token to ServerProperties and use the builder pattern because in the future we will need timeout and other options:

        ServerProperties properties = ServerProperties
            .url(:http://127.0.0.1:8383)
            .apiToken("my-token");

        HttpClient httpClient = HttpClient.newHttpClient();
        ReductClient client = new ReductClient(properties, httpClient);

Additionally, lets add a constructor with a default HTTP client.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@atimin atimin added the enhancement New feature or request label Aug 21, 2024
@atimin atimin assigned atimin and Rumpelshtinskiy and unassigned atimin Aug 21, 2024
@Rumpelshtinskiy
Copy link
Collaborator

I've started to work on the issue

Rumpelshtinskiy added a commit that referenced this issue Sep 27, 2024
Rumpelshtinskiy added a commit that referenced this issue Sep 27, 2024
Rumpelshtinskiy added a commit that referenced this issue Sep 27, 2024
Rumpelshtinskiy added a commit that referenced this issue Sep 27, 2024
atimin pushed a commit that referenced this issue Sep 27, 2024
#52)

feature/#41 ReductClient constructor was changed. ServerProperties have builder initialization
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants