Skip to content

Commit 654a45d

Browse files
Automatically update Python SDK
1 parent d9104c5 commit 654a45d

36 files changed

Lines changed: 1109 additions & 157 deletions

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

‎trophy/.fern/metadata.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"generatorName": "fernapi/fern-python-sdk",
44
"generatorVersion": "5.15.1",
55
"generatorConfig": {},
6-
"originGitCommit": "885d82705d6aef1477e8e3db3c503783d437a659",
6+
"originGitCommit": "fc9c2289d356522ad24b9464747364dd97f31a15",
77
"originGitCommitIsDirty": false,
88
"invokedBy": "ci",
99
"ciProvider": "github"

‎trophy/__init__.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
BaseStreakResponse,
4444
BulkStreakResponse,
4545
BulkStreakResponseItem,
46+
CreateApplicationKeyRequestItem,
47+
CreateApplicationKeysRequest,
48+
CreateApplicationKeysResponse,
4649
CreateAttributeRequestItem,
4750
CreateAttributeRequestItemType,
4851
CreateAttributesRequest,
@@ -83,8 +86,10 @@
8386
CreateTenantsRequest,
8487
CreateTenantsResponse,
8588
CreatedAdminPointsSystem,
89+
CreatedApplicationKey,
8690
CreatedMetric,
8791
CreatedMetricUnitType,
92+
DeleteApplicationKeysResponse,
8893
DeleteAttributesResponse,
8994
DeleteLeaderboardsResponse,
9095
DeleteMetricsResponse,
@@ -277,6 +282,9 @@
277282
"BaseStreakResponse": ".types",
278283
"BulkStreakResponse": ".types",
279284
"BulkStreakResponseItem": ".types",
285+
"CreateApplicationKeyRequestItem": ".types",
286+
"CreateApplicationKeysRequest": ".types",
287+
"CreateApplicationKeysResponse": ".types",
280288
"CreateAttributeRequestItem": ".types",
281289
"CreateAttributeRequestItemType": ".types",
282290
"CreateAttributesRequest": ".types",
@@ -317,10 +325,12 @@
317325
"CreateTenantsRequest": ".types",
318326
"CreateTenantsResponse": ".types",
319327
"CreatedAdminPointsSystem": ".types",
328+
"CreatedApplicationKey": ".types",
320329
"CreatedMetric": ".types",
321330
"CreatedMetricUnitType": ".types",
322331
"DefaultAioHttpClient": "._default_clients",
323332
"DefaultAsyncHttpxClient": "._default_clients",
333+
"DeleteApplicationKeysResponse": ".types",
324334
"DeleteAttributesResponse": ".types",
325335
"DeleteLeaderboardsResponse": ".types",
326336
"DeleteMetricsResponse": ".types",
@@ -543,6 +553,9 @@ def __dir__():
543553
"BaseStreakResponse",
544554
"BulkStreakResponse",
545555
"BulkStreakResponseItem",
556+
"CreateApplicationKeyRequestItem",
557+
"CreateApplicationKeysRequest",
558+
"CreateApplicationKeysResponse",
546559
"CreateAttributeRequestItem",
547560
"CreateAttributeRequestItemType",
548561
"CreateAttributesRequest",
@@ -583,10 +596,12 @@ def __dir__():
583596
"CreateTenantsRequest",
584597
"CreateTenantsResponse",
585598
"CreatedAdminPointsSystem",
599+
"CreatedApplicationKey",
586600
"CreatedMetric",
587601
"CreatedMetricUnitType",
588602
"DefaultAioHttpClient",
589603
"DefaultAsyncHttpxClient",
604+
"DeleteApplicationKeysResponse",
590605
"DeleteAttributesResponse",
591606
"DeleteLeaderboardsResponse",
592607
"DeleteMetricsResponse",

