Class RateLimitInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    public class RateLimitInterceptor
    extends java.lang.Object
    implements okhttp3.Interceptor
    Get informed when ever a rate limit header is encountered.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface okhttp3.Interceptor

        okhttp3.Interceptor.Chain
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
      Intercept a http call.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RateLimitInterceptor

        public RateLimitInterceptor​(RateLimitsListener listener)
        Create a new ratelimit interceptor.
        Parameters:
        listener - an object to be informed once a rate limit header is encountered.
        Throws:
        java.lang.IllegalArgumentException - if listener is null.
    • Method Detail

      • intercept

        public okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
                                   throws java.io.IOException
        Intercept a http call.
        Specified by:
        intercept in interface okhttp3.Interceptor
        Parameters:
        chain - the current chain of calls.
        Returns:
        a response from this call.
        Throws:
        java.io.IOException - if something goes wrong.