Skip to content

Commit d7497e9

Browse files
Automatically update Python SDK
1 parent 43ace04 commit d7497e9

File tree

5 files changed

+17
-238
lines changed

5 files changed

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

trophy/admin/points/boosts/client.py

Lines changed: 8 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ def create(
8585
_response = self._raw_client.create(system_key=system_key, boosts=boosts, request_options=request_options)
8686
return _response.data
8787

88-
def batch_archive(
88+
def delete(
8989
self,
9090
*,
9191
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
9292
request_options: typing.Optional[RequestOptions] = None,
9393
) -> DeletePointsBoostsResponse:
9494
"""
95-
Archive multiple points boosts by ID.
95+
Delete multiple points boosts by ID.
9696
9797
Parameters
9898
----------
@@ -114,42 +114,9 @@ def batch_archive(
114114
client = TrophyApi(
115115
api_key="YOUR_API_KEY",
116116
)
117-
client.admin.points.boosts.batch_archive()
117+
client.admin.points.boosts.delete()
118118
"""
119-
_response = self._raw_client.batch_archive(ids=ids, request_options=request_options)
120-
return _response.data
121-
122-
def archive(
123-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
124-
) -> DeletePointsBoostsResponse:
125-
"""
126-
Archive a points boost by ID.
127-
128-
Parameters
129-
----------
130-
id : str
131-
The UUID of the points boost to archive
132-
133-
request_options : typing.Optional[RequestOptions]
134-
Request-specific configuration.
135-
136-
Returns
137-
-------
138-
DeletePointsBoostsResponse
139-
Successfully archived the points boost
140-
141-
Examples
142-
--------
143-
from trophy import TrophyApi
144-
145-
client = TrophyApi(
146-
api_key="YOUR_API_KEY",
147-
)
148-
client.admin.points.boosts.archive(
149-
id="id",
150-
)
151-
"""
152-
_response = self._raw_client.archive(id, request_options=request_options)
119+
_response = self._raw_client.delete(ids=ids, request_options=request_options)
153120
return _response.data
154121

155122

@@ -233,14 +200,14 @@ async def main() -> None:
233200
_response = await self._raw_client.create(system_key=system_key, boosts=boosts, request_options=request_options)
234201
return _response.data
235202

236-
async def batch_archive(
203+
async def delete(
237204
self,
238205
*,
239206
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
240207
request_options: typing.Optional[RequestOptions] = None,
241208
) -> DeletePointsBoostsResponse:
242209
"""
243-
Archive multiple points boosts by ID.
210+
Delete multiple points boosts by ID.
244211
245212
Parameters
246213
----------
@@ -267,51 +234,10 @@ async def batch_archive(
267234
268235
269236
async def main() -> None:
270-
await client.admin.points.boosts.batch_archive()
271-
272-
273-
asyncio.run(main())
274-
"""
275-
_response = await self._raw_client.batch_archive(ids=ids, request_options=request_options)
276-
return _response.data
277-
278-
async def archive(
279-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
280-
) -> DeletePointsBoostsResponse:
281-
"""
282-
Archive a points boost by ID.
283-
284-
Parameters
285-
----------
286-
id : str
287-
The UUID of the points boost to archive
288-
289-
request_options : typing.Optional[RequestOptions]
290-
Request-specific configuration.
291-
292-
Returns
293-
-------
294-
DeletePointsBoostsResponse
295-
Successfully archived the points boost
296-
297-
Examples
298-
--------
299-
import asyncio
300-
301-
from trophy import AsyncTrophyApi
302-
303-
client = AsyncTrophyApi(
304-
api_key="YOUR_API_KEY",
305-
)
306-
307-
308-
async def main() -> None:
309-
await client.admin.points.boosts.archive(
310-
id="id",
311-
)
237+
await client.admin.points.boosts.delete()
312238
313239
314240
asyncio.run(main())
315241
"""
316-
_response = await self._raw_client.archive(id, request_options=request_options)
242+
_response = await self._raw_client.delete(ids=ids, request_options=request_options)
317243
return _response.data

trophy/admin/points/boosts/raw_client.py

Lines changed: 4 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from ....core.api_error import ApiError
77
from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
88
from ....core.http_response import AsyncHttpResponse, HttpResponse
9-
from ....core.jsonable_encoder import jsonable_encoder
109
from ....core.pydantic_utilities import parse_obj_as
1110
from ....core.request_options import RequestOptions
1211
from ....core.serialization import convert_and_respect_annotation_metadata
@@ -128,14 +127,14 @@ def create(
128127
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
129128
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
130129

131-
def batch_archive(
130+
def delete(
132131
self,
133132
*,
134133
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
135134
request_options: typing.Optional[RequestOptions] = None,
136135
) -> HttpResponse[DeletePointsBoostsResponse]:
137136
"""
138-
Archive multiple points boosts by ID.
137+
Delete multiple points boosts by ID.
139138
140139
Parameters
141140
----------
@@ -196,79 +195,6 @@ def batch_archive(
196195
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
197196
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
198197

199-
def archive(
200-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
201-
) -> HttpResponse[DeletePointsBoostsResponse]:
202-
"""
203-
Archive a points boost by ID.
204-
205-
Parameters
206-
----------
207-
id : str
208-
The UUID of the points boost to archive
209-
210-
request_options : typing.Optional[RequestOptions]
211-
Request-specific configuration.
212-
213-
Returns
214-
-------
215-
HttpResponse[DeletePointsBoostsResponse]
216-
Successfully archived the points boost
217-
"""
218-
_response = self._client_wrapper.httpx_client.request(
219-
f"points/boosts/{jsonable_encoder(id)}",
220-
base_url=self._client_wrapper.get_environment().admin,
221-
method="DELETE",
222-
request_options=request_options,
223-
)
224-
try:
225-
if 200 <= _response.status_code < 300:
226-
_data = typing.cast(
227-
DeletePointsBoostsResponse,
228-
parse_obj_as(
229-
type_=DeletePointsBoostsResponse, # type: ignore
230-
object_=_response.json(),
231-
),
232-
)
233-
return HttpResponse(response=_response, data=_data)
234-
if _response.status_code == 400:
235-
raise BadRequestError(
236-
headers=dict(_response.headers),
237-
body=typing.cast(
238-
ErrorBody,
239-
parse_obj_as(
240-
type_=ErrorBody, # type: ignore
241-
object_=_response.json(),
242-
),
243-
),
244-
)
245-
if _response.status_code == 401:
246-
raise UnauthorizedError(
247-
headers=dict(_response.headers),
248-
body=typing.cast(
249-
ErrorBody,
250-
parse_obj_as(
251-
type_=ErrorBody, # type: ignore
252-
object_=_response.json(),
253-
),
254-
),
255-
)
256-
if _response.status_code == 404:
257-
raise NotFoundError(
258-
headers=dict(_response.headers),
259-
body=typing.cast(
260-
ErrorBody,
261-
parse_obj_as(
262-
type_=ErrorBody, # type: ignore
263-
object_=_response.json(),
264-
),
265-
),
266-
)
267-
_response_json = _response.json()
268-
except JSONDecodeError:
269-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
270-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
271-
272198

273199
class AsyncRawBoostsClient:
274200
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -375,14 +301,14 @@ async def create(
375301
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
376302
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
377303

378-
async def batch_archive(
304+
async def delete(
379305
self,
380306
*,
381307
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
382308
request_options: typing.Optional[RequestOptions] = None,
383309
) -> AsyncHttpResponse[DeletePointsBoostsResponse]:
384310
"""
385-
Archive multiple points boosts by ID.
311+
Delete multiple points boosts by ID.
386312
387313
Parameters
388314
----------
@@ -442,76 +368,3 @@ async def batch_archive(
442368
except JSONDecodeError:
443369
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
444370
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
445-
446-
async def archive(
447-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
448-
) -> AsyncHttpResponse[DeletePointsBoostsResponse]:
449-
"""
450-
Archive a points boost by ID.
451-
452-
Parameters
453-
----------
454-
id : str
455-
The UUID of the points boost to archive
456-
457-
request_options : typing.Optional[RequestOptions]
458-
Request-specific configuration.
459-
460-
Returns
461-
-------
462-
AsyncHttpResponse[DeletePointsBoostsResponse]
463-
Successfully archived the points boost
464-
"""
465-
_response = await self._client_wrapper.httpx_client.request(
466-
f"points/boosts/{jsonable_encoder(id)}",
467-
base_url=self._client_wrapper.get_environment().admin,
468-
method="DELETE",
469-
request_options=request_options,
470-
)
471-
try:
472-
if 200 <= _response.status_code < 300:
473-
_data = typing.cast(
474-
DeletePointsBoostsResponse,
475-
parse_obj_as(
476-
type_=DeletePointsBoostsResponse, # type: ignore
477-
object_=_response.json(),
478-
),
479-
)
480-
return AsyncHttpResponse(response=_response, data=_data)
481-
if _response.status_code == 400:
482-
raise BadRequestError(
483-
headers=dict(_response.headers),
484-
body=typing.cast(
485-
ErrorBody,
486-
parse_obj_as(
487-
type_=ErrorBody, # type: ignore
488-
object_=_response.json(),
489-
),
490-
),
491-
)
492-
if _response.status_code == 401:
493-
raise UnauthorizedError(
494-
headers=dict(_response.headers),
495-
body=typing.cast(
496-
ErrorBody,
497-
parse_obj_as(
498-
type_=ErrorBody, # type: ignore
499-
object_=_response.json(),
500-
),
501-
),
502-
)
503-
if _response.status_code == 404:
504-
raise NotFoundError(
505-
headers=dict(_response.headers),
506-
body=typing.cast(
507-
ErrorBody,
508-
parse_obj_as(
509-
type_=ErrorBody, # type: ignore
510-
object_=_response.json(),
511-
),
512-
),
513-
)
514-
_response_json = _response.json()
515-
except JSONDecodeError:
516-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
517-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

trophy/types/delete_points_boosts_response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
class DeletePointsBoostsResponse(UniversalBaseModel):
1212
"""
13-
Response containing the points boosts that were archived and any per-item issues.
13+
Response containing the points boosts that were deleted and any per-item issues.
1414
"""
1515

1616
deleted: typing.List[DeletedResource] = pydantic.Field()
1717
"""
18-
Array of archived points boosts represented by ID.
18+
Array of deleted points boosts represented by ID.
1919
"""
2020

2121
issues: typing.List[AdminIssue] = pydantic.Field()

trophy/types/deleted_resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
class DeletedResource(UniversalBaseModel):
1010
"""
11-
A soft-deleted resource represented by ID.
11+
A deleted resource represented by ID.
1212
"""
1313

1414
id: str = pydantic.Field()
1515
"""
16-
The ID of the archived resource.
16+
The ID of the deleted resource.
1717
"""
1818

1919
if IS_PYDANTIC_V2:

0 commit comments

Comments
 (0)