diff options
author | TrueKuehli <rctcoaster2000@hotmail.de> | 2018-09-29 17:19:43 +0200 |
---|---|---|
committer | TrueKuehli <rctcoaster2000@hotmail.de> | 2018-09-29 17:19:43 +0200 |
commit | b83fc90abacc73262e0f8404cebadf6d64eb10ae (patch) | |
tree | d63b921c9bcdf8d381fc02ecfb0a1dd425ebb561 /FireBase/Streaming/FirebaseEvent.cs | |
parent | 586d564f3c4c509c1aae931331e96f0382178f80 (diff) | |
parent | 680967aee589e4a8d277044b204de07cbe32f41e (diff) |
Merge branch 'WebApi' of https://github.com/TrueDoctor/DiscoBot into WebApi
Merged the stuffs
Diffstat (limited to 'FireBase/Streaming/FirebaseEvent.cs')
-rw-r--r-- | FireBase/Streaming/FirebaseEvent.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/FireBase/Streaming/FirebaseEvent.cs b/FireBase/Streaming/FirebaseEvent.cs new file mode 100644 index 0000000..c2338ca --- /dev/null +++ b/FireBase/Streaming/FirebaseEvent.cs @@ -0,0 +1,40 @@ +namespace Firebase.Database.Streaming +{ + /// <summary> + /// Firebase event which hold <see cref="EventType"/> and the object affected by the event. + /// </summary> + /// <typeparam name="T"> Type of object affected by the event. </typeparam> + public class FirebaseEvent<T> : FirebaseObject<T> + { + /// <summary> + /// Initializes a new instance of the <see cref="FirebaseEvent{T}"/> class. + /// </summary> + /// <param name="key"> The key of the object. </param> + /// <param name="obj"> The object. </param> + /// <param name="eventType"> The event type. </param> + public FirebaseEvent(string key, T obj, FirebaseEventType eventType, FirebaseEventSource eventSource) + : base(key, obj) + { + this.EventType = eventType; + this.EventSource = eventSource; + } + + /// <summary> + /// Gets the source of the event. + /// </summary> + public FirebaseEventSource EventSource + { + get; + } + + /// <summary> + /// Gets the event type. + /// </summary> + public FirebaseEventType EventType + { + get; + } + + public static FirebaseEvent<T> Empty(FirebaseEventSource source) => new FirebaseEvent<T>(string.Empty, default(T), FirebaseEventType.InsertOrUpdate, source); + } +} |