Class AuthenticationInterceptor

java.lang.Object
xyz.felh.openai.interceptor.AuthenticationInterceptor
All Implemented Interfaces:
okhttp3.Interceptor

public class AuthenticationInterceptor extends Object implements okhttp3.Interceptor
OkHttp Interceptor that adds an authorization token header
  • Constructor Details

    • AuthenticationInterceptor

      public AuthenticationInterceptor(String token)
      Constructor
      Parameters:
      token - OPENAI_API_KEY
    • AuthenticationInterceptor

      public AuthenticationInterceptor(String token, String orgId, String projectId)
      Constructor
      Parameters:
      token - OPENAI_API_KEY
      orgId - ORGANIZATION ID
      projectId - PROJECT ID
  • Method Details

    • intercept

      @NonNull public @NonNull okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException
      Specified by:
      intercept in interface okhttp3.Interceptor
      Throws:
      IOException