Skip to content

Commit fb9acd5

Browse files
robot-ci-heartexfern-api[bot]nik
authored
fix: BROS-197: Add missing parameters for /api/projects (#492)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: nik <[email protected]>
1 parent d8f1adb commit fb9acd5

File tree

10 files changed

+121
-22
lines changed

10 files changed

+121
-22
lines changed

.mock/definition/projects.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
imports:
2-
root: __package__.yml
31
types:
2+
ProjectsListRequestFilter:
3+
enum:
4+
- all
5+
- pinned_only
6+
- exclude_pinned
7+
default: all
8+
source:
9+
openapi: openapi/openapi.yaml
410
ProjectsListResponse:
511
properties:
612
count: integer
@@ -163,6 +169,8 @@ types:
163169
docs: The list of found data columns
164170
source:
165171
openapi: openapi/openapi.yaml
172+
imports:
173+
root: __package__.yml
166174
service:
167175
auth: false
168176
base-path: ''
@@ -221,11 +229,30 @@ service:
221229
workspaces:
222230
type: optional<integer>
223231
docs: workspaces
232+
include:
233+
type: optional<string>
234+
docs: >
235+
Comma-separated list of count fields to include in the response to
236+
optimize performance. Available fields: task_number,
237+
finished_task_number, total_predictions_number,
238+
total_annotations_number, num_tasks_with_annotations,
239+
useful_annotation_number, ground_truth_number,
240+
skipped_annotations_number. If not specified, all count fields are
241+
included.
242+
filter:
243+
type: optional<ProjectsListRequestFilter>
244+
default: all
245+
docs: >
246+
Filter projects by pinned status. Use 'pinned_only' to return only
247+
pinned projects, 'exclude_pinned' to return only non-pinned
248+
projects, or 'all' to return all projects.
224249
response:
225250
docs: ''
226251
type: ProjectsListResponse
227252
examples:
228-
- response:
253+
- query-parameters:
254+
include: task_number,total_annotations_number,num_tasks_with_annotations
255+
response:
229256
body:
230257
count: 1
231258
next: next

poetry.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

reference.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3712,7 +3712,9 @@ from label_studio_sdk import LabelStudio
37123712
client = LabelStudio(
37133713
api_key="YOUR_API_KEY",
37143714
)
3715-
response = client.projects.list()
3715+
response = client.projects.list(
3716+
include="task_number,total_annotations_number,num_tasks_with_annotations",
3717+
)
37163718
for item in response:
37173719
yield item
37183720
# alternatively, you can paginate page-by-page
@@ -3781,6 +3783,22 @@ for page in response.iter_pages():
37813783
<dl>
37823784
<dd>
37833785

3786+
**include:** `typing.Optional[str]` — Comma-separated list of count fields to include in the response to optimize performance. Available fields: task_number, finished_task_number, total_predictions_number, total_annotations_number, num_tasks_with_annotations, useful_annotation_number, ground_truth_number, skipped_annotations_number. If not specified, all count fields are included.
3787+
3788+
</dd>
3789+
</dl>
3790+
3791+
<dl>
3792+
<dd>
3793+
3794+
**filter:** `typing.Optional[ProjectsListRequestFilter]` — Filter projects by pinned status. Use 'pinned_only' to return only pinned projects, 'exclude_pinned' to return only non-pinned projects, or 'all' to return all projects.
3795+
3796+
</dd>
3797+
</dl>
3798+
3799+
<dl>
3800+
<dd>
3801+
37843802
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
37853803

37863804
</dd>

src/label_studio_sdk/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,13 @@
159159
MlUpdateResponse,
160160
MlUpdateResponseAuthMethod,
161161
)
162-
from .projects import ProjectsCreateResponse, ProjectsImportTasksResponse, ProjectsListResponse, ProjectsUpdateResponse
162+
from .projects import (
163+
ProjectsCreateResponse,
164+
ProjectsImportTasksResponse,
165+
ProjectsListRequestFilter,
166+
ProjectsListResponse,
167+
ProjectsUpdateResponse,
168+
)
163169
from .prompts import (
164170
PromptsBatchFailedPredictionsRequestFailedPredictionsItem,
165171
PromptsBatchFailedPredictionsResponse,
@@ -293,6 +299,7 @@
293299
"ProjectSkipQueue",
294300
"ProjectsCreateResponse",
295301
"ProjectsImportTasksResponse",
302+
"ProjectsListRequestFilter",
296303
"ProjectsListResponse",
297304
"ProjectsUpdateResponse",
298305
"Prompt",

src/label_studio_sdk/projects/__init__.py

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

3-
from .types import ProjectsCreateResponse, ProjectsImportTasksResponse, ProjectsListResponse, ProjectsUpdateResponse
3+
from .types import (
4+
ProjectsCreateResponse,
5+
ProjectsImportTasksResponse,
6+
ProjectsListRequestFilter,
7+
ProjectsListResponse,
8+
ProjectsUpdateResponse,
9+
)
410
from . import exports, pauses
511
from .exports import ExportsConvertResponse, ExportsListFormatsResponseItem
612

@@ -9,6 +15,7 @@
915
"ExportsListFormatsResponseItem",
1016
"ProjectsCreateResponse",
1117
"ProjectsImportTasksResponse",
18+
"ProjectsListRequestFilter",
1219
"ProjectsListResponse",
1320
"ProjectsUpdateResponse",
1421
"exports",

src/label_studio_sdk/projects/client.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from ..core.client_wrapper import SyncClientWrapper
55
from .pauses.client import PausesClient
66
from .exports.client import ExportsClient
7+
from .types.projects_list_request_filter import ProjectsListRequestFilter
78
from ..core.request_options import RequestOptions
89
from ..core.pagination import SyncPager
910
from ..types.project import Project
@@ -41,6 +42,8 @@ def list(
4142
page: typing.Optional[int] = None,
4243
page_size: typing.Optional[int] = None,
4344
workspaces: typing.Optional[int] = None,
45+
include: typing.Optional[str] = None,
46+
filter: typing.Optional[ProjectsListRequestFilter] = None,
4447
request_options: typing.Optional[RequestOptions] = None,
4548
) -> SyncPager[Project]:
4649
"""
@@ -75,6 +78,12 @@ def list(
7578
workspaces : typing.Optional[int]
7679
workspaces
7780
81+
include : typing.Optional[str]
82+
Comma-separated list of count fields to include in the response to optimize performance. Available fields: task_number, finished_task_number, total_predictions_number, total_annotations_number, num_tasks_with_annotations, useful_annotation_number, ground_truth_number, skipped_annotations_number. If not specified, all count fields are included.
83+
84+
filter : typing.Optional[ProjectsListRequestFilter]
85+
Filter projects by pinned status. Use 'pinned_only' to return only pinned projects, 'exclude_pinned' to return only non-pinned projects, or 'all' to return all projects.
86+
7887
request_options : typing.Optional[RequestOptions]
7988
Request-specific configuration.
8089
@@ -90,7 +99,9 @@ def list(
9099
client = LabelStudio(
91100
api_key="YOUR_API_KEY",
92101
)
93-
response = client.projects.list()
102+
response = client.projects.list(
103+
include="task_number,total_annotations_number,num_tasks_with_annotations",
104+
)
94105
for item in response:
95106
yield item
96107
# alternatively, you can paginate page-by-page
@@ -108,6 +119,8 @@ def list(
108119
"page": page,
109120
"page_size": page_size,
110121
"workspaces": workspaces,
122+
"include": include,
123+
"filter": filter,
111124
},
112125
request_options=request_options,
113126
)
@@ -128,6 +141,8 @@ def list(
128141
page=page + 1,
129142
page_size=page_size,
130143
workspaces=workspaces,
144+
include=include,
145+
filter=filter,
131146
request_options=request_options,
132147
)
133148
_items = _parsed_response.results
@@ -714,6 +729,8 @@ async def list(
714729
page: typing.Optional[int] = None,
715730
page_size: typing.Optional[int] = None,
716731
workspaces: typing.Optional[int] = None,
732+
include: typing.Optional[str] = None,
733+
filter: typing.Optional[ProjectsListRequestFilter] = None,
717734
request_options: typing.Optional[RequestOptions] = None,
718735
) -> AsyncPager[Project]:
719736
"""
@@ -748,6 +765,12 @@ async def list(
748765
workspaces : typing.Optional[int]
749766
workspaces
750767
768+
include : typing.Optional[str]
769+
Comma-separated list of count fields to include in the response to optimize performance. Available fields: task_number, finished_task_number, total_predictions_number, total_annotations_number, num_tasks_with_annotations, useful_annotation_number, ground_truth_number, skipped_annotations_number. If not specified, all count fields are included.
770+
771+
filter : typing.Optional[ProjectsListRequestFilter]
772+
Filter projects by pinned status. Use 'pinned_only' to return only pinned projects, 'exclude_pinned' to return only non-pinned projects, or 'all' to return all projects.
773+
751774
request_options : typing.Optional[RequestOptions]
752775
Request-specific configuration.
753776
@@ -768,7 +791,9 @@ async def list(
768791
769792
770793
async def main() -> None:
771-
response = await client.projects.list()
794+
response = await client.projects.list(
795+
include="task_number,total_annotations_number,num_tasks_with_annotations",
796+
)
772797
async for item in response:
773798
yield item
774799
# alternatively, you can paginate page-by-page
@@ -789,6 +814,8 @@ async def main() -> None:
789814
"page": page,
790815
"page_size": page_size,
791816
"workspaces": workspaces,
817+
"include": include,
818+
"filter": filter,
792819
},
793820
request_options=request_options,
794821
)
@@ -809,6 +836,8 @@ async def main() -> None:
809836
page=page + 1,
810837
page_size=page_size,
811838
workspaces=workspaces,
839+
include=include,
840+
filter=filter,
812841
request_options=request_options,
813842
)
814843
_items = _parsed_response.results

