@trivia-api/models
Version:
Models for The Trivia API.
156 lines (155 loc) • 6.01 kB
TypeScript
/**
* The query parameters that can be used when calling the GET
* /v2/questions endpoint
*
* @openapi
* components:
* parameters:
* limitQueryParam:
* in: query
* name: limit
* description: The number of questions to return
* schema:
* type: number
* default: 10
* example: 5
* categoriesQueryParam:
* in: query
* name: categories
* description: Comma separated list of categories to return questions from. If not provided, all categories will be used.
* schema:
* type: string
* example: "science,film_and_tv"
* difficultiesQueryParam:
* in: query
* name: difficulties
* description: Comma separated list of difficulties of questions to return. If not provided, all difficulties will be used.
* schema:
* type: string
* default: "easy,medium,hard"
* example: "medium,hard"
* regionQueryParam:
* in: query
* name: region
* schema:
* type: string
* description:
* Some questions are regional, i.e. only reasonable to ask people from a
* particular set of countries.
*
*
* If not provided, all questions will be
* suitable to ask to people from anywhere in the world. If provided,
* you could also receive questions that are only suitable to ask to ask to
* people from the specified region, but not to people from all regions.
*
*
* The region should be provided as an ISO 3166-1 alpha-2 country code.
* example: "GB"
* typesQueryParam:
* in: query
* name: types
* schema:
* type: string
* default: "text_choice"
* description:
* Comma separated list of the types of questions to return. If not provided, only text choice questions will be used.
*
* A Complete subscription is required to receive image questions.
* example: "text_choice,image_choice"
* tagsQueryParam:
* in: query
* name: tags
* schema:
* type: string
* description: Comma separated list of tags to return questions from. If not provided, all tags will be used.
* example: "science,film_and_tv"
* sessionQueryParam:
* in: query
* name: session
* schema:
* type: string
* description: The session id to return questions from. If not provided, questions will not come from a session, so could be duplicates of questions received on previous requests.
* example: "1234567890"
* previewQueryParam:
* in: query
* name: preview
* schema:
* type: string
* enum:
* - "true"
* - "false"
* description:
* When used with a session, this will not mark the generated questions as "used", so the same questions could
* be returned again in a future request. Questions generated in this way need to be manually marked as "used".
* example: true
* languageQueryParam:
* in: query
* name: language
* schema:
* type: string
* description:
* (Requires a Complete subscription)
* ISO 639-1 code of the language to return questions in. If not provided, questions will be returned in English.
* example: "es"
*/
export type GetRandomQuestionsQueryParams = {
/**
* The number of questions to return
*
* @example "limit=10"
*/
limit?: number;
/**
* Comma separated list of categories to return questions from. If
* not provided, all categories will be used.
*
* @example "categories=science,film_and_tv"
*/
categories?: string;
/**
* Comma-separated list of difficulties of questions to return. Is used when you want questions
* from multiple difficulties. If not provided, all difficulties will be used.
*/
difficulties?: string;
/**
* If not provided, then questions will only be returned if they are
* fair questions to ask to people from any region in the world. If provided,
* then there is a chance that questions will be returned that are
* fair to ask to people from the specified region, but not to people
* from all regions.
*
* e.g. "Who was appointed as manager of Newcastle United in 2021?" is a
* fair question to ask of people from the United Kingdom, but not to
* people in other countries. If you specify "region=GB" then this question
* could be returned, otherwise it will not be returned.
*
* @example "region=GB"
*/
region?: string;
/**
* Comma separated list of tags to return questions from
* @example "tags=animals,plants"
*/
tags?: string;
/**
* Semantic topic query. When provided, questions are returned \"random but about\" this query.
*
* @example \"query=greek mythology\"
*/
query?: string;
/**
* Comma separated list of types to return questions from
*
* @example "types=image_choice,text_choice"
*/
types?: string;
/**
* If provided, then questions will be returned from the session with
* the given ID, ensuring that the user does not see the same question
* twice.
*/
session?: string;
preview?: "true" | "false";
language?: string;
};