Class WorkersAiClient.AuthInterceptor
java.lang.Object
dev.langchain4j.model.workersai.client.WorkersAiClient.AuthInterceptor
- All Implemented Interfaces:
okhttp3.Interceptor
- Enclosing class:
WorkersAiClient
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
ConstructorDescriptionAuthInterceptor
(String apiToken) Constructs an AuthInterceptor with a specified authorization token. -
Method Summary
Modifier and TypeMethodDescription@NotNull okhttp3.Response
intercept
(okhttp3.Interceptor.Chain chain) Intercepts an outgoing HTTP request, adding an authorization header.
-
Constructor Details
-
AuthInterceptor
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 interfaceokhttp3.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.
-