matrix-communication-client icon indicating copy to clipboard operation
matrix-communication-client copied to clipboard

Possible to have an URL builder?

Open bronson opened this issue 8 months ago • 2 comments

Right now my app receives the Matrix server as a URI..

https://example.com:8999

which I then parse and pass to your builder...

MatrixResources.factory()
                        .builder()
                        .https(uri.is_https)
                        .hostname(uri.hostname)
                        .port(uri.port)

which then reassembles it into a URI!

https://github.com/Cosium/matrix-communication-client/blob/dcf3a1b8520ad8bb2afa517558573db9923dfaa0/src/main/java/com/cosium/matrix_communication_client/MatrixHostname.java#L18

Is there any chance I could just pass the URI to the builder?

Thanks!

bronson avatar Apr 21 '25 21:04 bronson

Here's an example of how it would be used: https://github.com/bronson/minecraft-to-matrix/commit/57822f311a51313ea3fe9b531ff62fe7335c99dc#diff-7fa5a23fb24106b9bbafbeae32e800dfb43bf96d3f2d3280f43200983a4ed3e9R66-R82

That's maybe not the best way to implement the URI builder, since it's still decomposing and recomposing the URI, but it solves my immediate need.

Tell me if I should package it up as a pull request.

bronson avatar Apr 22 '25 00:04 bronson

Hi @bronson ,

Yes, PR welcome.

reda-alaoui avatar Apr 30 '25 14:04 reda-alaoui