Ejemplo n.º 1
0
        public async override Task Initialize()
        {
            EventSubscriptions.Manufacturer = "Google";
            EventSubscriptions.Add("GmailInbox");

            CrateSignaller.MarkAvailableAtRuntime <StandardEmailMessageCM>(RuntimeCrateLabel);
        }
        public override async Task Initialize()
        {
            var oAuthToken = AuthorizationToken.Token;

            ActivityUI.ChannelList.ListItems = (await _slackIntegration.GetChannelList(oAuthToken, false))
                                               .OrderBy(x => x.Key)
                                               .Select(x => new ListItem {
                Key = $"#{x.Key}", Value = x.Value
            })
                                               .ToList();

            EventSubscriptions.Manufacturer = "Slack";
            EventSubscriptions.Add("Slack Outgoing Message");

            CrateSignaller.MarkAvailableAtRuntime <StandardPayloadDataCM>(ResultPayloadCrateLabel)
            .AddField("token")
            .AddField("team_id")
            .AddField("team_domain")
            .AddField("service_id")
            .AddField("timestamp")
            .AddField("channel_id")
            .AddField("channel_name")
            .AddField("user_id")
            .AddField("user_name")
            .AddField("text");
        }
Ejemplo n.º 3
0
        public static void Run()
        {
            //register interface container
            IoC.Container.RegisterType <ISubscriptionService, EventSubscriptions>();
            IoC.Container.RegisterType <IEventPublisher, EventPublisher>();
            IoC.Container.RegisterType <IOrderService, OrderService>();

            //event global add
            EventSubscriptions.Add <OrderEmailSend>();
            EventSubscriptions.Add <OrderNotifyWarehouse>();
            EventSubscriptions.Add <OrderSendSmsOwner>();
        }
Ejemplo n.º 4
0
        public override Task FollowUp()
        {
            if (EventSubscriptions.Subscriptions != null)
            {
                EventSubscriptions.Subscriptions.Clear();
            }

            EventSubscriptions.Manufacturer = "Atlassian";
            EventSubscriptions.Add(ActivityUI.ProjectSelector.selectedKey);

            return(Task.FromResult(0));
        }
Ejemplo n.º 5
0
        public override Task Initialize()
        {
            EventSubscriptions.Manufacturer = "Facebook";
            EventSubscriptions.Add(FacebookFeed);

            CrateSignaller.MarkAvailableAtRuntime <StandardPayloadDataCM>(RuntimeCrateLabel)
            .AddField(FacebookFeedIdField)
            .AddField(FacebookFeedMessageField)
            .AddField(FacebookFeedStoryField)
            .AddField(FacebookFeedCreatedTimeField);
            return(Task.FromResult(0));
        }
        public override async Task Initialize()
        {
            EventSubscriptions.Manufacturer = "Instagram";
            EventSubscriptions.Add(InstagramMedia);

            CrateSignaller.MarkAvailableAtRuntime <StandardPayloadDataCM>(RuntimeCrateLabel)
            .AddField(InstagramMediaId)
            .AddField(InstagramCaptionId)
            .AddField(InstagramCaptionText)
            .AddField(InstagramCaptionCreatedTimeField)
            .AddField(InstagramImageUrl)
            .AddField(InstagramImageUrlStandardResolution);
        }
Ejemplo n.º 7
0
        // GET: Home
        public async Task <ActionResult> Index()
        {
            //add event subscriptions
            EventSubscriptions.Add <EmailOrderConfirmation>();
            EventSubscriptions.Add <NotifyWarehouse>();
            EventSubscriptions.Add <DeductOnHandInventory>();

            //publish
            IEventPublisher eventPublisher = new EventPublisherLibrary.EventPublisher(new EventSubscriptions());
            await eventPublisher.PublishAsync <OrderSubmittedEvent>(new OrderSubmittedEvent { OrderId = Guid.NewGuid().ToString() });

            await eventPublisher.PublishAsync <OrderSubmittedEvent>(new OrderSubmittedEvent { OrderId = Guid.NewGuid().ToString() });

            return(Content("OK"));
        }
Ejemplo n.º 8
0
        public void SubscribeEvents(string topic, OnEvent pOnSubscriptionEvent)
        {
            WebSocketSubscriptionEvent msg = new WebSocketSubscriptionEvent()
            {
                topic = topic,
            };

            msg.SetEvent(pOnSubscriptionEvent);

            if (EventSubscriptions == null)
            {
                throw new Exception(string.Format("Event Subscriptions Dictionary has not been initialized"));
            }
            EventSubscriptions.Add(topic, msg);
        }
