@trivia-api/fetch
Version:
Functions to fetch data from The Trivia API.
23 lines (22 loc) • 842 B
TypeScript
import { ImageChoiceQuestion, V2Question, TextChoiceQuestion } from "@trivia-api/client";
import { TranslatedLanguage } from "@trivia-api/models";
export type GetQuestionsParams = {
limit?: number;
categories?: string[];
tags?: string[];
difficulties?: V2Question["difficulty"][];
region?: string;
session?: string;
types?: V2Question["type"][];
preview?: boolean;
apiKey?: string;
language?: TranslatedLanguage;
};
/**
* Get random questions from The Trivia API
* @param params - To filter the questions returned
* @param params.apiKey - Optional parameter to send an API key
* @param host - Optional parameter to send to a different API host
* @returns
*/
export declare const getQuestions: (params?: GetQuestionsParams, host?: string) => Promise<(TextChoiceQuestion | ImageChoiceQuestion)[]>;