createBattleAttempt mutation.
The mutation has one required argument - battleId.
Here is an example of the mutation execution:
BattleAttempt object will be returned.
BattleAttempt object
The object represents a battle attempt data. Each opponent can have only one attempt, a battle cannot be restarted.
| Argument | Type | Description |
|---|---|---|
answers | BattleQuestionAnswer | Optional. The list of user’s answers for the battle questions. Answers will be returned only for the attempt created by the current API user; it’s impossible to check the other user’s answers. |
battleStatus | BattleStatus | Required. The battle attempt status. See the full list of available statuses below. |
completedOn | Int | Optional. A timestamp when the attempt has been completed. |
correctAnswersNumber | Int | Required. The general number of correct answers provided by the user in the current battle attempt. |
cta | Cta | Optional. The list of available CTA for the battle attempt. See the list of available CTAs below. |
id | ID | Required. The battle attempt ID. |
progress | Int | Required. The attempt progress. Indicates the percentage of questions that have been answered so far. |
score | Float | Required. The total number of points that the rival has earned earned for the battle. |
timeSpent | Int | Required. The time (in seconds) that the user spent answering the related battle questions. |
BattleStatus options
The list of available BattleStatus options:
COMPLETED- indicates that the battle has been completed by the current API user; also includes the battles that are not completed by the opponent yet.DRAW- indicates a tie, meaning that both opponents have earned the same score and spent the same amount of time;FINISHED- indicates that ths battle has been finished by both rivals.IN_PROGRESS- indicates that the battle have been started, but not completed by the user yet;PENDING- indicates that the battle has not been started by the user yet;LOST- indicates that the user has lost the battle;WAITING_OPPONENT- indicates that the battle is finished by the initiator, but not completed by the opponent yet.WON- indicates that the user has won the battle.
Battle attempt CTAs
The list of available CTAs can differ depending on the attempt status.| Action ID | Description | Corresponding mutation/query |
|---|---|---|
NEXT_BATTLE_QUESTION | Allows to get the next battle question. Available if the attempt is still in progress. | getBattleNextQuestion |
VIEW_BATTLE_RESULTS | Allows to view the battle results. Available when the battle attempt is completed. | getBattle |