@smartface/plugin-firebase
Version:
Smartface Firebase Plugin for Smartface Native Framework
244 lines (243 loc) • 6.78 kB
TypeScript
import AuthError from '../Auth/authErrors';
declare type UserErrorBody = {
code?: AuthError;
description: string;
};
declare type UserCallback = (User: any, options?: {
error: UserErrorBody;
isSuccess?: boolean;
email?: string;
token?: string;
}) => void | ((arg: boolean) => void);
export default class User {
nativeObject: any;
ios: {};
static ios: {};
constructor(nativeUser?: any);
/**
* Returns the main email address of the user, as stored in the Firebase project's user database.
*
* @method getEmail
* @android
* @ios
* @since 0.1
*/
getEmail: () => string;
/**
* Returns the main display name of this user from the Firebase project's user database.
*
* @method getDisplayName
* @android
* @ios
* @since 0.1
*/
getDisplayName: () => string;
/**
* Set displayName.
*
* @method setDisplayName
* @param {String} displayName
* @param {Function} callback
* @param {String} callback.token
* @param {String} callback.error
* @android
* @ios
* @since 0.1
*/
setDisplayName: (name: string, callback: UserCallback) => void;
/**
* Returns the URL of this user's main profile picture, as stored in the Firebase project's user database.
*
* @method getPhotoURL
* @android
* @ios
* @since 0.1
*/
getPhotoURL: () => string;
/**
* Set photoURL.
*
* @method setPhotoURL
* @param {String} photoURL
* @param {Function} callback
* @param {String} callback.token
* @param {String} callback.error
* @android
* @ios
* @since 0.1
*/
setPhotoURL: (url: string, callback: UserCallback) => void;
/**
* Initiates email verification for the user.
*
* Possible error code;
* + `UserNotFound` - Indicates the user account was not found.
* + `UserDisabled`
* + `InvalidUserToken`
* + `UserTokenExpired`
*
* @method sendEmailVerification
* @param {Function} callback
* @param {Boolean} callback.isSuccess
* @param {Object} callback.error
* @param {String} callback.error.code
* @param {String} callback.error.description
* @android
* @ios
* @since 0.1
*/
sendEmailVerification: (callback: UserCallback) => void;
/**
* Indicates the email address associated with this user has been verified.
*
* @method isEmailVerified
* @return {Boolean} verified
* @android
* @ios
* @since 0.1
*/
isEmailVerified: () => boolean;
/**
* Update email.
*
* Possible error code;
* + `EmailAlreadyInUse`
* + `InvalidEmail`
* + `RequiresRecentLogin`
*
* @method updateEmail
* @param {String} email
* @param {Function} callback
* @param {Boolean} callback.isSuccess
* @param {Object} callback.error
* @param {String} callback.error.code
* @param {String} callback.error.description
* @android
* @ios
* @since 0.1
*/
updateEmail: (email: string, callback: UserCallback) => void;
/**
* Update password.
*
* Possible error code;
* + `OperationNotAllowed`
* + `WeakPassword`
* + `RequiresRecentLogin`
*
* @method updatePassword
* @param {String} password
* @param {Function} callback
* @param {Boolean} callback.isSuccess
* @param {Object} callback.error
* @param {String} callback.error.code
* @param {String} callback.error.description
* @android
* @ios
* @since 0.1
*/
updatePassword: (password: string, callback: UserCallback) => void;
/**
* Reloads the user’s profile data from the server.
*
* Possible error code;
* `RequiresRecentLogin` - Updating email is a security sensitive
operation that requires a recent login from the user. This error indicates the user
has not signed in recently enough.
*
* @method reload
* @param {Function} callback
* @param {Boolean} callback.isSuccess
* @param {Object} callback.error
* @param {String} callback.error.code
* @param {String} callback.error.description
* @android
* @ios
* @since 0.1
*/
reload: (callback: UserCallback) => void;
/**
* Deletes the user record from your Firebase project's database.
* If the operation is successful, the user will be signed out.
*
* Possible error code;
* `RequiresRecentLogin` - Updating email is a security sensitive
operation that requires a recent login from the user. This error indicates the user
has not signed in recently enough.
*
* @method delete
* @param {Function} callback
* @param {Boolean} callback.isSuccess
* @param {Object} callback.error
* @param {String} callback.error.code
* @param {String} callback.error.description
* @android
* @ios
* @since 0.1
*/
delete: (callback: UserCallback) => void;
/**
* Reauthenticate.
*
* Possible error code;
* + `OperationNotAllowed`
* + `UserDisabled`
* + `WrongPassword`
* + `UserMismatch`
* + `InvalidEmail`
*
* @method reauthenticate
* @param {String} email
* @param {String} password
* @param {Function} callback
* @param {Boolean} callback.isSuccess
* @param {Object} callback.error
* @param {String} callback.error.code
* @param {String} callback.error.description
* @android
* @ios
* @since 0.1
*/
reauthenticate: (email: string, password: string, callback: UserCallback) => void;
/**
* Returns the phone number of the user, as stored in the Firebase project's user database, or null if none exists
*
* @method getPhoneNumber
* @android
* @ios
* @since 0.1
*/
getPhoneNumber: () => any;
/**
* Returns a string used to uniquely identify your user in your Firebase project's user database.
*
* @method getUID
* @android
* @ios
* @since 0.1
*/
getUID: () => string;
/**
* Returns true if the user is anonymous.
*
* @method isAnonymous
* @android
* @ios
* @since 0.1
*/
isAnonymous: () => boolean;
/**
* Returns token.
*
* @method getIdToken
* @param {Boolean} forceRefresh
* @param {Function} callback
* @param {String} callback.token
* @param {String} callback.error
* @android
* @ios
* @since 0.1
*/
getIdToken: (forceRefresh: boolean, callback: UserCallback) => void;
}
export {};