Skip to content

Commit a4e47bd

Browse files
committed
Added two new filters to the CLI. usage_type and mine
1 parent deb6145 commit a4e47bd

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/together/resources/endpoints.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ def __init__(self, client: TogetherClient) -> None:
1313
self._client = client
1414

1515
def list(
16-
self, type: Optional[Literal["dedicated", "serverless"]] = None
16+
self,
17+
type: Optional[Literal["dedicated", "serverless"]] = None,
18+
usage_type: Optional[Literal["on-demand", "reserved"]] = None,
19+
mine: Optional[bool] = None,
1720
) -> List[ListEndpoint]:
1821
"""
19-
List all endpoints, can be filtered by type.
22+
List all endpoints, can be filtered by type, usage type, and ownership.
2023
2124
Args:
2225
type (str, optional): Filter endpoints by type ("dedicated" or "serverless"). Defaults to None.
26+
usage_type (str, optional): Filter by usage type ("on-demand" or "reserved"). Defaults to None.
27+
mine (bool, optional): If True, return only endpoints owned by the caller. If False, return endpoints not owned by the caller. Defaults to None.
2328
2429
Returns:
2530
List[ListEndpoint]: List of endpoint objects
@@ -31,6 +36,10 @@ def list(
3136
params = {}
3237
if type is not None:
3338
params["type"] = type
39+
if usage_type is not None:
40+
params["usage_type"] = usage_type
41+
if mine is not None:
42+
params["mine"] = str(mine).lower()
3443

3544
response, _, _ = requestor.request(
3645
options=TogetherRequest(
@@ -263,13 +272,18 @@ def __init__(self, client: TogetherClient) -> None:
263272
self._client = client
264273

265274
async def list(
266-
self, type: Optional[Literal["dedicated", "serverless"]] = None
275+
self,
276+
type: Optional[Literal["dedicated", "serverless"]] = None,
277+
usage_type: Optional[Literal["on-demand", "reserved"]] = None,
278+
mine: Optional[bool] = None,
267279
) -> List[ListEndpoint]:
268280
"""
269-
List all endpoints, can be filtered by type.
281+
List all endpoints, can be filtered by type, usage type, and ownership.
270282
271283
Args:
272284
type (str, optional): Filter endpoints by type ("dedicated" or "serverless"). Defaults to None.
285+
usage_type (str, optional): Filter by usage type ("on-demand" or "reserved"). Defaults to None.
286+
mine (bool, optional): If True, return only endpoints owned by the caller. If False, return endpoints not owned by the caller. Defaults to None.
273287
274288
Returns:
275289
List[ListEndpoint]: List of endpoint objects
@@ -281,6 +295,10 @@ async def list(
281295
params = {}
282296
if type is not None:
283297
params["type"] = type
298+
if usage_type is not None:
299+
params["usage_type"] = usage_type
300+
if mine is not None:
301+
params["mine"] = str(mine).lower()
284302

285303
response, _, _ = await requestor.arequest(
286304
options=TogetherRequest(

0 commit comments

Comments
 (0)