‎trophy/achievements/client.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def all_(
5252
from trophy import TrophyApi
5353
5454
client = TrophyApi(
55-
"1.17.0",
55+
"1.18.0",
5656
tenant_id="YOUR_TENANT_ID",
5757
api_key="YOUR_API_KEY",
5858
)
@@ -90,7 +90,7 @@ def complete(
9090
from trophy import TrophyApi, UpsertedUser
9191
9292
client = TrophyApi(
93-
"1.17.0",
93+
"1.18.0",
9494
tenant_id="YOUR_TENANT_ID",
9595
api_key="YOUR_API_KEY",
9696
)
@@ -148,7 +148,7 @@ async def all_(
148148
from trophy import AsyncTrophyApi
149149
150150
client = AsyncTrophyApi(
151-
"1.17.0",
151+
"1.18.0",
152152
tenant_id="YOUR_TENANT_ID",
153153
api_key="YOUR_API_KEY",
154154
)
@@ -194,7 +194,7 @@ async def complete(
194194
from trophy import AsyncTrophyApi, UpsertedUser
195195
196196
client = AsyncTrophyApi(
197-
"1.17.0",
197+
"1.18.0",
198198
tenant_id="YOUR_TENANT_ID",
199199
api_key="YOUR_API_KEY",
200200
)

‎trophy/admin/__init__.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
from importlib import import_module
77

88
if typing.TYPE_CHECKING:
9-
from . import attributes, leaderboards, metrics, points, streaks, tenants
9+
from . import application_api_keys, attributes, leaderboards, metrics, points, streaks, tenants
1010
from .streaks import RestoreStreaksRequestUsersItem
1111
_dynamic_imports: typing.Dict[str, str] = {
1212
"RestoreStreaksRequestUsersItem": ".streaks",
13+
"application_api_keys": ".application_api_keys",
1314
"attributes": ".attributes",
1415
"leaderboards": ".leaderboards",
1516
"metrics": ".metrics",
@@ -40,4 +41,13 @@ def __dir__():
4041
return sorted(lazy_attrs)
4142

4243

43-
__all__ = ["RestoreStreaksRequestUsersItem", "attributes", "leaderboards", "metrics", "points", "streaks", "tenants"]
44+
__all__ = [
45+
"RestoreStreaksRequestUsersItem",
46+
"application_api_keys",
47+
"attributes",
48+
"leaderboards",
49+
"metrics",
50+
"points",
51+
"streaks",
52+
"tenants",
53+
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
# isort: skip_file
4+
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6+
from ...core.request_options import RequestOptions
7+
from ...types.create_application_keys_request import CreateApplicationKeysRequest
8+
from ...types.create_application_keys_response import CreateApplicationKeysResponse
9+
from ...types.delete_application_keys_response import DeleteApplicationKeysResponse
10+
from .raw_client import AsyncRawApplicationApiKeysClient, RawApplicationApiKeysClient
11+
12+
# this is used as the default value for optional parameters
13+
OMIT = typing.cast(typing.Any, ...)
14+
15+
16+
class ApplicationApiKeysClient:
17+
def __init__(self, *, client_wrapper: SyncClientWrapper):
18+
self._raw_client = RawApplicationApiKeysClient(client_wrapper=client_wrapper)
19+
20+
@property
21+
def with_raw_response(self) -> RawApplicationApiKeysClient:
22+
"""
23+
Retrieves a raw implementation of this client that returns raw responses.
24+
25+
Returns
26+
-------
27+
RawApplicationApiKeysClient
28+
"""
29+
return self._raw_client
30+
31+
def create(
32+
self, *, request: CreateApplicationKeysRequest, request_options: typing.Optional[RequestOptions] = None
33+
) -> CreateApplicationKeysResponse:
34+
"""
35+
Create application API keys scoped to specific users. Each key can only perform operations on behalf of the user it was created for.
36+
37+
Parameters
38+
----------
39+
request : CreateApplicationKeysRequest
40+
41+
request_options : typing.Optional[RequestOptions]
42+
Request-specific configuration.
43+
44+
Returns
45+
-------
46+
CreateApplicationKeysResponse
47+
Successful operation (no keys created)
48+
49+
Examples
50+
--------
51+
from trophy import CreateApplicationKeyRequestItem, TrophyApi
52+
53+
client = TrophyApi(
54+
"1.18.0",
55+
tenant_id="YOUR_TENANT_ID",
56+
api_key="YOUR_API_KEY",
57+
)
58+
client.admin.application_api_keys.create(
59+
request=[
60+
CreateApplicationKeyRequestItem(
61+
user_id="user_123",
62+
),
63+
CreateApplicationKeyRequestItem(
64+
user_id="user_456",
65+
),
66+
],
67+
)
68+
"""
69+
_response = self._raw_client.create(request=request, request_options=request_options)
70+
return _response.data
71+
72+
def delete(
73+
self,
74+
*,
75+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
76+
request_options: typing.Optional[RequestOptions] = None,
77+
) -> DeleteApplicationKeysResponse:
78+
"""
79+
Delete application API keys by ID.
80+
81+
Parameters
82+
----------
83+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
84+
Application API key IDs (UUIDs returned at creation time). Repeat the query param or provide a comma-separated list. Maximum 100 IDs per request.
85+
86+
request_options : typing.Optional[RequestOptions]
87+
Request-specific configuration.
88+
89+
Returns
90+
-------
91+
DeleteApplicationKeysResponse
92+
Successful operation
93+
94+
Examples
95+
--------
96+
from trophy import TrophyApi
97+
98+
client = TrophyApi(
99+
"1.18.0",
100+
tenant_id="YOUR_TENANT_ID",
101+
api_key="YOUR_API_KEY",
102+
)
103+
client.admin.application_api_keys.delete(
104+
ids=["550e8400-e29b-41d4-a716-446655440000"],
105+
)
106+
"""
107+
_response = self._raw_client.delete(ids=ids, request_options=request_options)
108+
return _response.data
109+
110+
111+
class AsyncApplicationApiKeysClient:
112+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
113+
self._raw_client = AsyncRawApplicationApiKeysClient(client_wrapper=client_wrapper)
114+
115+
@property
116+
def with_raw_response(self) -> AsyncRawApplicationApiKeysClient:
117+
"""
118+
Retrieves a raw implementation of this client that returns raw responses.
119+
120+
Returns
121+
-------
122+
AsyncRawApplicationApiKeysClient
123+
"""
124+
return self._raw_client
125+
126+
async def create(
127+
self, *, request: CreateApplicationKeysRequest, request_options: typing.Optional[RequestOptions] = None
128+
) -> CreateApplicationKeysResponse:
129+
"""
130+
Create application API keys scoped to specific users. Each key can only perform operations on behalf of the user it was created for.
131+
132+
Parameters
133+
----------
134+
request : CreateApplicationKeysRequest
135+
136+
request_options : typing.Optional[RequestOptions]
137+
Request-specific configuration.
138+
139+
Returns
140+
-------
141+
CreateApplicationKeysResponse
142+
Successful operation (no keys created)
143+
144+
Examples
145+
--------
146+
import asyncio
147+
148+
from trophy import AsyncTrophyApi, CreateApplicationKeyRequestItem
149+
150+
client = AsyncTrophyApi(
151+
"1.18.0",
152+
tenant_id="YOUR_TENANT_ID",
153+
api_key="YOUR_API_KEY",
154+
)
155+
156+
157+
async def main() -> None:
158+
await client.admin.application_api_keys.create(
159+
request=[
160+
CreateApplicationKeyRequestItem(
161+
user_id="user_123",
162+
),
163+
CreateApplicationKeyRequestItem(
164+
user_id="user_456",
165+
),
166+
],
167+
)
168+
169+
170+
asyncio.run(main())
171+
"""
172+
_response = await self._raw_client.create(request=request, request_options=request_options)
173+
return _response.data
174+
175+
async def delete(
176+
self,
177+
*,
178+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
179+
request_options: typing.Optional[RequestOptions] = None,
180+
) -> DeleteApplicationKeysResponse:
181+
"""
182+
Delete application API keys by ID.
183+
184+
Parameters
185+
----------
186+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
187+
Application API key IDs (UUIDs returned at creation time). Repeat the query param or provide a comma-separated list. Maximum 100 IDs per request.
188+
189+
request_options : typing.Optional[RequestOptions]
190+
Request-specific configuration.
191+
192+
Returns
193+
-------
194+
DeleteApplicationKeysResponse
195+
Successful operation
196+
197+
Examples
198+
--------
199+
import asyncio
200+
201+
from trophy import AsyncTrophyApi
202+
203+
client = AsyncTrophyApi(
204+
"1.18.0",
205+
tenant_id="YOUR_TENANT_ID",
206+
api_key="YOUR_API_KEY",
207+
)
208+
209+
210+
async def main() -> None:
211+
await client.admin.application_api_keys.delete(
212+
ids=["550e8400-e29b-41d4-a716-446655440000"],
213+
)
214+
215+
216+
asyncio.run(main())
217+
"""
218+
_response = await self._raw_client.delete(ids=ids, request_options=request_options)
219+
return _response.data

0 commit comments

Comments
 (0)