Class UserClient
- java.lang.Object
-
- io.getstream.chat.java.services.framework.UserClient
-
- All Implemented Interfaces:
Client
public final class UserClient extends java.lang.Object implements Client
Client implementation for user-scoped API operations.This client wraps a base
Clientand automatically injects a user-specific authentication token into all service calls. It's designed for scenarios where different users need to make authenticated API calls without creating separate client instances per user.- See Also:
Client
-
-
Constructor Summary
Constructors Constructor Description UserClient(Client delegate, java.lang.String userToken)Constructs a new UserClient that wraps the provided client with user authentication.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <TService> TServicecreate(java.lang.Class<TService> svcClass)Creates a service proxy that automatically injects the user token into all requests.@NotNull java.lang.StringgetApiKey()Returns the API key from the underlying client.@NotNull java.lang.StringgetApiSecret()Returns the API secret from the underlying client.voidsetTimeout(@NotNull java.time.Duration timeoutDuration)Sets the request timeout duration on the underlying client.
-
-
-
Constructor Detail
-
UserClient
public UserClient(Client delegate, java.lang.String userToken)
Constructs a new UserClient that wraps the provided client with user authentication.- Parameters:
delegate- the base client to delegate calls touserToken- the user-specific authentication token to inject into requests
-
-
Method Detail
-
create
@NotNull public <TService> TService create(java.lang.Class<TService> svcClass)
Creates a service proxy that automatically injects the user token into all requests.
-
getApiKey
@NotNull public @NotNull java.lang.String getApiKey()
Returns the API key from the underlying client.
-
getApiSecret
@NotNull public @NotNull java.lang.String getApiSecret()
Returns the API secret from the underlying client.- Specified by:
getApiSecretin interfaceClient- Returns:
- the API secret
-
setTimeout
public void setTimeout(@NotNull @NotNull java.time.Duration timeoutDuration)Sets the request timeout duration on the underlying client.- Specified by:
setTimeoutin interfaceClient- Parameters:
timeoutDuration- the timeout duration to set
-
-