public static Link Feed(AppendStreamOperation operation)
 => new Link(
     Constants.Relations.Feed,
     LinkFormatter.FormatBackwardLink(
         operation.StreamId,
         Constants.MaxCount,
         StreamVersion.End,
         false));
        public async Task <Response> AppendMessages(
            AppendStreamOperation operation,
            CancellationToken cancellationToken)
        {
            var result = await operation.Invoke(_streamStore, cancellationToken);

            var response = new Response(
                new HALResponse(result)
                .AddLinks(Links.Self(operation))
                .AddLinks(Links.Feed(operation)),
                result.CurrentVersion == 0
                    ? 201
                    : 200);

            if (operation.ExpectedVersion == ExpectedVersion.NoStream)
            {
                response.Headers[Constants.Headers.Location] = new[] { $"streams/{operation.StreamId}" };
            }

            return(response);
        }
 public static Link Self(AppendStreamOperation operation) => new Link(
     Constants.Relations.Self,
     $"{operation.StreamId}");