public async Task <Response> Get( GetStreamMetadataOperation operation, CancellationToken cancellationToken) { var result = await operation.Invoke(_streamStore, cancellationToken); var response = new HalJsonResponse(new HALResponse(new { result.StreamId, result.MetadataStreamVersion, result.MaxAge, result.MaxCount, result.MetadataJson }) .AddLinks( Links .FromOperation(operation) .Index() .Find() .Browse() .StreamMetadataNavigation(operation)) .AddEmbeddedResource( Constants.Relations.Metadata, metadata), result.MetadataStreamVersion >= 0 ? 200 : 404) { Headers = { ETag.FromStreamVersion(result.MetadataStreamVersion) } }; return(response); }
public async Task <Response> Get( GetStreamMetadataOperation operation, CancellationToken cancellationToken) { var result = await operation.Invoke(_streamStore, cancellationToken); var response = new HalJsonResponse(new HALResponse(new { result.StreamId, result.MetadataStreamVersion, result.MaxAge, result.MaxCount, MetadataJson = string.IsNullOrEmpty(result.MetadataJson) ? default : JObject.Parse(result.MetadataJson) })