Home Reference Source

src/Sippo.ts

import {Session} from './session/Session';
import {SessionConfig} from './session/SessionConfig';

/**
 * Factory method for session creation
 * @param {string} issuer The authorization token issuer identifier
 * @param {string} token The authorization token from the given issuer
 * @param {Object} config Session configuration
 * @param {string} config.wacUri The address where the WAC is available
 * @param {string} config.applicationToken A token for the application
 * @param {string} config.deviceId string which identifies the device this session belongs to
 * @return {Promise<Session>} A promise of a new SippoJS session
 */
export function createSession(issuer: string, token: string, config: SessionConfig): Promise<Session> {
	const session = Session.withOAuth2(issuer, token, config);
	return Promise.resolve(session);
}

/**
 * Factory method for session recovery
 * @param {string} token The authorization token
 * @param {Object} config Session configuration
 * @param {string} config.wacUri The address where the WAC is available
 * @param {string} config.applicationToken A token for the application
 * @param {string} config.deviceId string which identifies the device this session belongs to
 * @return {Promise<Session>} A promise of a new SippoJS session
 */
export function recoverSession(token: string, config: SessionConfig): Promise<Session> {
	const session = Session.withSessionToken(token, config);
	return Promise.resolve(session);
}

/**
 * Allows obtaining the available providers enabled in the specified WAC instance
 * @param {string} wacUri The address where the WAC is available
 * @return {Promise<ProviderInfo[]>} A promise with an array with information for each provider
 */
export function getAuthProviders(wacUri: string): Promise<AuthProvider[]> {
	return window.fetch(`${wacUri}/sapi/oauth2/providers`).then(response => response.json());
}

export interface AuthProvider {
	authorization_endpoint: string;
	displayName: string;
	grant_type: string;
	id: string;
	revocation_endpoint: string;
	scope: string;
	signout_endpoint?: string;
	token_endpoint?: string;
	tokenInfo: string;
	uid: string;
	uidType: string;
}

export * from './calls/Call';
export * from './calls/CallDirection';
export * from './calls/CallEndReason';
export * from './calls/CallLog';
export * from './calls/CallLogEntry';
export * from './calls/CallManager';
export * from './calls/CallRemoteRecorder';
export * from './calls/CallStatus';
export * from './calls/RemoteCall';

export * from './chat/Chat';
export * from './chat/ChatManager';
export * from './chat/ChatMessage';
export * from './chat/ChatMessageDirection';
export * from './chat/ChatMessageFile';
export * from './chat/ChatMessageStatus';
export * from './chat/ChatMessageType';
export * from './chat/ChatParticipantRole';
export * from './chat/ChatParticipantState';
export * from './chat/ChatType';
export * from './chat/SupportChat';

export * from './conferences/Conference';
export * from './conferences/ConferenceEndReason';
export * from './conferences/ConferenceInvite';
export * from './conferences/ConferenceLog';
export * from './conferences/ConferenceLogEntry';
export * from './conferences/ConferenceManager';
export * from './conferences/ConferenceStatus';
export * from './conferences/Invitation';
export * from './conferences/errors/AccessBeforeTimeError';
export * from './conferences/errors/WrongPasswordError';

export * from './contacts/Contact';
export * from './contacts/ContactManager';
export * from './contacts/OwnPresence';
export * from './contacts/Presence';
export * from './contacts/PresenceActivity';
export * from './contacts/PresenceMood';

export * from './datapipe/DataPipe';
export * from './datapipe/DataPipeStatus';
export * from './datapipe/DataPipeType';

export * from './file-sharing/FileManager';
export * from './file-sharing/FileUpload';
export * from './file-sharing/FileUploadManager';
export * from './file-sharing/FileUploadStatus';

export * from './groups/Group';
export * from './groups/GroupManager';

export * from './instant-messages/InstantMessage';
export * from './instant-messages/InstantMessageType';

export * from './media/ManagedStream';
export * from './media/LocalMediaHandler';
export * from './media/StreamRecorder';
export * from './media/StreamRecorderStatus';

export * from './meetings/Meeting';
export * from './meetings/MeetingManager';
export * from './meetings/MeetingParticipant';

export * from './session/RemoteSession';
export * from './session/Session';
export * from './session/SessionError';
export * from './session/SessionStatus';
export * from './session/User';

export * from './users/UserManager';

export * from './whiteboard/Whiteboard';

export * from './types';