Skip to content

codingame_tools.client.common.protocol.search

search

JSON-serializable dataclasses for the Search service's search Codingame API method.

CgSearchResultType module-attribute

CgSearchResultType = str

The kind of object a search result refers to, e.g. "USER", "PUZZLE", "PLAYGROUND". Determines how CgSearchResult.id should be interpreted (an opaque public handle for "USER", a numeric ID as a string for other types so far observed). Only a few values have been observed so far, so this is left as a plain string rather than an enum pending broader coverage.

CgSearchResult dataclass

CgSearchResult(id, name, type, extra_data=dict(), image_binary_id=None, level=None)

Bases: JSONWizardX

A single search result, as returned (in a bare JSON array) by Search/search.

id instance-attribute

id

Opaque identifier for the matched object. For type == "USER", this is the codingamer's opaque public handle (as used by e.g. findCodingamePointsStatsByHandle). For other types observed so far, this is a numeric ID rendered as a string.

name instance-attribute

name

Display name of the matched object, e.g. a codingamer's pseudo or a puzzle's title.

type instance-attribute

type

The kind of object matched; see CgSearchResultType.

image_binary_id class-attribute instance-attribute

image_binary_id = None

The binary image ID of the matched object's thumbnail/avatar image. Not always present--e.g. absent for some "USER" results.

level class-attribute instance-attribute

level = None

Difficulty level, e.g. "easy", "medium". Only present for type == "PUZZLE" so far.