elucidsoft / dotnet-stellar-sdk

Stellar API SDK for .NET 6.x
Apache License 2.0
116 stars 54 forks source link

HAL and followings Links #133

Closed fracek closed 5 years ago

fracek commented 5 years ago

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

Responses usually contain a collection of Links that point to other resources related to it, for example LedgerResponse has links to OperationResponse etc. It would be very useful to be able to follow these links somehow.

Describe the solution you'd like

I have an idea on how to implement this feature:

  1. Change the type of Link to Link<TResponse>
  2. Add the method FollowLink<TResponse>(Link<TResponse> link) to server
  3. Maybe add a method Follow to Link, similar to what we have in Page<T>?

Templated links pose a challenge, but we can use Tavis.UriTemplates. What do you think about adding this dependency?

I can implement this if you are ok with it, mostly I want your opinion if you are fine adding a new dependency and if you prefer the follow method on the link or server (or both).

elucidsoft commented 5 years ago

Can we implement just the very minimal of what we need from that library? I would be a bit concerned about having this many chained references and the garbage collector never being able to dispose of anything as well. Thoughts on that?

On Mon, Dec 24, 2018 at 9:04 AM Francesco Ceccon notifications@github.com wrote:

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

Responses usually contain a collection of Links that point to other resources related to it, for example LedgerResponse has links to OperationResponse etc. It would be very useful to be able to follow these links somehow.

Describe the solution you'd like

I have an idea on how to implement this feature:

  1. Change the type of Link to Link
  2. Add the method FollowLink(Link link) to server
  3. Maybe add a method Follow to Link, similar to what we have in Page?

Templated links pose a challenge, but we can use Tavis.UriTemplates https://github.com/tavis-software/Tavis.UriTemplates. What do you think about adding this dependency?

I can implement this if you are ok with it, mostly I want your opinion if you are fine adding a new dependency and if you prefer the follow method on the link or server (or both).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elucidsoft/dotnet-stellar-sdk/issues/133, or mute the thread https://github.com/notifications/unsubscribe-auth/AANRUPi9zgq5ImY_3E1W0Jr7yxB1-RELks5u8N8AgaJpZM4ZgeSZ .

fracek commented 5 years ago

From what I see, Horizon only uses templated href for ?cursor,limit,order, so we can only have that special case. For the non templated case, everything would stay the same except for an additional method.

elucidsoft commented 5 years ago

Oh ok, yes I would love to see how this works. Please submit a PR and I will take a look.

On Mon, Dec 24, 2018 at 3:26 PM Francesco Ceccon notifications@github.com wrote:

From what I see, Horizon only uses templated href for ?cursor,limit,order, so we can only have that special case. For the non templated case, everything would stay the same except for an additional method.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elucidsoft/dotnet-stellar-sdk/issues/133#issuecomment-449769108, or mute the thread https://github.com/notifications/unsubscribe-auth/AANRUCmmynjGPAgpBnlrOhjz2GZRBal9ks5u8TiOgaJpZM4ZgeSZ .