Skip to content

codingame_tools.client.service.services.quest

quest

Async Quest service endpoint.

CgQuestServiceHelper

CgQuestServiceHelper(service)

Bases: CgServiceHelper['CgQuestService']

Helper methods for CgQuestService. Currently empty.

Source code in codingame_tools/client/service/cg_service.py
124
125
def __init__(self, service: TService) -> None:
    self.service = service

CgQuestService

CgQuestService(client)

Bases: CgService

Async Quest service endpoint.

Source code in codingame_tools/client/service/services/quest.py
24
25
26
def __init__(self, client: CgClient) -> None:
    super().__init__(client, "Quest")
    self.helper = CgQuestServiceHelper(self)

find_quest_map async

find_quest_map(codingamer_id=None)

Find a codingamer's quest map (the graph of quest nodes and links shown on the "Path" / quest-tree page), including their own progress on each quest.

Parameters:

  • codingamer_id (int | None, default: None ) –

    The codingamer whose quest map to fetch. If not provided, defaults to the logged-in codingamer's ID.

Returns:

Raises:

  • CgAuthenticationError

    If the session is not authenticated and cannot implicitly login, or if codingamer_id is not provided and no codingamer ID can be resolved from the session's credentials.

  • CgClientHttpError

    If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a dict.

Source code in codingame_tools/client/service/services/quest.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
async def find_quest_map(
            self,
            codingamer_id: int | None = None,
        ) -> CgQuestMap:
    """Find a codingamer's quest map (the graph of quest nodes and links shown on the
       "Path" / quest-tree page), including their own progress on each quest.

    Args:
        codingamer_id: The codingamer whose quest map to fetch. If not provided, defaults
                       to the logged-in codingamer's ID.

    Returns:
        A CgQuestMap object.

    Raises:
        CgAuthenticationError:
            If the session is not authenticated and cannot implicitly login, or if
            `codingamer_id` is not provided and no codingamer ID can be resolved from the
            session's credentials.
        CgClientHttpError:
            If a transport error occurs, if the response content could not be decoded at all,
            if the status code is not 2xx, or if the decoded content is not a dict.
    """
    if codingamer_id is None:
        await self.require_authenticate()
        codingamer_id = self.client.codingamer_id
        if codingamer_id is None:
            raise CgAuthenticationError()
    raw_map = await self.service_request_to_dict("findQuestMap", [codingamer_id])
    return CgQuestMap.from_dict(raw_map)

count_lootable_quests async

count_lootable_quests(codingamer_id=None)

Count a codingamer's completed-but-unclaimed quests (i.e. quests where CgCodingamerQuest.completion_time is set but loot_time is still None).

Parameters:

  • codingamer_id (int | None, default: None ) –

    The codingamer to count lootable quests for. If not provided, defaults to the logged-in codingamer's ID.

Returns:

  • int

    The number of lootable (completed, reward not yet claimed) quests.

Raises:

  • CgAuthenticationError

    If the session is not authenticated and cannot implicitly login, or if codingamer_id is not provided and no codingamer ID can be resolved from the session's credentials.

  • CgClientHttpError

    If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not an int.

Source code in codingame_tools/client/service/services/quest.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
async def count_lootable_quests(
            self,
            codingamer_id: int | None = None,
        ) -> int:
    """Count a codingamer's completed-but-unclaimed quests (i.e. quests where
       `CgCodingamerQuest.completion_time` is set but `loot_time` is still None).

    Args:
        codingamer_id: The codingamer to count lootable quests for. If not provided,
                       defaults to the logged-in codingamer's ID.

    Returns:
        The number of lootable (completed, reward not yet claimed) quests.

    Raises:
        CgAuthenticationError:
            If the session is not authenticated and cannot implicitly login, or if
            `codingamer_id` is not provided and no codingamer ID can be resolved from the
            session's credentials.
        CgClientHttpError:
            If a transport error occurs, if the response content could not be decoded at all,
            if the status code is not 2xx, or if the decoded content is not an int.
    """
    if codingamer_id is None:
        await self.require_authenticate()
        codingamer_id = self.client.codingamer_id
        if codingamer_id is None:
            raise CgAuthenticationError()
    result = await self.service_request("countLootableQuests", [codingamer_id])
    return cast(int, result)