"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getAmityUser = getAmityUser;
exports.reportUser = reportUser;
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
async function reportUser(userId) {
  return await new Promise((resolve, reject) => {
    const query = (0, _tsSdkReactNative.createQuery)(_tsSdkReactNative.createReport, 'user', userId);
    (0, _tsSdkReactNative.runQuery)(query, options => {
      if (options.loading === false) {
        if (options.data !== undefined) {
          return resolve(options.data);
        } else {
          return reject(new Error('Unable to report user ' + options.error));
        }
      }
    });
  });
}
async function getAmityUser(userId) {
  return await new Promise((resolve, reject) => {
    const unsubscribe = _tsSdkReactNative.UserRepository.getUser(userId, userObject => {
      if (userObject) {
        resolve({
          userObject,
          unsubscribe
        });
      } else {
        reject(userObject.error);
      }
    });
  });
}
//# sourceMappingURL=user.js.map