Skip to content

Commit 7c56d66

Browse files
Automatically update Python SDK
1 parent b6ef3e7 commit 7c56d66

File tree

10 files changed

+343
-29
lines changed

10 files changed

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

trophy/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
from .types import (
44
AchievementCompletionResponse,
5+
BaseStreakResponse,
56
ErrorBody,
67
EventResponse,
78
EventResponseMetricsItem,
9+
IncrementMetricStreakResponse,
810
MetricResponse,
911
MetricStatus,
1012
MultiStageAchievementResponse,
1113
OneOffAchievementResponse,
1214
StreakFrequency,
1315
StreakResponse,
16+
StreakResponseStreakHistoryItem,
1417
UpdatedUser,
1518
UpsertedUser,
1619
User,
@@ -29,16 +32,19 @@
2932
"AchievementCompletionResponse",
3033
"AsyncTrophyApi",
3134
"BadRequestError",
35+
"BaseStreakResponse",
3236
"ErrorBody",
3337
"EventResponse",
3438
"EventResponseMetricsItem",
39+
"IncrementMetricStreakResponse",
3540
"MetricResponse",
3641
"MetricStatus",
3742
"MultiStageAchievementResponse",
3843
"NotFoundError",
3944
"OneOffAchievementResponse",
4045
"StreakFrequency",
4146
"StreakResponse",
47+
"StreakResponseStreakHistoryItem",
4248
"TrophyApi",
4349
"TrophyApiEnvironment",
4450
"UnauthorizedError",

trophy/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
# This file was auto-generated by Fern from our API Definition.
22

33
from .achievement_completion_response import AchievementCompletionResponse
4+
from .base_streak_response import BaseStreakResponse
45
from .error_body import ErrorBody
56
from .event_response import EventResponse
67
from .event_response_metrics_item import EventResponseMetricsItem
8+
from .increment_metric_streak_response import IncrementMetricStreakResponse
79
from .metric_response import MetricResponse
810
from .metric_status import MetricStatus
911
from .multi_stage_achievement_response import MultiStageAchievementResponse
1012
from .one_off_achievement_response import OneOffAchievementResponse
1113
from .streak_frequency import StreakFrequency
1214
from .streak_response import StreakResponse
15+
from .streak_response_streak_history_item import StreakResponseStreakHistoryItem
1316
from .updated_user import UpdatedUser
1417
from .upserted_user import UpsertedUser
1518
from .user import User
1619

1720
__all__ = [
1821
"AchievementCompletionResponse",
22+
"BaseStreakResponse",
1923
"ErrorBody",
2024
"EventResponse",
2125
"EventResponseMetricsItem",
26+
"IncrementMetricStreakResponse",
2227
"MetricResponse",
2328
"MetricStatus",
2429
"MultiStageAchievementResponse",
2530
"OneOffAchievementResponse",
2631
"StreakFrequency",
2732
"StreakResponse",
33+
"StreakResponseStreakHistoryItem",
2834
"UpdatedUser",
2935
"UpsertedUser",
3036
"User",
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from ..core.pydantic_utilities import UniversalBaseModel
4+
import pydantic
5+
from .streak_frequency import StreakFrequency
6+
import typing
7+
import typing_extensions
8+
from ..core.serialization import FieldMetadata
9+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
10+
11+
12+
class BaseStreakResponse(UniversalBaseModel):
13+
length: int = pydantic.Field()
14+
"""
15+
The length of the user's current streak.
16+
"""
17+
18+
frequency: StreakFrequency = pydantic.Field()
19+
"""
20+
The frequency of the streak.
21+
"""
22+
23+
started: typing.Optional[str] = pydantic.Field(default=None)
24+
"""
25+
The date the streak started.
26+
"""
27+
28+
period_start: typing_extensions.Annotated[
29+
typing.Optional[str], FieldMetadata(alias="periodStart")
30+
] = pydantic.Field(default=None)
31+
"""
32+
The start date of the current streak period.
33+
"""
34+
35+
period_end: typing_extensions.Annotated[
36+
typing.Optional[str], FieldMetadata(alias="periodEnd")
37+
] = pydantic.Field(default=None)
38+
"""
39+
The end date of the current streak period.
40+
"""
41+
42+
expires: typing.Optional[str] = pydantic.Field(default=None)
43+
"""
44+
The date the streak will expire if the user does not increment a metric.
45+
"""
46+
47+
if IS_PYDANTIC_V2:
48+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
49+
extra="allow", frozen=True
50+
) # type: ignore # Pydantic v2
51+
else:
52+
53+
class Config:
54+
frozen = True
55+
smart_union = True
56+
extra = pydantic.Extra.allow

trophy/types/event_response.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pydantic
77
import typing
88
from .event_response_metrics_item import EventResponseMetricsItem
9-
from .streak_response import StreakResponse
9+
from .increment_metric_streak_response import IncrementMetricStreakResponse
1010
from ..core.pydantic_utilities import IS_PYDANTIC_V2
1111

1212

@@ -38,7 +38,8 @@ class EventResponse(UniversalBaseModel):
3838
"""
3939

4040
current_streak: typing_extensions.Annotated[
41-
typing.Optional[StreakResponse], FieldMetadata(alias="currentStreak")
41+
typing.Optional[IncrementMetricStreakResponse],
42+
FieldMetadata(alias="currentStreak"),
4243
] = pydantic.Field(default=None)
4344
"""
4445
The user's current streak for the metric, if the metric has streaks enabled.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .base_streak_response import BaseStreakResponse
4+
import typing
5+
import pydantic
6+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
7+
8+
9+
class IncrementMetricStreakResponse(BaseStreakResponse):
10+
"""
11+
An object representing the user's streak after incrementing a metric.
12+
"""
13+
14+
extended: typing.Optional[bool] = pydantic.Field(default=None)
15+
"""
16+
Whether this metric event increased the user's streak length.
17+
"""
18+
19+
if IS_PYDANTIC_V2:
20+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
21+
extra="allow", frozen=True
22+
) # type: ignore # Pydantic v2
23+
else:
24+
25+
class Config:
26+
frozen = True
27+
smart_union = True
28+
extra = pydantic.Extra.allow

