Quest (beta)

This subobject enables the Stagecast quests in your Moment

Introduction

If you are implementing a Quest, you can take advantage of the quiz API:s. These offer a set of utilities to create users, fetch and answer challenges and see the top results. You can also hand out prizes (see Prize (beta)).

To enable the quiz in your WebApp you have to add the quest plugin to the list of plugins in your manifest.json.

...
"plugins": [ ..., "prizes", "quest" ] 
...

The Quest is an object similar to the Quiz, but much more general, in order to account for many different Moment use cases. Among them, the Quest includes quizzes. The "question" entity that you find in the Quiz, it's referred to as "challenge" in the Quest.

API Docs

setContext(questId:string): Promise<Quest>

This is the first function you should call in order to initialize the quest service. All the following calls will not require the questId.

Params

  • questId: the id of the quest to be fetched; You will find the questId in the SDK config params.

const { questId } = await SDK.connection.getMomentClass();

SDK.quest.setContext(questId) 

getQuest(): Promise<Quest>

getChallenge(id): Promise<ChallengeItem>

Params

  • id: the challenge id;

respondToChallenge(questionHash, answer): Promise<AnswerScore>

Params

  • questionHash: string: the id of the content to be fetched;

  • answer: number: if the content should be compressed or full size.

getTopScores(offset?, limit?): Promise<TopScores>

Params

  • offset: the starting position;

  • limit: the number of positions to be fetched.

getUserScores(): Promise<LeaderboardEntry>

getUserProfile(): Promise<Profile>

It fetches the user profile information

setUserProfile(profile): Promise<Profile>

Allow to set the user display information. Generally used to set the user name.

playNewRound(): Promise<Profile>

This function allows a user to play another round of a quiz. It's points are set to 0.

Last updated

Was this helpful?