Skip to content

[REQ] Add a Kotlin client Volley library  #10011

@alisters

Description

@alisters

Is your feature request related to a problem? Please describe.

We use android and volley, but with Kotlin. Presently there is

  • A volley client library in the android generator, which generates java.
  • A kotlin client generator with various libraries but not Volley.

Searching the issues shows the volley client may need attention - #9293

Additionally we use co-routines, but my understanding (limited!) of the implementation of co-routines in both these libraries is that whilst they add a suspending function, they then block on it's return. I'd like to see suspendCoroutine, adding the callback listeners to the co-routine continuation, and suspending the co-routine until a value has returned (avoiding tying up a thread until the response arrives). This is the documented way of adapting existing callback based api's to co-routines - though the best explanation of it i've found is in this video, at this point - https://youtu.be/YrrUCSi72E8?t=982

Describe the solution you'd like

I'd like to leverage the model generation in the kotlin client generator, but add a library to for volley

Describe alternatives you've considered

Using one of the existing two generators / libraries. See some of the shortcomings outlined above

  • We could have added it as a new library in java to the android client, but java, to the best of my knowledge would have had less functionality around co-routines / or require interop.
  • The existing libraries in the kotlin client have files we don't need - ApiInvoker.kt.mustache, and we needed to add our own (GsonRequest, RequestFactory). We tried adding custom templates to begin with but this was complicated, and didn't seem to fit well with calling volley with co-routines.

Additional context

We've started work on it, and should have a PR ready with basic functionality ready in a week or two. It has some obvious extension points with the ability to pass your own configured requestQueue, or your own factory for mapping from the various http call fields to volley request classes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions