Skip to content

Match

Represents a complete match.

Source code in nexar/models/match/match.py
@dataclass(frozen=True)
class Match:
    """Represents a complete match."""

    metadata: MatchMetadata
    """Match metadata including match ID and participant list."""

    info: MatchInfo
    """Detailed match information including participants and teams."""

    @property
    def participants(self) -> "ParticipantList":
        """Get all participants in the match."""
        return self.info.participants

    def __iter__(self) -> Iterator["Participant"]:
        """Allow iteration over participants."""
        return iter(self.participants)

    @classmethod
    def from_api_response(cls, data: dict[str, Any]) -> "Match":
        """Create Match from API response."""
        return cls(
            metadata=MatchMetadata.from_api_response(data["metadata"]),
            info=MatchInfo.from_api_response(data["info"]),
        )

info instance-attribute

Detailed match information including participants and teams.

metadata instance-attribute

Match metadata including match ID and participant list.

participants property

Get all participants in the match.

__iter__()

Allow iteration over participants.

Source code in nexar/models/match/match.py
def __iter__(self) -> Iterator["Participant"]:
    """Allow iteration over participants."""
    return iter(self.participants)

from_api_response(data) classmethod

Create Match from API response.

Source code in nexar/models/match/match.py
@classmethod
def from_api_response(cls, data: dict[str, Any]) -> "Match":
    """Create Match from API response."""
    return cls(
        metadata=MatchMetadata.from_api_response(data["metadata"]),
        info=MatchInfo.from_api_response(data["info"]),
    )