Пример #1
0
        internal static string ToActivitiesJson(IEnumerable <Activity> activities, StreamClient client)
        {
            var acts = new JArray(from a in activities select a.ToJObject(client));
            var obj  = new JObject(new JProperty("activities", acts));

            return(obj.ToString());
        }
Пример #2
0
        public void TokenIsValid()
        {
            var client = new StreamClient("key", "gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy");

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

            Assert.AreEqual("iFX1l5f_lIUWgZFBnv5UisTTW18", feed.Token);
        }
 public FeedEntryController(FeedItemRepository feedItemRepository,
                            ActivityRepository activityRepository,
                            JunaUserRepository userRepository,
                            Stream.StreamClient streamClient,
                            IdentityHelper identityHelper)
 {
     _feedItemRepository = feedItemRepository;
     _activityRepository = activityRepository;
     _userRepository     = userRepository;
     _streamClient       = streamClient;
     _identityHelper     = identityHelper;
 }
        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);
        }
Пример #5
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);
        }
Пример #6
0
        internal StreamFeed(StreamClient client, string feedSlug, string userId)
        {
            if (!_feedRegex.IsMatch(feedSlug))
            {
                throw new ArgumentException("Feed slug can only contain alphanumeric characters or underscores");
            }
            if (!_userRegex.IsMatch(userId))
            {
                throw new ArgumentException("User id can only contain alphanumeric characters, underscores or dashes");
            }

            _client      = client;
            _feedSlug    = feedSlug;
            _userId      = userId;
            UrlPath      = string.Format("feed/{0}/{1}", _feedSlug, _userId);
            EnrichedPath = "enrich/" + UrlPath;
        }
Пример #7
0
        internal StreamFeed(StreamClient client, String feedSlug, String userId, String token)
        {
            if (!_feedRegex.IsMatch(feedSlug))
            {
                throw new ArgumentException("Feed slug can only contain alphanumeric characters or underscores");
            }
            if (!_userRegex.IsMatch(userId))
            {
                throw new ArgumentException("User id can only contain alphanumeric characters, underscores or dashes");
            }

            Token       = token;
            _client     = client;
            _feedSlug   = feedSlug;
            _userId     = userId;
            FeedTokenId = String.Format("{0}{1}", _feedSlug, _userId);
            UrlPath     = String.Format("feed/{0}/{1}", _feedSlug, _userId);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
0
        internal JObject ToJObject(StreamClient client)
        {
            JObject obj = new JObject(
                new JProperty(Field_Actor, this.Actor),
                new JProperty(Field_Verb, this.Verb),
                new JProperty(Field_Object, this.Object));

            if (Time.HasValue)
            {
                obj.Add(new JProperty(Field_Time, this.Time.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture)));
            }

            if (!string.IsNullOrWhiteSpace(ForeignId))
            {
                obj.Add(new JProperty(Field_ForeignId, this.ForeignId));
            }

            if (!string.IsNullOrWhiteSpace(Target))
            {
                obj.Add(new JProperty(Field_Target, this.Target));
            }

            if (To.SafeCount() > 0)
            {
                JArray toArray = new JArray();
                To.ForEach((st) =>
                {
                    toArray.Add(st);
                });
                obj.Add(new JProperty(Field_To, toArray));
            }

            if (_data.SafeCount() > 0)
            {
                _data.Keys.ForEach((k) =>
                {
                    obj.Add(new JProperty(k, _data[k]));
                });
            }

            return(obj);
        }
Пример #11
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);
        }
Пример #12
0
 internal Personalization(StreamClient client)
 {
     _client = client;
 }
Пример #13
0
 internal string ToJson(StreamClient client)
 {
     return(ToJObject(client).ToString());
 }
Пример #14
0
 internal BatchOperations(StreamClient client)
 {
     _client = client;
 }
Пример #15
0
 internal Users(StreamClient client)
 {
     _client = client;
 }
Пример #16
0
 internal Collections(StreamClient client)
 {
     _client = client;
 }
Пример #17
0
 internal Reactions(StreamClient client)
 {
     _client = client;
 }