Skip to content

Commit 0d3c407

Browse files
Automatically update Python SDK
1 parent a6512e8 commit 0d3c407

13 files changed

+695
-76
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "trophy"
7-
version = "1.1.2"
7+
version = "1.2.1"
88
description = "A Python library for the Trophy API"
99
license = {text = "MIT"}
1010
readme = "README.md"

trophy/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@
4949
PointsBoostWebhookPayload,
5050
PointsBoostWebhookPayloadRounding,
5151
PointsBoostWebhookPayloadStatus,
52+
PointsLevel,
53+
PointsLevelSummaryResponse,
54+
PointsLevelSummaryResponseItem,
5255
PointsRange,
56+
PointsResponse,
5357
PointsSummaryResponse,
5458
PointsSystemResponse,
5559
PointsTrigger,
@@ -83,6 +87,8 @@
8387
WebhooksPointsBoostFinishedPayload,
8488
WebhooksPointsBoostStartedPayload,
8589
WebhooksPointsChangedPayload,
90+
WebhooksPointsLevelChangedPayload,
91+
WebhooksPointsLevelChangedPayloadPoints,
8692
WebhooksStreakExtendedPayload,
8793
WebhooksStreakFreezeConsumedPayload,
8894
WebhooksStreakFreezeEarnedPayload,
@@ -160,7 +166,11 @@
160166
"PointsBoostWebhookPayload": ".types",
161167
"PointsBoostWebhookPayloadRounding": ".types",
162168
"PointsBoostWebhookPayloadStatus": ".types",
169+
"PointsLevel": ".types",
170+
"PointsLevelSummaryResponse": ".types",
171+
"PointsLevelSummaryResponseItem": ".types",
163172
"PointsRange": ".types",
173+
"PointsResponse": ".types",
164174
"PointsSummaryResponse": ".types",
165175
"PointsSystemResponse": ".types",
166176
"PointsTrigger": ".types",
@@ -203,6 +213,8 @@
203213
"WebhooksPointsBoostFinishedPayload": ".types",
204214
"WebhooksPointsBoostStartedPayload": ".types",
205215
"WebhooksPointsChangedPayload": ".types",
216+
"WebhooksPointsLevelChangedPayload": ".types",
217+
"WebhooksPointsLevelChangedPayloadPoints": ".types",
206218
"WebhooksStreakExtendedPayload": ".types",
207219
"WebhooksStreakFreezeConsumedPayload": ".types",
208220
"WebhooksStreakFreezeEarnedPayload": ".types",
@@ -298,7 +310,11 @@ def __dir__():
298310
"PointsBoostWebhookPayload",
299311
"PointsBoostWebhookPayloadRounding",
300312
"PointsBoostWebhookPayloadStatus",
313+
"PointsLevel",
314+
"PointsLevelSummaryResponse",
315+
"PointsLevelSummaryResponseItem",
301316
"PointsRange",
317+
"PointsResponse",
302318
"PointsSummaryResponse",
303319
"PointsSystemResponse",
304320
"PointsTrigger",
@@ -341,6 +357,8 @@ def __dir__():
341357
"WebhooksPointsBoostFinishedPayload",
342358
"WebhooksPointsBoostStartedPayload",
343359
"WebhooksPointsChangedPayload",
360+
"WebhooksPointsLevelChangedPayload",
361+
"WebhooksPointsLevelChangedPayloadPoints",
344362
"WebhooksStreakExtendedPayload",
345363
"WebhooksStreakFreezeConsumedPayload",
346364
"WebhooksStreakFreezeEarnedPayload",

trophy/points/client.py

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
66
from ..core.request_options import RequestOptions
77
from ..types.points_boost import PointsBoost
8+
from ..types.points_level import PointsLevel
9+
from ..types.points_level_summary_response import PointsLevelSummaryResponse
810
from ..types.points_summary_response import PointsSummaryResponse
911
from ..types.points_system_response import PointsSystemResponse
1012
from .raw_client import AsyncRawPointsClient, RawPointsClient
@@ -138,6 +140,70 @@ def boosts(
138140
_response = self._raw_client.boosts(key, include_finished=include_finished, request_options=request_options)
139141
return _response.data
140142

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+
141207

142208
class AsyncPointsClient:
143209
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -296,3 +362,85 @@ async def main() -> None:
296362
key, include_finished=include_finished, request_options=request_options
297363
)
298364
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

Comments
 (0)