trophy/types/metric_response.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
from ..core.pydantic_utilities import UniversalBaseModel
44
import pydantic
5-
import typing_extensions
6-
from .streak_frequency import StreakFrequency
7-
from ..core.serialization import FieldMetadata
85
from .metric_status import MetricStatus
96
import typing
107
from .multi_stage_achievement_response import MultiStageAchievementResponse
11-
from .streak_response import StreakResponse
128
from ..core.pydantic_utilities import IS_PYDANTIC_V2
139

1410

@@ -33,13 +29,6 @@ class MetricResponse(UniversalBaseModel):
3329
The emoji to represent the metric.
3430
"""
3531

36-
streak_frequency: typing_extensions.Annotated[
37-
StreakFrequency, FieldMetadata(alias="streakFrequency")
38-
] = pydantic.Field()
39-
"""
40-
The frequency of the streak.
41-
"""
42-
4332
status: MetricStatus = pydantic.Field()
4433
"""
4534
The status of the metric.
@@ -55,13 +44,6 @@ class MetricResponse(UniversalBaseModel):
5544
A list of the metric's achievements and the user's progress towards each.
5645
"""
5746

58-
current_streak: typing_extensions.Annotated[
59-
typing.Optional[StreakResponse], FieldMetadata(alias="currentStreak")
60-
] = pydantic.Field(default=None)
61-
"""
62-
The user's current streak for the metric, if the metric has streaks enabled.
63-
"""
64-
6547
if IS_PYDANTIC_V2:
6648
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
6749
extra="allow", frozen=True

trophy/types/streak_response.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3-
from ..core.pydantic_utilities import UniversalBaseModel
3+
from .base_streak_response import BaseStreakResponse
4+
import typing_extensions
5+
import typing
6+
from .streak_response_streak_history_item import StreakResponseStreakHistoryItem
7+
from ..core.serialization import FieldMetadata
48
import pydantic
5-
from .streak_frequency import StreakFrequency
69
from ..core.pydantic_utilities import IS_PYDANTIC_V2
7-
import typing
810

911

10-
class StreakResponse(UniversalBaseModel):
11-
length: int = pydantic.Field()
12+
class StreakResponse(BaseStreakResponse):
1213
"""
13-
The length of the user's current streak.
14+
An object representing the user's streak.
1415
"""
1516

16-
frequency: StreakFrequency = pydantic.Field()
17+
streak_history: typing_extensions.Annotated[
18+
typing.Optional[typing.List[StreakResponseStreakHistoryItem]],
19+
FieldMetadata(alias="streakHistory"),
20+
] = pydantic.Field(default=None)
1721
"""
18-
The frequency of the streak.
22+
A list of the user's past streak periods up through the current period. Each period includes the start and end dates and the length of the streak.
1923
"""
2024

2125
if IS_PYDANTIC_V2:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from ..core.pydantic_utilities import UniversalBaseModel
4+
import typing_extensions
5+
from ..core.serialization import FieldMetadata
6+
import pydantic
7+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
8+
import typing
9+
10+
11+
class StreakResponseStreakHistoryItem(UniversalBaseModel):
12+
"""
13+
An object representing a past streak period.
14+
"""
15+
16+
period_start: typing_extensions.Annotated[
17+
str, FieldMetadata(alias="periodStart")
18+
] = pydantic.Field()
19+
"""
20+
The date this streak period started.
21+
"""
22+
23+
period_end: typing_extensions.Annotated[str, FieldMetadata(alias="periodEnd")] = (
24+
pydantic.Field()
25+
)
26+
"""
27+
The date this streak period ended.
28+
"""
29+
30+
length: int = pydantic.Field()
31+
"""
32+
The length of the user's streak during this period.
33+
"""
34+
35+
if IS_PYDANTIC_V2:
36+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
37+
extra="allow", frozen=True
38+
) # type: ignore # Pydantic v2
39+
else:
40+
41+
class Config:
42+
frozen = True
43+
smart_union = True
44+
extra = pydantic.Extra.allow

0 commit comments

Comments
 (0)