Exemplo n.º 1
0
        public ResourceRateLimit(RateLimit core, RateLimit search)
        {
            Ensure.ArgumentNotNull(core, "core");
            Ensure.ArgumentNotNull(search, "search");

            Core   = core;
            Search = search;
        }
        public MiscellaneousRateLimit(ResourceRateLimit resources, RateLimit rate)
        {
            Ensure.ArgumentNotNull(resources, "resource");
            Ensure.ArgumentNotNull(rate, "rate");

            Resources = resources;
            Rate = rate;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructs an instance of RateLimitExceededException
        /// </summary>
        /// <param name="response">The HTTP payload from the server</param>
        /// <param name="innerException">The inner exception</param>
        public RateLimitExceededException(IResponse response, Exception innerException) : base(response, innerException)
        {
            Ensure.ArgumentNotNull(response, nameof(response));

            _rateLimit = response.ApiInfo.RateLimit;

            _severTimeDiff = response.ApiInfo.ServerTimeDifference;
        }
Exemplo n.º 4
0
        public ResourceRateLimit(RateLimit core, RateLimit search)
        {
            Ensure.ArgumentNotNull(core, "core");
            Ensure.ArgumentNotNull(search, "search");

            Core = core;
            Search = search;
        }
        public MiscellaneousRateLimit(ResourceRateLimit resources, RateLimit rate)
        {
            Ensure.ArgumentNotNull(resources, "resource");
            Ensure.ArgumentNotNull(rate, "rate");

            Resources = resources;
            Rate      = rate;
        }
        public ResourceRateLimit(RateLimit core, RateLimit search)
        {
            Ensure.ArgumentNotNull(core, nameof(core));
            Ensure.ArgumentNotNull(search, nameof(search));

            Core   = core;
            Search = search;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Allows you to clone ApiInfo
 /// </summary>
 /// <returns>A clone of <seealso cref="ApiInfo"/></returns>
 public ApiInfo Clone()
 {
     return(new ApiInfo(Links.Clone(),
                        OauthScopes.Clone(),
                        AcceptedOauthScopes.Clone(),
                        Etag != null ? new string(Etag.ToCharArray()) : null,
                        RateLimit != null ? RateLimit.Clone() : null,
                        ServerTimeDifference));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Constructs an instance of RateLimitExceededException
 /// </summary>
 /// <param name="info">
 /// The <see cref="SerializationInfo"/> that holds the
 /// serialized object data about the exception being thrown.
 /// </param>
 /// <param name="context">
 /// The <see cref="StreamingContext"/> that contains
 /// contextual information about the source or destination.
 /// </param>
 protected RateLimitExceededException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _rateLimit = info.GetValue("RateLimit", typeof(RateLimit)) as RateLimit
                  ?? new RateLimit(new Dictionary <string, string>());
     if (info.GetValue(nameof(ApiInfo.ServerTimeDifference), typeof(TimeSpan)) is TimeSpan serverTimeDiff)
     {
         _severTimeDiff = serverTimeDiff;
     }
 }
Exemplo n.º 9
0
        public ApiInfo(IDictionary<string, Uri> links,
            IList<string> oauthScopes,
            IList<string> acceptedOauthScopes,
            string etag,
            RateLimit rateLimit)
        {
            Ensure.ArgumentNotNull(links, "links");
            Ensure.ArgumentNotNull(oauthScopes, "oauthScopes");

            Links = new ReadOnlyDictionary<string, Uri>(links);
            OauthScopes = new ReadOnlyCollection<string>(oauthScopes);
            AcceptedOauthScopes = new ReadOnlyCollection<string>(acceptedOauthScopes);
            Etag = etag;
            RateLimit = rateLimit;
        }
Exemplo n.º 10
0
        public ApiInfo(IDictionary <string, Uri> links,
                       IList <string> oauthScopes,
                       IList <string> acceptedOauthScopes,
                       string etag,
                       RateLimit rateLimit)
        {
            Ensure.ArgumentNotNull(links, "links");
            Ensure.ArgumentNotNull(oauthScopes, "oauthScopes");

            Links               = new ReadOnlyDictionary <string, Uri>(links);
            OauthScopes         = new ReadOnlyCollection <string>(oauthScopes);
            AcceptedOauthScopes = new ReadOnlyCollection <string>(acceptedOauthScopes);
            Etag      = etag;
            RateLimit = rateLimit;
        }
Exemplo n.º 11
0
        public ApiInfo(IDictionary <string, Uri> links,
                       IList <string> oauthScopes,
                       IList <string> acceptedOauthScopes,
                       string etag,
                       RateLimit rateLimit,
                       TimeSpan serverTimeDifference = default)
        {
            Ensure.ArgumentNotNull(links, nameof(links));
            Ensure.ArgumentNotNull(oauthScopes, nameof(oauthScopes));
            Ensure.ArgumentNotNull(acceptedOauthScopes, nameof(acceptedOauthScopes));

            Links               = new ReadOnlyDictionary <string, Uri>(links);
            OauthScopes         = new ReadOnlyCollection <string>(oauthScopes);
            AcceptedOauthScopes = new ReadOnlyCollection <string>(acceptedOauthScopes);
            Etag                 = etag;
            RateLimit            = rateLimit;
            ServerTimeDifference = serverTimeDifference;
        }
Exemplo n.º 12
0
 /// <summary>
 /// Constructs an instance of RateLimitExceededException
 /// </summary>
 /// <param name="info">
 /// The <see cref="SerializationInfo"/> that holds the
 /// serialized object data about the exception being thrown.
 /// </param>
 /// <param name="context">
 /// The <see cref="StreamingContext"/> that contains
 /// contextual information about the source or destination.
 /// </param>
 protected RateLimitExceededException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _rateLimit = info.GetValue("RateLimit", typeof(RateLimit)) as RateLimit
                  ?? new RateLimit(new Dictionary <string, string>());
 }
        /// <summary>
        /// Constructs an instance of RateLimitExceededException
        /// </summary>
        /// <param name="response">The HTTP payload from the server</param>
        /// <param name="innerException">The inner exception</param>
        public RateLimitExceededException(IResponse response, Exception innerException) : base(response, innerException)
        {
            Ensure.ArgumentNotNull(response, "response");

            _rateLimit = response.ApiInfo.RateLimit;
        }
 protected RateLimitExceededException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _rateLimit = info.GetValue("RateLimit", typeof(RateLimit)) as RateLimit
                  ?? new RateLimit(new Dictionary<string, string>());
 }
        public RateLimitExceededException(IResponse response, Exception innerException) : base(response, innerException)
        {
            Ensure.ArgumentNotNull(response, "response");

            _rateLimit = response.ApiInfo.RateLimit;
        }