protected override async Task <ICursorResult <IEnumerable <long> > > GetUsersApiImpl(TwitterAccount info, long id, long cursor) { return((await info.CreateAccessor() .GetFollowersIdsAsync(new UserParameter(id), cursor, null, CancellationToken.None)) .Result); }
public void StartReceiveCore([NotNull] ListInfo info, TwitterAccount account = null) { lock (_listReceiverReferenceCount) { if (_listReceiverReferenceCount.ContainsKey(info)) { _listReceiverReferenceCount[info]++; } else { _listReceiverReferenceCount.Add(info, 1); var lparam = info.ToParameter(); _receiverDictionary.Add(info, lparam); lock (_listReceivers) { var accessor = (IApiAccessor)account?.CreateAccessor() ?? new RandomAccountAccessor(); long id = account?.Id ?? 0; if (!_listReceivers.TryGetValue(id, out var receiver)) { receiver = new ListReceiver(accessor, StatusInbox.Enqueue, BackstageModel.NotifyException); _listReceivers.Add(id, receiver); ReceiveManager.ReceiveEngine.RegisterReceiver(receiver); } receiver.AddList(lparam); } } } }
public void StartReceive(TwitterAccount account, ListInfo info) { lock (_listReceiverLocker) { if (_listReceiverReferenceCount.ContainsKey(info)) { _listReceiverReferenceCount[info]++; } else { _listReceiverReferenceCount.Add(info, 1); var listener = new ListMemberListener(account.CreateAccessor(), info); _receiverDictionary.Add(info, listener); listener.ListMemberChanged += (o, e) => ListMemberChanged?.Invoke(e); } } }
public UserReceiveBundle(TwitterAccount account) { _account = account; var accessor = account.CreateAccessor(); _streamAccessor = _account.CreateAccessor(EndpointType.StreamEndpoint, false); // user streams // _userStreamsReceiver = new UserStreamReceiver(streamAccessor, handler); _receivers = new IReceiver[] { // timelines new HomeTimelineReceiver(accessor, StatusInbox.Enqueue, BackstageModel.NotifyException), new MentionsReceiver(accessor, StatusInbox.Enqueue, BackstageModel.NotifyException), new DirectMessagesReceiver(accessor, StatusInbox.Enqueue, BackstageModel.NotifyException), new SentDirectMessagesReceiver(accessor, StatusInbox.Enqueue, BackstageModel.NotifyException), new UserTimelineReceiver(accessor, StatusInbox.Enqueue, BackstageModel.NotifyException, new UserParameter(_account.Id)), // relations new BlocksReceiver(accessor, blocks => Task.Run(() => _account.RelationData.Blockings.SetAsync(blocks)), BackstageModel.NotifyException), new FollowersReceiver(accessor, blocks => Task.Run(() => _account.RelationData.Followers.SetAsync(blocks)), BackstageModel.NotifyException), new FriendsReceiver(accessor, blocks => Task.Run(() => _account.RelationData.Followings.SetAsync(blocks)), BackstageModel.NotifyException), new MutesReceiver(accessor, blocks => Task.Run(() => _account.RelationData.Mutes.SetAsync(blocks)), BackstageModel.NotifyException), new NoRetweetsReceiver(accessor, blocks => Task.Run(() => _account.RelationData.NoRetweets.SetAsync(blocks)), BackstageModel.NotifyException) }; foreach (var receiver in _receivers) { ReceiveManager.ReceiveEngine.RegisterReceiver(receiver); } _disposable = new CompositeDisposable(accessor, _streamAccessor, _userStreamsReceiver); IsUserStreamsEnabled = account.IsUserStreamsEnabled; }