Contacts

Web Chat Core SDK

Get User Detail

import User from '../../models/User';
import BaseClient, { BaseResponse, METHODS } from '../../base';

const ENDPOINT = '/rest/ws/user/v2/detail';

export interface UserDetailsApi {
  (userIdList: string[]): Promise<User[]>;
}

const userDetailsBuilder = (applozicClient: BaseClient): UserDetailsApi => {
  const userDetailsApi: UserDetailsApi = async userIdList => {
    const response: BaseResponse<User[]> = await applozicClient.makeApiCall(
      METHODS.POST,
      ENDPOINT,
      {
        data: {
          userIdList
        },
        useAuth: true
      }
    );
    return response.response;
  };
  return userDetailsApi;
};

export default userDetailsBuilder;

Block User

import BaseClient, { METHODS } from '../../base';

const ENDPOINT = '/rest/ws/user/block';

interface BlockUserRes {
  status: string;
  generatedAt: number;
  response?: string;
}

export interface BlockUserApi {
  (userId: string): Promise<BlockUserRes>;
}

const blockUserBuilder = (applozicClient: BaseClient): BlockUserApi => {
  const blockUserApi: BlockUserApi = async (userId) => {
    const response: BlockUserRes = await applozicClient.makeApiCall(
      METHODS.GET,
      ENDPOINT,
      {
        query: { userId },
        useAuth: true
      }
    );
    return response;
  };
  return blockUserApi;
};

export default blockUserBuilder;

Unblock User

import BaseClient, { METHODS } from '../../base';

const ENDPOINT = '/rest/ws/user/unblock';

interface UnblockUserRes {
  status: string;
  generatedAt: number;
  response?: string;
}

export interface UnblockUserApi {
  (userId: string): Promise<UnblockUserRes>;
}

const unblockUserBuilder = (applozicClient: BaseClient): UnblockUserApi => {
  const unblockUserApi: UnblockUserApi = async (userId) => {
    const response: UnblockUserRes = await applozicClient.makeApiCall(
      METHODS.GET,
      ENDPOINT,
      {
        query: { userId },
        useAuth: true
      }
    );
    return response;
  };
  return unblockUserApi;
};

export default unblockUserBuilder;

What’s Next
Did this page help you?