To get started with Qatapult, you'll need an API token, which you can get from the Qatapult website.
Next the client library
# with npm
npm install @qatapult/client
# with yarn
yarn add @qatapult/clientUse the API token from your account page to initialise the client.
const QuizClient = require("@qatapult/client").QuizClient;
// Or, with ES6 imports...
import { QuizClient } from "@qatapult/client";
const quizzes = new QuizClient("{API_TOKEN}");There are multiple ways to generate a quiz.
- From Text
const reqId = quizzes.generateFromText(
`The earliest forms of English, a set of Anglo-Frisian dialects brought to Great Britain by Anglo Saxon invaders in the fifth century, are called Old English. Beowulf is the most famous work in Old English, and has achieved national epic status in England, despite being set in Scandinavia. However, following the Norman conquest of England in 1066, the written form of the Anglo-Saxon language became less common.`
);- From a Web Article
const reqId = quizzes.generateFromArticle(
`https://en.wikipedia.org/wiki/Alan_Turing`
);- From a YouTube video
const reqId = quizzes.generateFromVideo();- From a File
const reqId = quizzes.generateFromFile(file);If you have a front end client that is capable of receiving websocket events, you can initialise your frontend socket.io client to listen to http://api.qatapult.ai. You must then pass your socketId to the quizzes client to receive questions as they're being generated. This is useful if you are generating from large inputs at a time.
const articleLink = `https://en.wikipedia.org/wiki/Alan_Turing`;
const reqId = quizzes.generateFromArticle(articleLink, socketId);The repo is managed using yarn workspaces. You need a version of yarn 1.22.5 or above.
If you're developing with VS Code, you need to set your TypeScript version to use the one provided in .yarn/sdks/typescript
To generate those SDKs agains, run yarn dlx @yarnpkg/pnpify --sdk vscode
To install the packages for the first time, run yarn
You should have TypeScript intellisense and have linked dependencies in all packages within the repo.
Note To manually set version to yarn 2 in the repo, run yarn set version berry