Esempio n. 1
0
        public void UpdateNotifications(ObjectId userId, int amount)
        {
            var token = GetOfflineToken(userId);

            if (string.IsNullOrEmpty(token))
            {
                _log.Warn("Couldn't update notifications for " + userId + ". The user has no offline token");
                return;
            }

            var hash          = _hashService.CreateSignature(token, _applicationSettings.AppSecret);
            var requestParams = new[] {
                new KeyValuePair <string, object>("token", token),
                new KeyValuePair <string, object>("hash", hash),
                new KeyValuePair <string, object>("notificationsCount", amount)
            };

            _platformProxy.GetWithoutContext <string>(_servicePath + "/notifications/update-count", requestParams);
        }
Esempio n. 2
0
        public List <SocialUserInfo> GetUsersGetWithoutContext(IList <long> ids)
        {
            var token        = _authService.GetOfflineToken(2);
            var hash         = _hashService.CreateSignature(token, _applicationSettings.AppSecret);
            var requestIds   = ids.Select(val => new KeyValuePair <string, object>("ids", new long[] { val })).ToArray();
            var requestToken = new[]
            {
                new KeyValuePair <string, object>("token", token),
                new KeyValuePair <string, object>("hash", hash)
            };
            var requestParams = requestIds.Concat(requestToken).ToArray();

            var res = _platformProxy.GetWithoutContext <List <SocialUserInfo> >(_servicePath + "/get", requestParams);

            return(res);
        }