using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; namespace RethinkDb.Driver.Model { /// /// Change feed states /// public enum ChangeState { /// /// {state: 'initializing'} indicates the following documents represent /// initial values on the feed rather than changes. This will be the first /// document of a feed that returns initial values. /// Initializing = 1, /// /// {state: 'ready'} indicates the following documents represent changes. /// This will be the first document of a feed that does not return initial /// values; otherwise, it will indicate the initial values have all been sent. /// Ready } /// /// If the change feed query contains the include_types opt arg, every result on a changefeed /// will include a type field with a string that indicates the kind of change the result /// represents: add, remove, change, initial, uninitial, state. /// public enum ChangeType { /// /// Document was added. /// Add, /// /// Document was removed /// Remove, /// /// Document was changed. /// Change, /// /// Initial document. /// Initial, /// /// If an initial result for a document has been sent and a change is made to that /// document that would move it to the unsent part of the result set /// (e.g., a changefeed monitors the top 100 posters, the first 50 have been sent, /// and poster 48 has become poster 52), an 'uninitial' notification will be sent, /// with an old_val field but no new_val field. /// Uninitial, /// /// A state document. /// State } /// /// Change Document Helper /// /// public class Change { /// /// When a document is deleted, new_val will be null; when a document is inserted, old_val will be null. /// [JsonProperty("old_val")] public T OldValue { get; set; } /// /// When a document is deleted, new_val will be null; when a document is inserted, old_val will be null. /// [JsonProperty("new_val")] public T NewValue { get; set; } /// /// If include_states = true optional argument was specified, the changefeed stream /// will include special status documents consisting of the state /// indicating a change in the feed’s state. These states can occur at any point /// in the feed between the notifications. If includeStates = false (the default), /// the state status will not be set. See . /// [JsonConverter(typeof(StringEnumConverter))] public ChangeState? State { get; set; } /// /// If an include_types opt arg is set, every result on a changefeed will include a type /// field with a string that indicates the kind of change the result represents: /// add, remove, change, initial, uninitial, state. /// [JsonConverter(typeof(StringEnumConverter))] public ChangeType? Type { get; set; } /// /// Extra metadata that couldn't be parsed, if any. /// [JsonExtensionData] public IDictionary ExtraData { get; set; } } }