Closed amcintosh closed 3 years ago
I want to talk about this issue before I start solving. The services endpoint lives in /comments/business/ url, but the response of every get/post/put method are different, so the responses cannot map to a uniformized (model.api.CommentsResponse) class. Because of the different responses, the resources.api.CommentsResource class cannot implement a common handleRequest() method. We can write a CommentsResource class and we can write a handleRequest() method, but the return value of this method can be only InputStream, what response.getContent() presents and cannot parse it, just in resources.Services class, method-by-method. What do you think about it? How to solve this issue? Is it ok, if the return type of handleRequest method in CommentsResource would be InputStream?
Looking over the documentation I see that there are two separate responses, service
and service_rate
. While those are on the same docs page, they have been implemented as two separate resources elsewhere (here vs here).
I would say lets limit this issue to just the services
response, so it should be able to return a model instead of a stream.
Alrighty, the resources.api.ServiceResource received getPath() and getListPath() methods because of the difference at the end of the url (list has an "s" letter: /serviceS). Same in this class there are handleRequest() and handleListRequest() methods, because of the difference of the return type (ServiceResponse vs ServiceListResponse). The API doesn't define update and delete methods, so I left them out. I hope this way it'll be ok, but please check.
See https://www.freshbooks.com/api/services