public async Task <List <FeedEntry> > GetAsync()
        {
            var feedEntryList = new List <FeedEntry>();
            var identity      = User.Identity as ClaimsIdentity;

            if (!identity.IsAuthenticated)
            {
                // This is an anoymous user
                var anonymousUserFeed = _streamClient.Feed(FeedGroup.JunaFeedType, FOOTBALL_BOT);
                var streamActivities  = await anonymousUserFeed.GetActivities(0, 30);

                foreach (var activity in streamActivities)
                {
                    var feedItemId = StreamHelper.GetStreamObjectId(activity);
                    var feedItem   = _feedItemRepository.GetById(Guid.Parse(feedItemId));
                    feedEntryList.Add(new FeedEntry
                    {
                        FeedItem = feedItem,
                        Activity = new DomainModel.Activity
                        {
                            Id        = Guid.Parse(activity.Id),
                            Actor     = activity.Actor,
                            Verb      = activity.Verb,
                            Object    = activity.Object,
                            Target    = activity.Target,
                            ForeignId = activity.ForeignId,
                            Time      = activity.Time.ToString()
                        }
                    });
                }
            }
            else
            {
                var userObjectID       = _identityHelper.GetObjectId(identity);
                var registeredUserFeed = _streamClient.Feed(FeedGroup.UserFeedType, userObjectID);
                var streamActivities   = await registeredUserFeed.GetActivities(0, 30);

                foreach (var activity in streamActivities)
                {
                    var feedItemId = StreamHelper.GetStreamObjectId(activity);

                    feedEntryList.Add(new FeedEntry
                    {
                        FeedItem = _feedItemRepository.GetById(Guid.Parse(feedItemId)),
                        Activity = _activityRepository.GetById(Guid.Parse(activity.ForeignId))
                    });
                }
            }

            return(feedEntryList);
        }
        public void Setup()
        {
            _client = new Stream.StreamClient(
                "hcppd32schhy",
                "8e9smyj47fbkm2eezq8fxhr2bw45j8x88kqx3pzb9z4jbnxfs99tttkzsus8d8ym",
                new Stream.StreamClientOptions()
                {
                    Location = Stream.StreamApiLocation.AsiaJapan
                });
            _user1 = _client.Feed("user", "11");
            _flat3 = _client.Feed("flat", "333");

            //System.Threading.Thread.Sleep(3000);
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            _client = new Stream.StreamClient(
                "hcppd32schhy",
                "8e9smyj47fbkm2eezq8fxhr2bw45j8x88kqx3pzb9z4jbnxfs99tttkzsus8d8ym",
                new Stream.StreamClientOptions()
            {
                Location = Stream.StreamApiLocation.AsiaJapan
            });
            _user1 = _client.Feed("user", "11");
            _flat3 = _client.Feed("flat", "333");

            //System.Threading.Thread.Sleep(3000);
        }
Ejemplo n.º 4
0
        public void TokenIsValid()
        {
            var client = new StreamClient("key", "gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy");

            var feed = client.Feed("flat", "1");

            Assert.AreEqual("iFX1l5f_lIUWgZFBnv5UisTTW18", feed.Token);
        }
Ejemplo n.º 5
0
        public void Setup()
        {
            _client = new Stream.StreamClient(
                "98a6bhskrrwj",
                "t3nj7j8m6dtdbbakzbu9p7akjk5da8an5wxwyt6g73nt5hf9yujp8h4jw244r67p",
                new Stream.StreamClientOptions()
                {
                    Location = Stream.StreamApiLocation.USEast
                });
            _user1 = _client.Feed("user", "11");
            _flat3 = _client.Feed("flat", "333");
            _agg4 = _client.Feed("aggregate", "444");
            _not5 = _client.Feed("notification", "555");

            _user1.Delete().Wait();
            _agg4.Delete().Wait();
            _not5.Delete().Wait();
            //System.Threading.Thread.Sleep(3000);
        }
Ejemplo n.º 6
0
        public void Setup()
        {
            _client = new Stream.StreamClient(
                "98a6bhskrrwj",
                "t3nj7j8m6dtdbbakzbu9p7akjk5da8an5wxwyt6g73nt5hf9yujp8h4jw244r67p",
                new Stream.StreamClientOptions()
            {
                Location = Stream.StreamApiLocation.USEast
            });
            _user1 = _client.Feed("user", "11");
            _flat3 = _client.Feed("flat", "333");
            _agg4  = _client.Feed("aggregate", "444");
            _not5  = _client.Feed("notification", "555");

            _user1.Delete().Wait();
            _agg4.Delete().Wait();
            _not5.Delete().Wait();
            //System.Threading.Thread.Sleep(3000);
        }
Ejemplo n.º 7
0
        public void Setup()
        {
            _client = new Stream.StreamClient(
                "ea7xzzkj6kc4",
                "zd8cdv9rhxcpmkx9zx4jqt7q9qhawpgsfpay2gy7jaubym32crs9kaux2pm67wrx",
                new Stream.StreamClientOptions()
            {
                Location = Stream.StreamApiLocation.USWest
            });
            _user1 = _client.Feed("user", "11");
            _user2 = _client.Feed("user", "22");
            _flat3 = _client.Feed("flat", "333");
            _agg4  = _client.Feed("aggregate", "444");
            _not5  = _client.Feed("notification", "555");

            _user1.Delete().GetAwaiter().GetResult();
            _user2.Delete().GetAwaiter().GetResult();
            _flat3.Delete().GetAwaiter().GetResult();
            _agg4.Delete().GetAwaiter().GetResult();
            _not5.Delete().GetAwaiter().GetResult();
            System.Threading.Thread.Sleep(SetupDelay);
        }
Ejemplo n.º 8
0
        public async Task TestAddActivityTo()
        {
            var newActivity = new Stream.Activity("multi1", "test", "1")
            {
                To = new List <String>("flat:remotefeed1".Yield())
            };
            var addedActivity = await this._user1.AddActivity(newActivity);

            Assert.IsNotNull(addedActivity);
            Assert.IsNotNull(addedActivity.To);
            Assert.AreEqual(1, addedActivity.To.SafeCount());
            Assert.AreEqual("flat:remotefeed1", addedActivity.To.First());

            var activities = await _client.Feed("flat", "remotefeed1").GetActivities(0, 1);

            Assert.IsNotNull(activities);
            Assert.AreEqual(1, activities.Count());

            var first = activities.First();

            Assert.AreEqual("multi1", first.Actor);
        }