Skip to content

codingame_tools.client.service.services.codingamer_puzzle_topic

codingamer_puzzle_topic

Async CodingamerPuzzleTopic service endpoint.

CgCodingamerPuzzleTopicServiceHelper

CgCodingamerPuzzleTopicServiceHelper(service)

Bases: CgServiceHelper['CgCodingamerPuzzleTopicService']

Helper methods for CgCodingamerPuzzleTopicService. Currently empty.

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

CgCodingamerPuzzleTopicService

CgCodingamerPuzzleTopicService(client)

Bases: CgService

Async CodingamerPuzzleTopic service endpoint.

Source code in codingame_tools/client/service/services/codingamer_puzzle_topic.py
26
27
28
def __init__(self, client: CgClient) -> None:
    super().__init__(client, "CodingamerPuzzleTopic")
    self.helper = CgCodingamerPuzzleTopicServiceHelper(self)

find_topics_by_codingamer_id async

find_topics_by_codingamer_id(codingamer_id=None)

Find the puzzle topics a codingamer has made progress on (e.g. "Arrays", "BFS"), along with a per-topic puzzle count and last-progress timestamp.

Parameters:

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

    The codingamer whose puzzle topic progress to list. 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 list.

Source code in codingame_tools/client/service/services/codingamer_puzzle_topic.py
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
58
59
60
async def find_topics_by_codingamer_id(
            self,
            codingamer_id: int | None = None,
        ) -> list[CgCodingamerPuzzleTopic]:
    """Find the puzzle topics a codingamer has made progress on (e.g. "Arrays", "BFS"),
       along with a per-topic puzzle count and last-progress timestamp.

    Args:
        codingamer_id: The codingamer whose puzzle topic progress to list. If not provided,
                       defaults to the logged-in codingamer's ID.

    Returns:
        A list of CgCodingamerPuzzleTopic objects.

    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 list.
    """
    if codingamer_id is None:
        await self.require_authenticate()
        codingamer_id = self.client.codingamer_id
        if codingamer_id is None:
            raise CgAuthenticationError()
    raw_topics = await self.service_request_to_list(
            "findTopicsByCodingamerId", [codingamer_id])
    return CgCodingamerPuzzleTopic.from_list(cast(list[JsonDict], raw_topics))

select_topics_by_codingamer_id_and_puzzle_id async

select_topics_by_codingamer_id_and_puzzle_id(puzzle_id, codingamer_id=None)

Find the topic tree for a single puzzle, personalized with the codingamer's per-topic "learned" status.

Parameters:

  • puzzle_id (int) –

    Numeric ID of the puzzle.

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

    The codingamer whose topic mastery to check. 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 list.

Source code in codingame_tools/client/service/services/codingamer_puzzle_topic.py
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
89
90
91
92
93
94
async def select_topics_by_codingamer_id_and_puzzle_id(
            self,
            puzzle_id: int,
            codingamer_id: int | None = None,
        ) -> list[CgCodingamerTopicNode]:
    """Find the topic tree for a single puzzle, personalized with the codingamer's
       per-topic "learned" status.

    Args:
        puzzle_id:     Numeric ID of the puzzle.
        codingamer_id: The codingamer whose topic mastery to check. If not provided,
                       defaults to the logged-in codingamer's ID.

    Returns:
        A list of CgCodingamerTopicNode objects.

    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 list.
    """
    if codingamer_id is None:
        await self.require_authenticate()
        codingamer_id = self.client.codingamer_id
        if codingamer_id is None:
            raise CgAuthenticationError()
    raw_topics = await self.service_request_to_list(
            "selectTopicsByCodingamerIdAndPuzzleId", [codingamer_id, puzzle_id])
    return CgCodingamerTopicNode.from_list(cast(list[JsonDict], raw_topics))