Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using Cqrs.Events;
11 : using EventData = EventStore.ClientAPI.EventData;
12 :
13 : namespace Cqrs.EventStore
14 : {
15 : /// <summary>
16 : /// Builds <see cref="EventData"/> from various input formats.
17 : /// </summary>
18 : /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
19 : public interface IEventBuilder<TAuthenticationToken>
20 : {
21 : /// <summary>
22 : /// Create an <see cref="EventData">framework event</see> from the provided <paramref name="eventDataBody"/>.
23 : /// </summary>
24 : /// <param name="eventDataBody">A JSON string of serialised data.</param>
25 1 : EventData CreateFrameworkEvent(string eventDataBody);
26 :
27 : /// <summary>
28 : /// Create an <see cref="EventData">framework event</see> with the provided <paramref name="eventData"/>.
29 : /// </summary>
30 : /// <param name="eventData">The <see cref="IEvent{TAuthenticationToken}"/> to add to the <see cref="EventData"/>.</param>
31 1 : EventData CreateFrameworkEvent(IEvent<TAuthenticationToken> eventData);
32 :
33 : /// <summary>
34 : /// Create an <see cref="EventData">framework event</see> with the provided <paramref name="eventData"/>.
35 : /// </summary>
36 : /// <param name="type">The name of the <see cref="Type"/> of the target object the serialised data is.</param>
37 : /// <param name="eventData">The <see cref="IEvent{TAuthenticationToken}"/> to add to the <see cref="EventData"/>.</param>
38 1 : EventData CreateFrameworkEvent(string type, IEvent<TAuthenticationToken> eventData);
39 :
40 : /// <summary>
41 : /// Create an <see cref="EventData">framework event</see> from the provided <paramref name="eventDataBody"/>.
42 : /// </summary>
43 : /// <param name="type">The name of the <see cref="Type"/> of the target object the serialised data is.</param>
44 : /// <param name="eventDataBody">A JSON string of serialised data.</param>
45 1 : EventData CreateFrameworkEvent(string type, string eventDataBody);
46 :
47 : /// <summary>
48 : /// Create an <see cref="EventData"/> that notifies people a client has connected.
49 : /// </summary>
50 : /// <param name="clientName">The name of the client that has connected.</param>
51 1 : EventData CreateClientConnectedEvent(string clientName);
52 : }
53 : }
|