import { Facebook } from '@ionic-native/facebook'; import { GooglePlus } from '@ionic-native/google-plus'; import { Storage } from '@ionic/storage'; import { Platform, ModalController, ModalOptions, Modal } from 'ionic-angular'; import { ICoreoLoginComponentOptions } from './components/login/login.component'; import { CoreoAuthToken, CoreoClient, CoreoConfig, CoreoTokenContext, CoreoUser } from '@coreo/ionic-core'; /** * Container for the result of authentication */ export interface CoreoAuthError { status: number; msg: string; } export declare type CoreoAuthResult = CoreoAuthToken | CoreoAuthError; export declare type CoreoAuthMethod = 'basic' | 'google' | 'facebook' | 'twitter'; export interface CoreoAuthModules { basic: CoreoAuthType; google: CoreoAuthType; [key: string]: CoreoAuthType; } export interface CoreoAuthCredentials { email: string; password: string; projectId?: number; } export interface CoreoOAuthConfig { projectId: number; webClientId?: string; } export declare type CoreoAuthLoginOptions = CoreoAuthCredentials | CoreoOAuthConfig; export interface CoreoAuthType { login(params: CoreoAuthLoginOptions): Promise; logout(): Promise; signup?(email: string, password: string, displayName: string, username: string): Promise; } export declare class BasicAuth implements CoreoAuthType { private client; private platform; private config; constructor(client: CoreoClient, platform: Platform, config: CoreoConfig); login(credentials: CoreoAuthCredentials): Promise; logout(): Promise; signup(email: string, password: string, displayName: string, username: string): Promise; } /** * Google OAuth */ export declare class GoogleAuth implements CoreoAuthType { private client; private platform; private google; constructor(client: CoreoClient, platform: Platform, google: GooglePlus); login(config: CoreoOAuthConfig): Promise; logout(): Promise; } /** * Facebook OAuth */ export declare class FacebookAuth implements CoreoAuthType { private client; private platform; private facebook; constructor(client: CoreoClient, platform: Platform, facebook: Facebook); login(config: CoreoOAuthConfig): Promise; logout(): Promise; } /** * Coreo Auth Service */ export declare class CoreoAuth { private tokenContext; private client; private platform; private user; private config; private storage; private google; private facebook; private modalCtrl; modules: CoreoAuthModules; context: CoreoAuthType; constructor(tokenContext: CoreoTokenContext, client: CoreoClient, platform: Platform, user: CoreoUser, config: CoreoConfig, storage: Storage, google: GooglePlus, facebook: Facebook, modalCtrl: ModalController); /** * Login method */ login(method: CoreoAuthMethod, params?: CoreoAuthLoginOptions): Promise; /** * Signup Method */ signup(email: string, password: string, displayName: string, username: string): Promise; /** * Logout Method */ logout(): Promise; reset(): void; /** * Get Profile */ profile(): Promise; /** * Update username */ updateUsername(username: string): Promise; /** * Send Password Reset */ sendPasswordReset(email: string): Promise; /** * Create Login Modal */ loginModal(options?: ICoreoLoginComponentOptions, modalOptions?: ModalOptions): Modal; } export default CoreoAuth;