Skip to content

Commit deaf387

Browse files
Automatically update Python SDK
1 parent 2eb689a commit deaf387

8 files changed

Lines changed: 81 additions & 13 deletions

File tree

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

‎trophy/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
ListRewardTriggersResponse,
182182
ListRewardsResponse,
183183
ListTenantsResponse,
184+
MessagingPreferences,
184185
MetricEventLeaderboardResponse,
185186
MetricEventLeaderboardResponseBreakdownAttributeValuesItem,
186187
MetricEventPointsResponse,
@@ -539,6 +540,7 @@
539540
"ListRewardTriggersResponse": ".types",
540541
"ListRewardsResponse": ".types",
541542
"ListTenantsResponse": ".types",
543+
"MessagingPreferences": ".types",
542544
"MetricEventLeaderboardResponse": ".types",
543545
"MetricEventLeaderboardResponseBreakdownAttributeValuesItem": ".types",
544546
"MetricEventPointsResponse": ".types",
@@ -918,6 +920,7 @@ def __dir__():
918920
"ListRewardTriggersResponse",
919921
"ListRewardsResponse",
920922
"ListTenantsResponse",
923+
"MessagingPreferences",
921924
"MetricEventLeaderboardResponse",
922925
"MetricEventLeaderboardResponseBreakdownAttributeValuesItem",
923926
"MetricEventPointsResponse",

