Class 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 Client and 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> TService create​(java.lang.Class<TService> svcClass)
      Creates a service proxy that automatically injects the user token into all requests.
      @NotNull java.lang.String getApiKey()
      Returns the API key from the underlying client.
      @NotNull java.lang.String getApiSecret()
      Returns the API secret from the underlying client.
      void setTimeout​(@NotNull java.time.Duration timeoutDuration)
      Sets the request timeout duration on the underlying client.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.getstream.chat.java.services.framework.Client

        create
    • 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 to
        userToken - 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.
        Specified by:
        create in interface Client
        Type Parameters:
        TService - the service type
        Parameters:
        svcClass - the service interface class
        Returns:
        a proxy instance of the service with user token injection
      • getApiKey

        @NotNull
        public @NotNull java.lang.String getApiKey()
        Returns the API key from the underlying client.
        Specified by:
        getApiKey in interface Client
        Returns:
        the API key
      • getApiSecret

        @NotNull
        public @NotNull java.lang.String getApiSecret()
        Returns the API secret from the underlying client.
        Specified by:
        getApiSecret in interface Client
        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:
        setTimeout in interface Client
        Parameters:
        timeoutDuration - the timeout duration to set