public async Task <Response> Get(
            GetStreamMetadataOperation operation,
            CancellationToken cancellationToken)
        {
            var result = await operation.Invoke(_streamStore, cancellationToken);

            var response = new Response(new HALResponse(new
            {
                result.StreamId,
                result.MetadataStreamVersion,
                result.MaxAge,
                result.MaxCount,
                result.MetadataJson
            })
                                        .AddLinks(
                                            Links.Self(),
                                            Links.Metadata(),
                                            Links.Feed(operation))
                                        .AddEmbeddedResource(
                                            Constants.Relations.Metadata,
                                            Schemas.SetStreamMetadata),
                                        result.MetadataStreamVersion >= 0 ? 200 : 404)
            {
                Headers =
                {
                    ETag.FromStreamVersion(result.MetadataStreamVersion)
                }
            };

            return(response);
        }
Example #2
0
        public async Task <Response> GetStreamMetadata(
            GetStreamMetadataOperation operation,
            CancellationToken cancellationToken)
        {
            var result = await operation.Invoke(_streamStore, cancellationToken);

            var response = new Response(new HALResponse(new
            {
                result.StreamId,
                result.MetadataStreamVersion,
                result.MaxAge,
                result.MaxCount,
                result.MetadataJson
            }).AddLinks(s_links),
                                        result.MetadataStreamVersion >= 0 ? 200 : 404);

            return(response);
        }
 public static Link Feed(GetStreamMetadataOperation operation) => Link(operation.StreamId);