|
5 | 5 | from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
6 | 6 | from ..core.request_options import RequestOptions |
7 | 7 | from ..types.points_boost import PointsBoost |
| 8 | +from ..types.points_level import PointsLevel |
| 9 | +from ..types.points_level_summary_response import PointsLevelSummaryResponse |
8 | 10 | from ..types.points_summary_response import PointsSummaryResponse |
9 | 11 | from ..types.points_system_response import PointsSystemResponse |
10 | 12 | from .raw_client import AsyncRawPointsClient, RawPointsClient |
@@ -138,6 +140,70 @@ def boosts( |
138 | 140 | _response = self._raw_client.boosts(key, include_finished=include_finished, request_options=request_options) |
139 | 141 | return _response.data |
140 | 142 |
|
| 143 | + def levels(self, key: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[PointsLevel]: |
| 144 | + """ |
| 145 | + Get all levels for a points system. |
| 146 | +
|
| 147 | + Parameters |
| 148 | + ---------- |
| 149 | + key : str |
| 150 | + Key of the points system. |
| 151 | +
|
| 152 | + request_options : typing.Optional[RequestOptions] |
| 153 | + Request-specific configuration. |
| 154 | +
|
| 155 | + Returns |
| 156 | + ------- |
| 157 | + typing.List[PointsLevel] |
| 158 | + Successful operation |
| 159 | +
|
| 160 | + Examples |
| 161 | + -------- |
| 162 | + from trophy import TrophyApi |
| 163 | +
|
| 164 | + client = TrophyApi( |
| 165 | + api_key="YOUR_API_KEY", |
| 166 | + ) |
| 167 | + client.points.levels( |
| 168 | + key="points-system-key", |
| 169 | + ) |
| 170 | + """ |
| 171 | + _response = self._raw_client.levels(key, request_options=request_options) |
| 172 | + return _response.data |
| 173 | + |
| 174 | + def level_summary( |
| 175 | + self, key: str, *, request_options: typing.Optional[RequestOptions] = None |
| 176 | + ) -> PointsLevelSummaryResponse: |
| 177 | + """ |
| 178 | + Get a breakdown of the number of users at each level in a points system. |
| 179 | +
|
| 180 | + Parameters |
| 181 | + ---------- |
| 182 | + key : str |
| 183 | + Key of the points system. |
| 184 | +
|
| 185 | + request_options : typing.Optional[RequestOptions] |
| 186 | + Request-specific configuration. |
| 187 | +
|
| 188 | + Returns |
| 189 | + ------- |
| 190 | + PointsLevelSummaryResponse |
| 191 | + Successful operation |
| 192 | +
|
| 193 | + Examples |
| 194 | + -------- |
| 195 | + from trophy import TrophyApi |
| 196 | +
|
| 197 | + client = TrophyApi( |
| 198 | + api_key="YOUR_API_KEY", |
| 199 | + ) |
| 200 | + client.points.level_summary( |
| 201 | + key="points-system-key", |
| 202 | + ) |
| 203 | + """ |
| 204 | + _response = self._raw_client.level_summary(key, request_options=request_options) |
| 205 | + return _response.data |
| 206 | + |
141 | 207 |
|
142 | 208 | class AsyncPointsClient: |
143 | 209 | def __init__(self, *, client_wrapper: AsyncClientWrapper): |
@@ -296,3 +362,85 @@ async def main() -> None: |
296 | 362 | key, include_finished=include_finished, request_options=request_options |
297 | 363 | ) |
298 | 364 | return _response.data |
| 365 | + |
| 366 | + async def levels( |
| 367 | + self, key: str, *, request_options: typing.Optional[RequestOptions] = None |
| 368 | + ) -> typing.List[PointsLevel]: |
| 369 | + """ |
| 370 | + Get all levels for a points system. |
| 371 | +
|
| 372 | + Parameters |
| 373 | + ---------- |
| 374 | + key : str |
| 375 | + Key of the points system. |
| 376 | +
|
| 377 | + request_options : typing.Optional[RequestOptions] |
| 378 | + Request-specific configuration. |
| 379 | +
|
| 380 | + Returns |
| 381 | + ------- |
| 382 | + typing.List[PointsLevel] |
| 383 | + Successful operation |
| 384 | +
|
| 385 | + Examples |
| 386 | + -------- |
| 387 | + import asyncio |
| 388 | +
|
| 389 | + from trophy import AsyncTrophyApi |
| 390 | +
|
| 391 | + client = AsyncTrophyApi( |
| 392 | + api_key="YOUR_API_KEY", |
| 393 | + ) |
| 394 | +
|
| 395 | +
|
| 396 | + async def main() -> None: |
| 397 | + await client.points.levels( |
| 398 | + key="points-system-key", |
| 399 | + ) |
| 400 | +
|
| 401 | +
|
| 402 | + asyncio.run(main()) |
| 403 | + """ |
| 404 | + _response = await self._raw_client.levels(key, request_options=request_options) |
| 405 | + return _response.data |
| 406 | + |
| 407 | + async def level_summary( |
| 408 | + self, key: str, *, request_options: typing.Optional[RequestOptions] = None |
| 409 | + ) -> PointsLevelSummaryResponse: |
| 410 | + """ |
| 411 | + Get a breakdown of the number of users at each level in a points system. |
| 412 | +
|
| 413 | + Parameters |
| 414 | + ---------- |
| 415 | + key : str |
| 416 | + Key of the points system. |
| 417 | +
|
| 418 | + request_options : typing.Optional[RequestOptions] |
| 419 | + Request-specific configuration. |
| 420 | +
|
| 421 | + Returns |
| 422 | + ------- |
| 423 | + PointsLevelSummaryResponse |
| 424 | + Successful operation |
| 425 | +
|
| 426 | + Examples |
| 427 | + -------- |
| 428 | + import asyncio |
| 429 | +
|
| 430 | + from trophy import AsyncTrophyApi |
| 431 | +
|
| 432 | + client = AsyncTrophyApi( |
| 433 | + api_key="YOUR_API_KEY", |
| 434 | + ) |
| 435 | +
|
| 436 | +
|
| 437 | + async def main() -> None: |
| 438 | + await client.points.level_summary( |
| 439 | + key="points-system-key", |
| 440 | + ) |
| 441 | +
|
| 442 | +
|
| 443 | + asyncio.run(main()) |
| 444 | + """ |
| 445 | + _response = await self._raw_client.level_summary(key, request_options=request_options) |
| 446 | + return _response.data |
0 commit comments