Championships API Resource
Relevant source files
The following files were used as context for generating this wiki page:
The Championships API Resource provides methods to interact with FACEIT tournament and championship data. It allows you to retrieve specific championship details, list championships for a particular game, and access associated matches, results, and subscriptions.
This resource is integrated into the SyncDataResource and AsyncDataResource aggregators, providing both synchronous and asynchronous access patterns. You can choose between raw dictionary responses or parsed Pydantic models.
Sources: src/faceit/api/data/championships.py:34-45, src/faceit/api/data/init.py:81-82
Resource Architecture
The BaseChampionships class defines the base path as "championships". Implementation is split into SyncChampionships and AsyncChampionships to support different execution environments. Both classes inherit from BaseResource, which manages client interactions and response validation.
Sources: src/faceit/api/data/championships.py:34-45, src/faceit/api/base.py:53-62
Data Flow for API Requests
The following diagram illustrates the flow from a method call in SyncChampionships through the HTTP client to the returned validated model.
API Methods
The resource provides several methods to access championship-related data. Methods support Raw or Model response formats through generic type parameters.
Championship Discovery
- items: Retrieves a paginated list of championships for a specific game.
- all_items: Automatically iterates through all pages to collect all championships matching the criteria.
Specific Championship Data
| Method | Description | Path |
|---|---|---|
| get | Retrieves details for a specific championship ID. Supports expansion of fields. | /championships/{championship_id} |
| matches | Lists matches associated with a specific championship. | /championships/{championship_id}/matches |
| results | Retrieves the final results/standings of a championship. | /championships/{championship_id}/results |
| subscriptions | Lists teams or players subscribed to the championship. | /championships/{championship_id}/subscriptions |
Sources: src/faceit/api/data/championships.py:47-160
Pagination Handling
Championship list methods use SyncPageIterator and AsyncPageIterator for offset-based pagination. The default limit for championship lists is 10 items per page, while matches and results default to 20 items.
Data Models
The Championship model is the primary data structure returned by this resource. It inherits from pydantic.BaseModel and includes comprehensive details about the tournament status, joining requirements, and scheduling.
Championship Model Schema
| Field | Type | Description |
|---|---|---|
id | FaceitID | Unique identifier of the championship. |
name | str | Display name of the event. |
status | str | Current status (e.g., UPCOMING, ONGOING). |
game_id | str | The game identifier (e.g., cs2). |
slots | int | Total number of participant slots. |
championship_start | TimestampMs | Start time in milliseconds. |
anticheat_required | bool | Whether FACEIT Anti-Cheat is mandatory. |
Sources: src/faceit/models/championships.py:46-91
Model Relationships
The championship model contains several nested objects representing specific configurations:
Constants and Enums
The resource utilizes central constants to filter and expand requests:
- EventCategory: Used in
itemsandmatchesto filter byall,ongoing,past, orupcoming. - ExpandedField: Used in
getto request additional data forgameororganizer. - GameID: Used to specify the game (e.g.,
cs2,dota2).
Sources: src/faceit/constants.py:46-56, src/faceit/api/data/championships.py:53-54
Summary
The Championships API Resource acts as the interface for FACEIT tournament data within the library. It combines Pydantic validation for complex championship schemas with robust pagination logic to handle large tournament lists. Through the use of SyncPageIterator and AsyncPageIterator, it ensures efficient data retrieval for both single-item lookups and bulk data collection.
Sources: src/faceit/api/data/championships.py:34-45, src/faceit/models/championships.py:46-91