protected static async Task<IApiResult<IEnumerable<long>>> RetrieveCursoredResult(ApiAccessor accessor,
     Func<ApiAccessor, long, Task<IApiResult<ICursorResult<IEnumerable<long>>>>> func,
      Action<Exception> exceptionHandler, CancellationToken token)
 {
     var resultList = new List<long>();
     CursorResultExtension.ApiContinuationReader<IEnumerable<long>> reader =
         () => accessor.ReadCursorApi(func, token);
     var lastRateLimit = RateLimitDescription.Empty;
     while (reader != null)
     {
         try
         {
             var result = await reader().ConfigureAwait(false);
             resultList.AddRange(result.Item1.Result);
             lastRateLimit = result.Item1.RateLimit;
             reader = result.Item2;
         }
         catch (Exception ex)
         {
             exceptionHandler(ex);
             break;
         }
     }
     return ApiResult.Create(resultList, lastRateLimit);
 }
Exemplo n.º 2
0
 public DirectMessagesReceiver([NotNull] ApiAccessor accessor, [NotNull] Action<TwitterStatus> handler,
     [CanBeNull] Action<Exception> exceptionHandler, int receiveCount = 100) : base(handler, exceptionHandler)
 {
     if (accessor == null) throw new ArgumentNullException(nameof(accessor));
     _accessor = accessor;
     _receiveCount = receiveCount;
 }
Exemplo n.º 3
0
 public FriendsReceiver([NotNull] ApiAccessor accessor, [NotNull] Action<IEnumerable<long>> handler,
     [CanBeNull] Action<Exception> exceptionHandler)
     : base(handler, exceptionHandler)
 {
     if (accessor == null) throw new ArgumentNullException(nameof(accessor));
     _accessor = accessor;
 }
Exemplo n.º 4
0
 public SearchReceiver([NotNull] ApiAccessor accessor, Action<TwitterStatus> handler,
     [CanBeNull] Action<Exception> exceptionHandler, [NotNull] SearchParameter parameter) : base(handler, exceptionHandler)
 {
     if (accessor == null) throw new ArgumentNullException(nameof(accessor));
     if (parameter == null) throw new ArgumentNullException(nameof(parameter));
     _accessor = accessor;
     _parameter = parameter;
 }
Exemplo n.º 5
0
 public MentionsReceiver([NotNull] ApiAccessor accessor, [NotNull] Action<TwitterStatus> handler,
     [CanBeNull] Action<Exception> exceptionHandler, int receiveCount = 100, bool includeRetweets = false)
     : base(handler, exceptionHandler)
 {
     if (accessor == null) throw new ArgumentNullException(nameof(accessor));
     _accessor = accessor;
     _receiveCount = receiveCount;
     _includeRetweets = includeRetweets;
 }
Exemplo n.º 6
0
 public SavedSearchesReceiver([NotNull] ApiAccessor accessor,
     [NotNull] Action<IEnumerable<TwitterSavedSearch>> handler, [CanBeNull] Action<Exception> exceptionHandler)
     : base(exceptionHandler)
 {
     _accessor = accessor;
     _handler = handler;
     if (accessor == null) throw new ArgumentNullException(nameof(accessor));
     if (handler == null) throw new ArgumentNullException(nameof(handler));
 }
Exemplo n.º 7
0
 public UserInfoReceiver(ApiAccessor accessor, [NotNull] Action<TwitterUser> handler,
     [CanBeNull] Action<Exception> exceptionHandler, [NotNull] UserParameter target)
     : base(exceptionHandler)
 {
     if (handler == null) throw new ArgumentNullException(nameof(handler));
     if (target == null) throw new ArgumentNullException(nameof(target));
     _accessor = accessor;
     _handler = handler;
     _target = target;
 }
Exemplo n.º 8
0
 public UserTimelineReceiver([NotNull] ApiAccessor accessor, [NotNull] Action<TwitterStatus> handler,
     [CanBeNull] Action<Exception> exceptionHandler, [NotNull] UserParameter target, int receiveCount = 100,
     bool excludeReplies = false, bool includeRetweets = true) : base(handler, exceptionHandler)
 {
     if (accessor == null) throw new ArgumentNullException(nameof(accessor));
     if (target == null) throw new ArgumentNullException(nameof(target));
     _accessor = accessor;
     _target = target;
     _receiveCount = receiveCount;
     _excludeReplies = excludeReplies;
     _includeRetweets = includeRetweets;
 }
Exemplo n.º 9
0
 public UserStreamReceiver(ApiAccessor accessor, IStreamHandler handler)
 {
     _accessor = accessor;
     _handler = handler;
     ChangeState(StreamState.Disconnected);
     // set default values to parameters
     StallWarnings = true;
     StreamFilterLevel = StreamFilterLevel.None;
     _currentState = StreamState.Connected;
     _backoffMode = BackoffMode.None;
     _backoffWait = 0;
     _hardErrorCount = 0;
 }
Exemplo n.º 10
0
 public StreamWaitMessage(ApiAccessor accessor, long waitSec)
 {
     Accessor = accessor;
     WaitSec = waitSec;
 }
Exemplo n.º 11
0
 public StreamErrorMessage(ApiAccessor accessor, HttpStatusCode hcode, TwitterErrorCode? tcode)
 {
     Accessor = accessor;
     Code = hcode;
     TwitterErrorCode = tcode;
 }
 public SalesApiAccessor(ISalesNotifier accountSummaryNotifier)
 {
     this.AccountSummaryNotifier = accountSummaryNotifier;
     this.clientAccountApi       = ApiAccessor.Get <IClientAccountApi>();
 }
 public UniquesUpdater(HttpClient httpClient, string basePath)
 {
     _apiAccessor = new ApiAccessor(httpClient);
     _savePath    = basePath + "PoESkillTree.Engine.GameModel/Data/Uniques.xml";
 }