Adds a retrieval server and client allowing retrievals authorized via UCAN packed into HTTP headers. This leaves the response body free to be used for retrieved resource bytes!
There's even a working code example showing how it can be used: https://github.com/storacha/go-ucanto/tree/main/examples/retrieval
What's Changed
- feat!: retrieval server and client by @alanshaw in #48
- docs: add example retrieval server code by @alanshaw in #62
- fix: close response body by @alanshaw in #63
Full Changelog: v0.5.0...v0.6.0
BREAKING CHANGES
core.car.Encode(...)now returnsio.ReadCloserinstead ofio.Readercore.invocation.ranmoved tocore.receipt.ransince ran is a property of a receipt not an invocation.core.receipt.Receipt.Ran(...)now returnscore.receipt.ran.Raninstead ofcore.invocation.Invocation. This allows us to build receipts whereranis just a link, not an actual invocation instance.core.message.NewMessage(...)now takes a single root CID instead of a slice.server.ServerViewis now generic. It's type argument is the type of the service mapping. This is what allows a retrieval server to use much of the regular server code, while also allowing it's handler signatures to be different.server.NewServer(...)now returns aserver.ServerView[server.Service].transport.car.NewCAROutboundCodecwas renamed totransport.car.NewOutboundCodecsince "car" is already in the package name.transport.car.NewCARInboundCodecwas renamed totransport.car.NewInboundCodecsince "car" is already in the package name.transport.http.HTTPResponse.Body()now returnsio.ReadCloserinstead ofio.Readertransport.http.NewHTTPChannelwas renamed totransport.http.NewChannelsince "http" is already in the package name.transport.http.NewHTTPRequestwas renamed totransport.http.NewRequestsince "http" is already in the package name.transport.http.NewHTTPResponsewas renamed totransport.http.NewResponsesince "http" is already in the package name.