actions-on-google / actions-on-google-java

Java/Kotlin library for Actions on Google
Apache License 2.0
286 stars 39 forks source link

Kotlin friendly DSL support #8

Open viniciusccarvalho opened 5 years ago

viniciusccarvalho commented 5 years ago

It's so nice to see kotlin being used as a standard for java libraries. This is really awesome!

So while I think I understand the reason to rely on ResponseBuilder so that java users can have better interop. One of my favorites things on kotlin is the DSL support for typesafe builders.

I honestly became addicted to it :)

One of my favorites implementations is https://github.com/fkorotkov/k8s-kotlin-dsl

Makes kube-client-dsl so much nicer to use in kotlin projects

So I was wondering if you would be open to accept such PR, I've started working on some extension functions to enable something like:

response {
    card {
      title = "foo"
      subtitle = "bar"
      image {
        url ="http://foo.bar.com/"
        width = 320
        height = 320
      }
    }
  }

So Kotlin developers could benefit from the language nice DSL syntax. It's a good chunk of work, and I'd love to contribute, just want to make sure it's something you would be considering to accept before diving in and submitting a PR of this size.

Cheers

kishores commented 5 years ago

Thanks. Good idea. We will be happy to review and accept the PR.