Ejemplo n.º 9
0
        private void PackEventSubscriptionsCrate()
        {
            var curSfChosenObject = ActivityUI.SalesforceObjectList.selectedKey;

            EventSubscriptions.Subscriptions?.Clear();
            EventSubscriptions.Manufacturer = "Salesforce";

            if (ActivityUI.Created.Selected)
            {
                EventSubscriptions.Add($"{curSfChosenObject}{CreatedEventname}");
            }
            if (ActivityUI.Updated.Selected)
            {
                EventSubscriptions.Add($"{curSfChosenObject}{UpdatedEventname}");
            }
        }
Ejemplo n.º 10
0
        public override async Task Initialize()
        {
            var googleAuth = GetGoogleAuthToken();
            var forms      = await _googleDrive.GetGoogleForms(googleAuth);

            ActivityUI.FormsList.ListItems = forms
                                             .Select(x => new ListItem {
                Key = x.Value, Value = x.Key
            })
                                             .ToList();

            EventSubscriptions.Manufacturer = "Google";
            EventSubscriptions.Add("Google Form Response");

            CrateSignaller.MarkAvailableAtRuntime <StandardTableDataCM>(RunTimeCrateLabel);
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            //add event subscriptions
            EventSubscriptions.Add <EmailOrderConfirmation>();
            EventSubscriptions.Add <NotifyWarehouse>();
            EventSubscriptions.Add <DeductOnHandInventory>();

            //publish
            IEventPublisher eventPublisher = new EventPublisher(new EventSubscriptions());

            eventPublisher.PublishAsync <OrderSubmittedEvent>(new OrderSubmittedEvent {
                OrderId = Guid.NewGuid().ToString()
            });
            eventPublisher.PublishAsync <OrderSubmittedEvent>(new OrderSubmittedEvent {
                OrderId = Guid.NewGuid().ToString()
            });

            //Console.ReadKey();
        }
        public override async Task Initialize()
        {
            EventSubscriptions.Manufacturer = "Google";
            EventSubscriptions.Add("GoogleSpreadsheet");

            var spreadsheets = await _googleSheet.GetSpreadsheets(GetGoogleAuthToken());

            var spreadsheetListItems = spreadsheets
                                       .Select(x => new ListItem {
                Key = x.Value, Value = ExtractFileId(x.Key)
            })
                                       .ToList();

            ActivityUI.SpreadsheetList.ListItems = spreadsheetListItems;

            CrateSignaller
            .MarkAvailableAtRuntime <StandardTableDataCM>(RunTimeCrateLabel, true)
            .AddField(new FieldDTO(SpreadsheetIdLabel))
            .AddField(new FieldDTO(SpreadsheetNameLabel));
        }
        private void PackEventSubscriptionsCrate()
        {
            ActivityUi activityUi = ConfigurationControls;

            EventSubscriptions.Manufacturer = "DocuSign";
            EventSubscriptions.Subscriptions?.Clear();

            if (activityUi.EnvelopeSentOption.Selected)
            {
                EventSubscriptions.Add(EnvelopeSentEventname);
            }
            if (activityUi.EnvelopeRecievedOption.Selected)
            {
                EventSubscriptions.Add(EnvelopeRecievedEventName);
            }
            if (activityUi.EnvelopeSignedOption.Selected)
            {
                EventSubscriptions.Add(RecipientSignedEventName);
                EventSubscriptions.Add(RecipientCompletedEventName);
            }
        }
