public static DescriptionDocument ToDescriptionDocument(Uri requestedUrl, string streamId, string[] subscriptions) { string escapedStreamId = Uri.EscapeDataString(streamId); var descriptionDocument = new DescriptionDocument(); descriptionDocument.SetTitle(string.Format("Description document for '{0}'", streamId)); descriptionDocument.SetDescription(@"The description document will be presented when no accept header is present or it was requested"); descriptionDocument.SetSelf("/streams/" + escapedStreamId, Codec.DescriptionJson.ContentType); descriptionDocument.SetStream("/streams/" + escapedStreamId, Codec.EventStoreXmlCodec.ContentType, Codec.EventStoreJsonCodec.ContentType); if (subscriptions != null) { foreach (var group in subscriptions) { descriptionDocument.AddStreamSubscription(String.Format("/subscriptions/{0}/{1}", escapedStreamId, group), Codec.CompetingXml.ContentType, Codec.CompetingJson.ContentType); } } return(descriptionDocument); }
public static DescriptionDocument ToDescriptionDocument(Uri requestedUrl, string streamId, string[] subscriptions) { string escapedStreamId = Uri.EscapeDataString(streamId); var descriptionDocument = new DescriptionDocument(); descriptionDocument.SetTitle(string.Format("Description document for '{0}'", streamId)); descriptionDocument.SetDescription(@"The description document will be presented when no accept header is present or it was requested"); descriptionDocument.SetSelf("/streams/" + escapedStreamId, Codec.DescriptionJson.ContentType); descriptionDocument.SetStream("/streams/" + escapedStreamId, Codec.EventStoreXmlCodec.ContentType, Codec.EventStoreJsonCodec.ContentType); if (subscriptions != null) { foreach (var group in subscriptions) { descriptionDocument.AddStreamSubscription(String.Format("/subscriptions/{0}/{1}", escapedStreamId, group), Codec.CompetingXml.ContentType, Codec.CompetingJson.ContentType); } } return descriptionDocument; }