src/label_studio_sdk/projects/exports/client_ext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def __init__(self, export_snapshot):
1515
super().__init__(
1616
status_code=500,
1717
body=(
18-
f"Export job timed out after {timeout} seconds: "
18+
f"Export job timed out: "
1919
f"unable to retrieve export job {export_snapshot.id}. "
2020
f"Current status: {export_snapshot.status}. "
2121
f"Try manually checking the running job with "
22-
f"`ls.projects.exports.get(project_id={project_id}, export_pk={export_snapshot.id})`."
22+
f"`ls.projects.exports.get(id=<PROJECT_ID>, export_pk={export_snapshot.id})`."
2323
)
2424
)
2525

src/label_studio_sdk/projects/types/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
from .projects_create_response import ProjectsCreateResponse
44
from .projects_import_tasks_response import ProjectsImportTasksResponse
5+
from .projects_list_request_filter import ProjectsListRequestFilter
56
from .projects_list_response import ProjectsListResponse
67
from .projects_update_response import ProjectsUpdateResponse
78

8-
__all__ = ["ProjectsCreateResponse", "ProjectsImportTasksResponse", "ProjectsListResponse", "ProjectsUpdateResponse"]
9+
__all__ = [
10+
"ProjectsCreateResponse",
11+
"ProjectsImportTasksResponse",
12+
"ProjectsListRequestFilter",
13+
"ProjectsListResponse",
14+
"ProjectsUpdateResponse",
15+
]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
ProjectsListRequestFilter = typing.Union[typing.Literal["all", "pinned_only", "exclude_pinned"], typing.Any]

src/label_studio_sdk/tokens/client_ext.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def refresh(self) -> AccessTokenResponse:
115115

116116
# For sync client, use it directly
117117
if isinstance(existing_client, httpx.Client):
118-
print(f"\nverify:{existing_client._transport._pool._ssl_context.verify_mode != ssl.CERT_NONE}")
119118
response = existing_client.request(
120119
method="POST",
121120
url=f"{self._base_url}/api/token/refresh/",

0 commit comments

Comments
 (0)