Create a battle
To start a new battle, thecreateBattle mutation should be executed. It accepts two required arguments:
Here is an example of the mutation execution:
Battle object will be returned.
The initiator’s attempt will be created automatically when a new battle is created.
This means that the user can immediately proceed with the take battle flow.
Get available domains
To get the list of allowed domains that contain an appropriate number of questions, thegetBattleDomains query should be executed. The query returns the list of TaxonomyTerm
objects, sorted according to their weight configured in the backoffice:
Get possible opponents
A battle can be initiated only between two user contexts assigned to the same hierarchy level. The list of possible opponents can be retrieved by calling thegetPossibleBattleOpponents query.
Results will be returned with the pagination, sorted by the user context label,
and possibility to change the order (default sort order is ascending).
The following arguments can be used:
The query returns a paginated list of
BattleRival objects:
Related Features
Pagination
Learn how to efficiently navigate through large sets of items using cursor-based pagination.
Take a battle
Now, when the initiator’s attempt is created, the user can take the battle.