‎trophy/reference.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ client.users.update(
708708
<dl>
709709
<dd>
710710

711-
Get a user's notification preferences.
711+
Get a user's notification, streak and agentic messaging preferences.
712712
</dd>
713713
</dl>
714714
</dd>
@@ -782,7 +782,7 @@ client.users.get_preferences(
782782
<dl>
783783
<dd>
784784

785-
Update a user's notification and streak preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
785+
Update a user's notification, streak and agentic messaging preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
786786
</dd>
787787
</dl>
788788
</dd>
@@ -853,6 +853,14 @@ client.users.update_preferences(
853853
<dl>
854854
<dd>
855855

856+
**messaging:** `typing.Optional[MessagingPreferences]`
857+
858+
</dd>
859+
</dl>
860+
861+
<dl>
862+
<dd>
863+
856864
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
857865

858866
</dd>

‎trophy/types/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
from .list_reward_triggers_response import ListRewardTriggersResponse
189189
from .list_rewards_response import ListRewardsResponse
190190
from .list_tenants_response import ListTenantsResponse
191+
from .messaging_preferences import MessagingPreferences
191192
from .metric_event_leaderboard_response import MetricEventLeaderboardResponse
192193
from .metric_event_leaderboard_response_breakdown_attribute_values_item import (
193194
MetricEventLeaderboardResponseBreakdownAttributeValuesItem,
@@ -528,6 +529,7 @@
528529
"ListRewardTriggersResponse": ".list_reward_triggers_response",
529530
"ListRewardsResponse": ".list_rewards_response",
530531
"ListTenantsResponse": ".list_tenants_response",
532+
"MessagingPreferences": ".messaging_preferences",
531533
"MetricEventLeaderboardResponse": ".metric_event_leaderboard_response",
532534
"MetricEventLeaderboardResponseBreakdownAttributeValuesItem": ".metric_event_leaderboard_response_breakdown_attribute_values_item",
533535
"MetricEventPointsResponse": ".metric_event_points_response",
@@ -882,6 +884,7 @@ def __dir__():
882884
"ListRewardTriggersResponse",
883885
"ListRewardsResponse",
884886
"ListTenantsResponse",
887+
"MessagingPreferences",
885888
"MetricEventLeaderboardResponse",
886889
"MetricEventLeaderboardResponseBreakdownAttributeValuesItem",
887890
"MetricEventPointsResponse",
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
import pydantic
6+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7+
from .notification_channel import NotificationChannel
8+
9+
10+
class MessagingPreferences(UniversalBaseModel):
11+
"""
12+
The user's agentic messaging preferences: the channels its messages may use, and how many and what kinds of messages they want.
13+
"""
14+
15+
channels: typing.Optional[typing.List[NotificationChannel]] = pydantic.Field(default=None)
16+
"""
17+
Channels agentic messages may use. An empty array turns agentic messages off for this user.
18+
"""
19+
20+
temperature: typing.Optional[int] = pydantic.Field(default=None)
21+
"""
22+
How many and what kinds of agentic messages the user wants, from 1 (fewer: progress and celebrations only, at most one email and one push a week) to 5 (more).
23+
"""
24+
25+
if IS_PYDANTIC_V2:
26+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
27+
else:
28+
29+
class Config:
30+
frozen = True
31+
smart_union = True
32+
extra = pydantic.Extra.allow

‎trophy/types/user_preferences_response.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import pydantic
66
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7+
from .messaging_preferences import MessagingPreferences
78
from .notification_preferences import NotificationPreferences
89
from .streak_preferences import StreakPreferences
910

@@ -15,6 +16,7 @@ class UserPreferencesResponse(UniversalBaseModel):
1516

1617
notifications: NotificationPreferences
1718
streak: typing.Optional[StreakPreferences] = None
19+
messaging: MessagingPreferences
1820

1921
if IS_PYDANTIC_V2:
2022
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2

‎trophy/users/client.py‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
66
from ..core.request_options import RequestOptions
77
from ..types.get_user_points_response import GetUserPointsResponse
8+
from ..types.messaging_preferences import MessagingPreferences
89
from ..types.metric_response import MetricResponse
910
from ..types.notification_preferences import NotificationPreferences
1011
from ..types.points_boost import PointsBoost
@@ -313,7 +314,7 @@ def get_preferences(
313314
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
314315
) -> UserPreferencesResponse:
315316
"""
316-
Get a user's notification preferences.
317+
Get a user's notification, streak and agentic messaging preferences.
317318
318319
Parameters
319320
----------
@@ -350,10 +351,11 @@ def update_preferences(
350351
*,
351352
notifications: typing.Optional[NotificationPreferences] = OMIT,
352353
streak: typing.Optional[StreakPreferences] = OMIT,
354+
messaging: typing.Optional[MessagingPreferences] = OMIT,
353355
request_options: typing.Optional[RequestOptions] = None,
354356
) -> UserPreferencesResponse:
355357
"""
356-
Update a user's notification and streak preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
358+
Update a user's notification, streak and agentic messaging preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
357359
358360
Parameters
359361
----------
@@ -364,6 +366,8 @@ def update_preferences(
364366
365367
streak : typing.Optional[StreakPreferences]
366368
369+
messaging : typing.Optional[MessagingPreferences]
370+
367371
request_options : typing.Optional[RequestOptions]
368372
Request-specific configuration.
369373
@@ -389,7 +393,7 @@ def update_preferences(
389393
)
390394
"""
391395
_response = self._raw_client.update_preferences(
392-
id, notifications=notifications, streak=streak, request_options=request_options
396+
id, notifications=notifications, streak=streak, messaging=messaging, request_options=request_options
393397
)
394398
return _response.data
395399

@@ -1246,7 +1250,7 @@ async def get_preferences(
12461250
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
12471251
) -> UserPreferencesResponse:
12481252
"""
1249-
Get a user's notification preferences.
1253+
Get a user's notification, streak and agentic messaging preferences.
12501254
12511255
Parameters
12521256
----------
@@ -1291,10 +1295,11 @@ async def update_preferences(
12911295
*,
12921296
notifications: typing.Optional[NotificationPreferences] = OMIT,
12931297
streak: typing.Optional[StreakPreferences] = OMIT,
1298+
messaging: typing.Optional[MessagingPreferences] = OMIT,
12941299
request_options: typing.Optional[RequestOptions] = None,
12951300
) -> UserPreferencesResponse:
12961301
"""
1297-
Update a user's notification and streak preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
1302+
Update a user's notification, streak and agentic messaging preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
12981303
12991304
Parameters
13001305
----------
@@ -1305,6 +1310,8 @@ async def update_preferences(
13051310
13061311
streak : typing.Optional[StreakPreferences]
13071312
1313+
messaging : typing.Optional[MessagingPreferences]
1314+
13081315
request_options : typing.Optional[RequestOptions]
13091316
Request-specific configuration.
13101317
@@ -1338,7 +1345,7 @@ async def main() -> None:
13381345
asyncio.run(main())
13391346
"""
13401347
_response = await self._raw_client.update_preferences(
1341-
id, notifications=notifications, streak=streak, request_options=request_options
1348+
id, notifications=notifications, streak=streak, messaging=messaging, request_options=request_options
13421349
)
13431350
return _response.data
13441351

‎trophy/users/raw_client.py‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ..errors.unauthorized_error import UnauthorizedError
1818
from ..errors.unprocessable_entity_error import UnprocessableEntityError
1919
from ..types.get_user_points_response import GetUserPointsResponse
20+
from ..types.messaging_preferences import MessagingPreferences
2021
from ..types.metric_response import MetricResponse
2122
from ..types.notification_preferences import NotificationPreferences
2223
from ..types.points_boost import PointsBoost
@@ -496,7 +497,7 @@ def get_preferences(
496497
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
497498
) -> HttpResponse[UserPreferencesResponse]:
498499
"""
499-
Get a user's notification preferences.
500+
Get a user's notification, streak and agentic messaging preferences.
500501
501502
Parameters
502503
----------
@@ -575,10 +576,11 @@ def update_preferences(
575576
*,
576577
notifications: typing.Optional[NotificationPreferences] = OMIT,
577578
streak: typing.Optional[StreakPreferences] = OMIT,
579+
messaging: typing.Optional[MessagingPreferences] = OMIT,
578580
request_options: typing.Optional[RequestOptions] = None,
579581
) -> HttpResponse[UserPreferencesResponse]:
580582
"""
581-
Update a user's notification and streak preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
583+
Update a user's notification, streak and agentic messaging preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
582584
583585
Parameters
584586
----------
@@ -589,6 +591,8 @@ def update_preferences(
589591
590592
streak : typing.Optional[StreakPreferences]
591593
594+
messaging : typing.Optional[MessagingPreferences]
595+
592596
request_options : typing.Optional[RequestOptions]
593597
Request-specific configuration.
594598
@@ -608,6 +612,9 @@ def update_preferences(
608612
"streak": convert_and_respect_annotation_metadata(
609613
object_=streak, annotation=StreakPreferences, direction="write"
610614
),
615+
"messaging": convert_and_respect_annotation_metadata(
616+
object_=messaging, annotation=MessagingPreferences, direction="write"
617+
),
611618
},
612619
headers={
613620
"content-type": "application/json",
@@ -2116,7 +2123,7 @@ async def get_preferences(
21162123
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
21172124
) -> AsyncHttpResponse[UserPreferencesResponse]:
21182125
"""
2119-
Get a user's notification preferences.
2126+
Get a user's notification, streak and agentic messaging preferences.
21202127
21212128
Parameters
21222129
----------
@@ -2195,10 +2202,11 @@ async def update_preferences(
21952202
*,
21962203
notifications: typing.Optional[NotificationPreferences] = OMIT,
21972204
streak: typing.Optional[StreakPreferences] = OMIT,
2205+
messaging: typing.Optional[MessagingPreferences] = OMIT,
21982206
request_options: typing.Optional[RequestOptions] = None,
21992207
) -> AsyncHttpResponse[UserPreferencesResponse]:
22002208
"""
2201-
Update a user's notification and streak preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
2209+
Update a user's notification, streak and agentic messaging preferences. Streak preferences other than `streak.enabled` require streak customization to be enabled in your Trophy dashboard settings.
22022210
22032211
Parameters
22042212
----------
@@ -2209,6 +2217,8 @@ async def update_preferences(
22092217
22102218
streak : typing.Optional[StreakPreferences]
22112219
2220+
messaging : typing.Optional[MessagingPreferences]
2221+
22122222
request_options : typing.Optional[RequestOptions]
22132223
Request-specific configuration.
22142224
@@ -2228,6 +2238,9 @@ async def update_preferences(
22282238
"streak": convert_and_respect_annotation_metadata(
22292239
object_=streak, annotation=StreakPreferences, direction="write"
22302240
),
2241+
"messaging": convert_and_respect_annotation_metadata(
2242+
object_=messaging, annotation=MessagingPreferences, direction="write"
2243+
),
22312244
},
22322245
headers={
22332246
"content-type": "application/json",

0 commit comments

Comments
 (0)