Ejemplo n.º 14
0
        public void SubscribeToEvent <TEvent, TEventHandler>()
            where TEvent : IEvent
            where TEventHandler : IEventHandler <TEvent>
        {
            var type    = typeof(TEvent);
            var handler = typeof(TEventHandler);

            if (!EventSubscriptionExists(type))
            {
                EventSubscriptions.Add(type, new HashSet <Type>()
                {
                    handler
                });
                Subscribe(type.Name);
                return;
            }

            if (!EventSubscriptions[type].Contains(handler))
            {
                EventSubscriptions[type].Add(handler);
            }

            Subscribe(type.Name);
        }
        public override async Task FollowUp()
        {
            if (!string.IsNullOrEmpty(ActivityUI.ExistingGroupsList.Value))
            {
                var previousGroup = SelectedGroup;
                if (string.IsNullOrEmpty(previousGroup) || !string.Equals(previousGroup, ActivityUI.ExistingGroupsList.Value))
                {
                    var stats = await _statXIntegration.GetStatsForGroup(StatXUtilities.GetStatXAuthToken(AuthorizationToken), ActivityUI.ExistingGroupsList.Value);

                    if (stats.Any(x => string.IsNullOrEmpty(x.Title)))
                    {
                        StatXUtilities.AddAdvisoryMessage(Storage);
                    }
                    else
                    {
                        if (Storage.CratesOfType <AdvisoryMessagesCM>().FirstOrDefault() != null)
                        {
                            ActivityUI.ExistingGroupStats.ListItems = stats.Select(x => new ListItem {
                                Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                            }).ToList();
                        }
                        Storage.RemoveByLabel("Advisories");
                    }

                    ActivityUI.ExistingGroupStats.ListItems = stats
                                                              .Select(x => new ListItem {
                        Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                    }).ToList();

                    var firstStat = stats.FirstOrDefault();
                    if (firstStat != null)
                    {
                        ActivityUI.ExistingGroupStats.SelectByValue(firstStat.Id);
                    }

                    CrateSignaller.ClearAvailableCrates();
                    CrateSignaller.MarkAvailableAtRuntime <StandardPayloadDataCM>(RunTimeCrateLabel)
                    .AddFields(CreateStatValueFields(StatXUtilities.MapToStatItemCrateManifest(firstStat)));
                }
                SelectedGroup = ActivityUI.ExistingGroupsList.Value;
                ActivityUI.ExistingGroupsList.ListItems = (await _statXIntegration.GetGroups(StatXUtilities.GetStatXAuthToken(AuthorizationToken)))
                                                          .Select(x => new ListItem {
                    Key = x.Name, Value = x.Id
                }).ToList();
                ActivityUI.ExistingGroupsList.Value = SelectedGroup;
            }
            else
            {
                ActivityUI.ExistingGroupStats.ListItems.Clear();
                ActivityUI.ExistingGroupStats.selectedKey = string.Empty;
                ActivityUI.ExistingGroupStats.Value       = string.Empty;
                SelectedGroup = string.Empty;
            }

            if (!string.IsNullOrEmpty(ActivityUI.ExistingGroupStats.Value))
            {
                var previousStat = SelectedStat;
                var stats        = await _statXIntegration.GetStatsForGroup(StatXUtilities.GetStatXAuthToken(AuthorizationToken), ActivityUI.ExistingGroupsList.Value);

                if (stats.Any(x => string.IsNullOrEmpty(x.Title)))
                {
                    StatXUtilities.AddAdvisoryMessage(Storage);
                }
                else
                {
                    if (Storage.CratesOfType <AdvisoryMessagesCM>().FirstOrDefault() != null)
                    {
                        ActivityUI.ExistingGroupStats.ListItems = stats.Select(x => new ListItem {
                            Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                        }).ToList();
                    }
                    Storage.RemoveByLabel("Advisories");
                }

                if (string.IsNullOrEmpty(previousStat) || !string.Equals(previousStat, ActivityUI.ExistingGroupStats.Value))
                {
                    var currentStat = stats.FirstOrDefault(x => x.Id == ActivityUI.ExistingGroupStats.Value);
                    if (currentStat != null)
                    {
                        CrateSignaller.ClearAvailableCrates();
                        CrateSignaller.MarkAvailableAtRuntime <StandardPayloadDataCM>(RunTimeCrateLabel).AddFields(CreateStatValueFields(StatXUtilities.MapToStatItemCrateManifest(currentStat)));
                    }
                }
                SelectedStat = ActivityUI.ExistingGroupStats.Value;
                ActivityUI.ExistingGroupStats.ListItems = stats.Select(x => new ListItem {
                    Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                }).ToList();
                ActivityUI.ExistingGroupStats.Value = SelectedStat;

                EventSubscriptions.Subscriptions?.Clear();
                EventSubscriptions.Manufacturer = "StatX";
                EventSubscriptions.Add("StatXValueChange_" + SelectedStat.Substring(0, 18));
            }
            else
            {
                CrateSignaller.ClearAvailableCrates();
                ActivityUI.ExistingGroupStats.ListItems.Clear();
                ActivityUI.ExistingGroupStats.selectedKey = string.Empty;
                ActivityUI.ExistingGroupStats.Value       = string.Empty;
                SelectedStat = string.Empty;
            }
        }