https://kotlinlang.org logo
#grpc
Title
# grpc
d

davec

06/27/2022, 9:03 PM
Is there any decent documentation on how to create a gRPC request? It seems like everything uses the DSL stuff which I can't find any documentation for and isn't particularly intuitive:
Copy code
val request = rectangle {
            lo = point(lowLat, lowLon)
            hi = point(hiLat, hiLon)
        }
        var i = 1
        stub.listFeatures(request).
☝️ that looks easy in theory but try it with a nontrivial request and it becomes near impossible to come up with the right syntax. Seems like sometimes things are a "DSL code block" and other time they're done like constructors? It would be nice if I could just construct the request like a
data class
instead of all this stuff
d

Dariusz Kuc

06/27/2022, 9:27 PM
logic to construct non trivial message will be complex regardless whether you use builder pattern or DSL syntax
👍 1
d

davec

06/27/2022, 9:49 PM
Any idea how to create a DslList?
I'm hunting the docs but I don't see an example
d

Dariusz Kuc

06/27/2022, 9:50 PM
unsure if there is a way -> you may need to use the builder
d

davec

06/27/2022, 10:31 PM
Yeah I wasn't able to figure out a way to do it in the DSL.
e

enleur

06/28/2022, 6:07 AM
something like that should work
Copy code
rectangle {
  list += listOf(1,2,3)
  list2 += 1  
}
36 Views