Rocket.Chat.Net.Driver.RocketChatDriver.HandleStreamingCollections C# (CSharp) Method

HandleStreamingCollections() private method

private HandleStreamingCollections ( string type, Newtonsoft.Json.Linq.JObject data ) : void
type string
data Newtonsoft.Json.Linq.JObject
return void
        private void HandleStreamingCollections(string type, JObject data)
        {
            var collectionResult = data.ToObject<CollectionResult>(JsonSerializer);
            if (collectionResult.Name == null)
            {
                return;
            }

            var collection = _collectionDatabase.GetOrAddCollection(collectionResult.Name);

            switch (type)
            {
                case "added":
                    collection.Added(collectionResult.Id, collectionResult.Fields);
                    break;
                case "changed":
                    collection.Changed(collectionResult.Id, collectionResult.Fields);
                    break;
                case "removed":
                    collection.Removed(collectionResult.Id);
                    break;
                default:
                    throw new InvalidOperationException($"Encountered a unknown subscription update type {type}.");
            }
        }