Skip to content

Commit 37fcc0d

Browse files
Automatically update Python SDK
1 parent 03a0250 commit 37fcc0d

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
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.0.34"
7+
version = "1.0.35"
88
description = "A Python library for the Trophy API"
99
license = {text = "MIT"}
1010
readme = "README.md"

trophy/types/leaderboard_response.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class LeaderboardResponse(UniversalBaseModel):
7070
The name of the points system to rank by, if rankBy is 'points'.
7171
"""
7272

73-
description: str = pydantic.Field()
73+
description: typing.Optional[str] = pydantic.Field(default=None)
7474
"""
7575
The user-facing description of the leaderboard.
7676
"""
@@ -97,9 +97,11 @@ class LeaderboardResponse(UniversalBaseModel):
9797
The repetition type for recurring leaderboards, or null for one-time leaderboards.
9898
"""
9999

100-
run_interval: typing_extensions.Annotated[int, FieldMetadata(alias="runInterval")] = pydantic.Field()
100+
run_interval: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="runInterval")] = (
101+
pydantic.Field(default=None)
102+
)
101103
"""
102-
The interval between repetitions, relative to the start date and repetition type.
104+
The interval between repetitions, relative to the start date and repetition type. Null for one-time leaderboards.
103105
"""
104106

105107
if IS_PYDANTIC_V2:

trophy/types/metric_event_leaderboard_response.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class MetricEventLeaderboardResponse(UniversalBaseModel):
9595
The name of the points system to rank by, if rankBy is 'points'.
9696
"""
9797

98-
description: str = pydantic.Field()
98+
description: typing.Optional[str] = pydantic.Field(default=None)
9999
"""
100100
The user-facing description of the leaderboard.
101101
"""
@@ -117,9 +117,11 @@ class MetricEventLeaderboardResponse(UniversalBaseModel):
117117
The repetition type for recurring leaderboards, or null for one-time leaderboards.
118118
"""
119119

120-
run_interval: typing_extensions.Annotated[int, FieldMetadata(alias="runInterval")] = pydantic.Field()
120+
run_interval: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="runInterval")] = (
121+
pydantic.Field(default=None)
122+
)
121123
"""
122-
The interval between repetitions, relative to the start date and repetition type.
124+
The interval between repetitions, relative to the start date and repetition type. Null for one-time leaderboards.
123125
"""
124126

125127
if IS_PYDANTIC_V2:

trophy/users/client.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ def leaderboard(
600600
key: str,
601601
*,
602602
run: typing.Optional[str] = None,
603+
num_events: typing.Optional[int] = None,
603604
request_options: typing.Optional[RequestOptions] = None,
604605
) -> UserLeaderboardResponseWithHistory:
605606
"""
@@ -616,6 +617,9 @@ def leaderboard(
616617
run : typing.Optional[str]
617618
Specific run date in YYYY-MM-DD format. If not provided, returns the current run.
618619
620+
num_events : typing.Optional[int]
621+
The number of events to return in the history array.
622+
619623
request_options : typing.Optional[RequestOptions]
620624
Request-specific configuration.
621625
@@ -635,9 +639,12 @@ def leaderboard(
635639
id="user-123",
636640
key="weekly-words",
637641
run="2025-01-15",
642+
num_events=1,
638643
)
639644
"""
640-
_response = self._raw_client.leaderboard(id, key, run=run, request_options=request_options)
645+
_response = self._raw_client.leaderboard(
646+
id, key, run=run, num_events=num_events, request_options=request_options
647+
)
641648
return _response.data
642649

643650

@@ -1309,6 +1316,7 @@ async def leaderboard(
13091316
key: str,
13101317
*,
13111318
run: typing.Optional[str] = None,
1319+
num_events: typing.Optional[int] = None,
13121320
request_options: typing.Optional[RequestOptions] = None,
13131321
) -> UserLeaderboardResponseWithHistory:
13141322
"""
@@ -1325,6 +1333,9 @@ async def leaderboard(
13251333
run : typing.Optional[str]
13261334
Specific run date in YYYY-MM-DD format. If not provided, returns the current run.
13271335
1336+
num_events : typing.Optional[int]
1337+
The number of events to return in the history array.
1338+
13281339
request_options : typing.Optional[RequestOptions]
13291340
Request-specific configuration.
13301341
@@ -1349,10 +1360,13 @@ async def main() -> None:
13491360
id="user-123",
13501361
key="weekly-words",
13511362
run="2025-01-15",
1363+
num_events=1,
13521364
)
13531365
13541366
13551367
asyncio.run(main())
13561368
"""
1357-
_response = await self._raw_client.leaderboard(id, key, run=run, request_options=request_options)
1369+
_response = await self._raw_client.leaderboard(
1370+
id, key, run=run, num_events=num_events, request_options=request_options
1371+
)
13581372
return _response.data

trophy/users/raw_client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,7 @@ def leaderboard(
10541054
key: str,
10551055
*,
10561056
run: typing.Optional[str] = None,
1057+
num_events: typing.Optional[int] = None,
10571058
request_options: typing.Optional[RequestOptions] = None,
10581059
) -> HttpResponse[UserLeaderboardResponseWithHistory]:
10591060
"""
@@ -1070,6 +1071,9 @@ def leaderboard(
10701071
run : typing.Optional[str]
10711072
Specific run date in YYYY-MM-DD format. If not provided, returns the current run.
10721073
1074+
num_events : typing.Optional[int]
1075+
The number of events to return in the history array.
1076+
10731077
request_options : typing.Optional[RequestOptions]
10741078
Request-specific configuration.
10751079
@@ -1084,6 +1088,7 @@ def leaderboard(
10841088
method="GET",
10851089
params={
10861090
"run": run,
1091+
"numEvents": num_events,
10871092
},
10881093
request_options=request_options,
10891094
)
@@ -2161,6 +2166,7 @@ async def leaderboard(
21612166
key: str,
21622167
*,
21632168
run: typing.Optional[str] = None,
2169+
num_events: typing.Optional[int] = None,
21642170
request_options: typing.Optional[RequestOptions] = None,
21652171
) -> AsyncHttpResponse[UserLeaderboardResponseWithHistory]:
21662172
"""
@@ -2177,6 +2183,9 @@ async def leaderboard(
21772183
run : typing.Optional[str]
21782184
Specific run date in YYYY-MM-DD format. If not provided, returns the current run.
21792185
2186+
num_events : typing.Optional[int]
2187+
The number of events to return in the history array.
2188+
21802189
request_options : typing.Optional[RequestOptions]
21812190
Request-specific configuration.
21822191
@@ -2191,6 +2200,7 @@ async def leaderboard(
21912200
method="GET",
21922201
params={
21932202
"run": run,
2203+
"numEvents": num_events,
21942204
},
21952205
request_options=request_options,
21962206
)

0 commit comments

Comments
 (0)