java-asana icon indicating copy to clipboard operation
java-asana copied to clipboard

Introduction of a TaskDataBuilder

Open smec-cgint opened this issue 9 years ago • 2 comments

Using the data-method providing names as strings may lead to typo-problems and errors that can be hard to find. So we built a TaskDataBuilder where you can set properties via specific methods like notes(String notes) or completed(boolean completed) and then let the builder generate a map to hand over to the apis data-method. It would be great if such a builder would be part of the client-api maybe also for the other entities. We could provide our implementation if you like.

Thanks, Christian

┆Issue is synchronized with this Asana task

smec-cgint avatar Sep 30 '16 09:09 smec-cgint

Hi! We'll discuss this internally to figure out what to do. I think it would definitely be nice to have a typed way to interact with the Api, but we are concerned with making drastic changes at this moment.

markchua avatar Oct 04 '16 03:10 markchua

Hi. Happy to hear that.

Such a TaskDataBuilder is on simple class that could reside in the api-project. The usage can be as non-intrusive as this (in case i did not make myself clear in the first description): TaskDataBuilder dataBuilder = TaskDataBuilder.create().name("The name").notes("The notes") ...tasks.createInWorkspace(workspaceId).data(dataBuilder.build()).execute());

I attached the class we built. Thanks again, Christian

TaskDataBuilder.java.zip

smec-cgint avatar Oct 04 '16 12:10 smec-cgint