public static Links StreamBrowserNavigation(
            this Links links,
            ListStreamsPage listStreamsPage,
            ListStreamsOperation operation)
        {
            if (operation.ContinuationToken != null)
            {
                links.Add(
                    Constants.Relations.Next,
                    LinkFormatter.ListStreams(operation.Pattern, operation.MaxCount, operation.ContinuationToken));
            }

            if (listStreamsPage.ContinuationToken != null)
            {
                links.Add(
                    Constants.Relations.Next,
                    LinkFormatter.ListStreams(operation.Pattern, operation.MaxCount, operation.ContinuationToken));
            }


            return(links
                   .Add(
                       Constants.Relations.Browse,
                       LinkFormatter.ListStreams(operation.Pattern, operation.MaxCount, operation.ContinuationToken))
                   .Self());
        }
        public async Task <Response> Get(ListStreamsOperation operation, CancellationToken cancellationToken)
        {
            var listStreamsPage = await operation.Invoke(_streamStore, cancellationToken);

            return(new HalJsonResponse(new HALResponse(new
            {
                listStreamsPage.ContinuationToken
            })
                                       .AddLinks(
                                           Links
                                           .FromOperation(operation)
                                           .Index()
                                           .Find()
                                           .StreamBrowserNavigation(listStreamsPage, operation))
                                       .AddEmbeddedCollection(
                                           Constants.Relations.Feed,
                                           Array.ConvertAll(
                                               listStreamsPage.StreamIds,
                                               streamId => new HALResponse(null)
                                               .AddLinks(
                                                   Links
                                                   .FromOperation(operation)
                                                   .Add(Constants.Relations.Feed, LinkFormatter.Stream(streamId), streamId)
                                                   .Self())))));
        }
 private static string FormatLink(ListStreamsOperation operation, string continuationToken) =>
 $"streams?p={operation.Pattern.Value}&t={operation.PatternType}&c={continuationToken}&m={operation.MaxCount}";