api2go icon indicating copy to clipboard operation
api2go copied to clipboard

MarshalWithUrl merging custom link inside data

Open nikhilatshaw opened this issue 5 years ago • 2 comments

How can I achieve response in the following manner { "links":{ "self": } "data":[ ... ] }

whenever I implemented GetCustomUrl link is being created inside data. Is there any way to achieve this

nikhilatshaw avatar Dec 10 '20 09:12 nikhilatshaw

As far as I can tell only pagination links are supported at the top level unless you implement your own LinksResponder type and return an instance of it. I was looking for the self link recently as well.

richard-rance avatar Dec 11 '20 23:12 richard-rance

I thought am I missing anything on this.Yes I have implemented my own LinkResponder. Thank you for mentioning it.

On Sat, 12 Dec 2020, 5:25 am Richard Rance, [email protected] wrote:

As far as I can tell only pagination links https://github.com/manyminds/api2go/blob/master/response.go#L50-L67 are supported at the top level unless you implement your own LinksResponder https://github.com/manyminds/api2go/blob/master/api_interfaces.go#L120-L125 type and return an instance of it. I was looking for the self link recently as well.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/manyminds/api2go/issues/338#issuecomment-743487042, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR2LQO5GAK3CP4D7KZTTD3DSUKWQPANCNFSM4UUXXKCQ .

nikhilatshaw avatar Dec 12 '20 02:12 nikhilatshaw