UNPKG

@100mslive/hms-video-store

Version:

@100mslive Core SDK which abstracts the complexities of webRTC while providing a reactive store for data management with a unidirectional data flow

153 lines (152 loc) 4.22 kB
import { HMSPollQuestion, HMSPollQuestionAnswer, HMSPollQuestionOption, HMSPollQuestionResponse, HMSPollQuestionType, HMSPollState } from '../../interfaces'; export interface PollInfoParams { poll_id: string; title: string; type: 'poll' | 'quiz'; duration?: number; anonymous?: boolean; visibility?: boolean; locked?: boolean; mode?: string; vote?: string[]; responses?: string[]; state?: HMSPollState; created_by?: string; started_by?: string; stopped_by?: string; created_at?: number; started_at?: number; stopped_at?: number; questions_count?: number; } export interface PollID { poll_id: string; } export declare type PollInfoSetParams = PollInfoParams; export declare type PollInfoSetResponse = PollID; export declare type PollInfoGetParams = PollID; export declare type PollInfoGetResponse = PollInfoParams; export declare type PollStartParams = PollID; export declare type PollStopParams = PollID; export interface PollStartResponse extends PollID { duration: number; } export declare type PollStopResponse = PollStartResponse; export interface PollQuestionInfoParams extends Omit<HMSPollQuestion, 'options' | 'answer' | 'responses' | 'answerMinLen' | 'answerMaxLen'> { answer_min_len?: number; answer_max_len?: number; } export interface PollQuestionParams { question: PollQuestionInfoParams; options?: HMSPollQuestionOption[]; answer?: HMSPollQuestionAnswer; weight?: number; } export interface PollQuestionsSetParams { poll_id: string; questions: PollQuestionParams[]; } export interface PollQuestionsSetResponse extends PollID { total_questions: number; } export interface PollQuestionsGetParams { poll_id: string; index: number; count: number; } export interface PollQuestionsGetResponse extends PollQuestionsSetParams { last: boolean; } export interface PollResponseParams extends Pick<HMSPollQuestionResponse, 'type' | 'skipped' | 'option' | 'options' | 'text' | 'update' | 'duration'> { question: number; } export interface PollResponseSetParams { poll_id: string; responses: PollResponseParams[]; } export interface PollResponseSetResponse { poll_id: string; result: { question: number; correct: boolean; error: { code: number; message: string; description: string; }; }[]; } export interface PollListParams { state?: HMSPollState; count?: number; start?: string; } export interface PollListResponse { last: string; polls: PollInfoParams[]; } export interface PollResponsesGetParams { poll_id: string; index: number; count: number; self: boolean; } interface PollResponse extends Pick<HMSPollQuestionResponse, 'type' | 'skipped' | 'option' | 'options' | 'text' | 'update'> { question: number; response_id: string; } export interface PollResponsePeerInfo { hash: string; peerid: string; userid: string; username: string; } export interface PollResponsesGetResponse { poll_id: string; last?: boolean; responses?: { final?: boolean; response: PollResponse; peer: PollResponsePeerInfo; }[]; } export interface PollResult { max_user: number; total_response: number; user_count: number; questions?: { question: number; type: HMSPollQuestionType; options?: number[]; correct?: number; skipped?: number; total?: number; }[]; } export declare type PollResultParams = PollID; export declare type PollResultResponse = PollResult & PollID; export interface PollLeaderboardGetParams { poll_id: string; question?: number; count?: number; offset: number; } export interface PollLeaderboardEntry { position: number; score: number; total_responses: number; correct_responses: number; duration: number; peer: PollResponsePeerInfo; } export interface PollLeaderboardGetResponse { poll_id: string; total_users: number; voted_users: number; correct_users: number; avg_time: number; avg_score: number; questions: PollLeaderboardEntry[]; last: boolean; } export {};