Class WorkersAiClient.AuthInterceptor

java.lang.Object
dev.langchain4j.model.workersai.client.WorkersAiClient.AuthInterceptor
All Implemented Interfaces:
okhttp3.Interceptor
Enclosing class:
WorkersAiClient

public static class WorkersAiClient.AuthInterceptor extends Object implements okhttp3.Interceptor
An interceptor for HTTP requests to add an authorization token to the header. Implements the Interceptor interface.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface okhttp3.Interceptor

    okhttp3.Interceptor.Chain, okhttp3.Interceptor.Companion
  • Field Summary

    Fields inherited from interface okhttp3.Interceptor

    Companion
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an AuthInterceptor with a specified authorization token.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull okhttp3.Response
    intercept(okhttp3.Interceptor.Chain chain)
    Intercepts an outgoing HTTP request, adding an authorization header.

    Methods inherited from class java.lang.Object

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

    • AuthInterceptor

      public AuthInterceptor(String apiToken)
      Constructs an AuthInterceptor with a specified authorization token.
      Parameters:
      apiToken - The authorization token to be used in HTTP headers.
  • Method Details

    • intercept

      @NotNull public @NotNull okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException
      Intercepts an outgoing HTTP request, adding an authorization header.
      Specified by:
      intercept in interface okhttp3.Interceptor
      Parameters:
      chain - The chain of request/response interceptors.
      Returns:
      The modified response after adding the authorization header.
      Throws:
      IOException - If an IO exception occurs during request processing.