Class DonationAlertsUsersApi

Donation Alerts Users API.

Provides methods to interact with Donation Alerts users, including retrieving user profiles and socket connection tokens.

Hierarchy

  • BaseApi
    • DonationAlertsUsersApi

Methods

  • Fetches a Centrifugo connection token required for establishing real-time socket connections for the specified user.

    Parameters

    • user: UserIdResolvable

      The ID of the user for whom the token is being fetched.

    • OptionalrateLimiterOptions: RateLimiterRequestOptions

      Optional rate limiter configuration to control API requests.

    Returns Promise<string>

    A string containing the user's socket connection token.

    This method internally uses getUser method to fetch the profile of the user, then extracts the socketConnectionToken property.

    HttpError if the response status code falls outside the 200–299 range.

    UnregisteredUserError if the specified user is not registered in the authentication provider.

    MissingScopeError if the provided access token is missing the required oauth-user-show scope.

    const token = await apiClient.users.getSocketConnectionToken(authenticatedUserId);
    console.log(`Socket connection token: ${token}`);
  • Fetches the authenticated user's information based on the provided user ID.

    Parameters

    • user: UserIdResolvable

      The ID of the user whose profile needs to be fetched.

    • OptionalrateLimiterOptions: RateLimiterRequestOptions

      Optional rate limiter configuration to control API requests.

    Returns Promise<DonationAlertsUser>

    A DonationAlertsUser instance containing the user's profile information.

    Requires oauth-user-show scope.

    HttpError if the response status code falls outside the 200–299 range.

    UnregisteredUserError if the specified user is not registered in the authentication provider.

    MissingScopeError if the provided access token is missing the required oauth-user-show scope.

    const user = await apiClient.users.getUser(userId);
    console.log(`User ID: ${user.id}, Name: ${user.name}`);