Skip to content

Commit 2d1ab67

Browse files
feat(backend/api,dashboard): add server-side recentlyCompleted sort for ListWorkflows
1 parent 9e0a178 commit 2d1ab67

4 files changed

Lines changed: 46 additions & 7 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 193
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-7a4f235379c078f7947364104260063f605613df775ccb0fe8d3710810589bc5.yml
3-
openapi_spec_hash: 2afba992f3e6ed516002fb391d54d7b4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-eb4b27e6f97d8a8ebb2a75f24367f74153abb7d3a7c16c9110fc0af1be6ed8c9.yml
3+
openapi_spec_hash: e1a8fd3ecf7c9ca8b7639857f56defc2
44
config_hash: 832c76d9cd88fc815f872ad64998911a

src/gitpod/resources/automations.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,22 @@ def list(
345345
page_size: int | Omit = omit,
346346
filter: automation_list_params.Filter | Omit = omit,
347347
pagination: automation_list_params.Pagination | Omit = omit,
348+
sort: automation_list_params.Sort | Omit = omit,
348349
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
349350
# The extra values given here take precedence over values defined on the client or passed to this method.
350351
extra_headers: Headers | None = None,
351352
extra_query: Query | None = None,
352353
extra_body: Body | None = None,
353354
timeout: float | httpx.Timeout | None | NotGiven = not_given,
354355
) -> SyncWorkflowsPage[Workflow]:
355-
"""
356-
ListWorkflows
356+
"""ListWorkflows
357357
358358
Args:
359+
sort: sort specifies the order of results.
360+
361+
When unspecified, results are sorted
362+
alphabetically by name ascending.
363+
359364
extra_headers: Send extra headers
360365
361366
extra_query: Add additional query parameters to the request
@@ -371,6 +376,7 @@ def list(
371376
{
372377
"filter": filter,
373378
"pagination": pagination,
379+
"sort": sort,
374380
},
375381
automation_list_params.AutomationListParams,
376382
),
@@ -1238,17 +1244,22 @@ def list(
12381244
page_size: int | Omit = omit,
12391245
filter: automation_list_params.Filter | Omit = omit,
12401246
pagination: automation_list_params.Pagination | Omit = omit,
1247+
sort: automation_list_params.Sort | Omit = omit,
12411248
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
12421249
# The extra values given here take precedence over values defined on the client or passed to this method.
12431250
extra_headers: Headers | None = None,
12441251
extra_query: Query | None = None,
12451252
extra_body: Body | None = None,
12461253
timeout: float | httpx.Timeout | None | NotGiven = not_given,
12471254
) -> AsyncPaginator[Workflow, AsyncWorkflowsPage[Workflow]]:
1248-
"""
1249-
ListWorkflows
1255+
"""ListWorkflows
12501256
12511257
Args:
1258+
sort: sort specifies the order of results.
1259+
1260+
When unspecified, results are sorted
1261+
alphabetically by name ascending.
1262+
12521263
extra_headers: Send extra headers
12531264
12541265
extra_query: Add additional query parameters to the request
@@ -1264,6 +1275,7 @@ def list(
12641275
{
12651276
"filter": filter,
12661277
"pagination": pagination,
1278+
"sort": sort,
12671279
},
12681280
automation_list_params.AutomationListParams,
12691281
),

src/gitpod/types/automation_list_params.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
from .._types import SequenceNotStr
1010
from .._utils import PropertyInfo
11+
from .shared.sort_order import SortOrder
1112

12-
__all__ = ["AutomationListParams", "Filter", "Pagination"]
13+
__all__ = ["AutomationListParams", "Filter", "Pagination", "Sort"]
1314

1415

1516
class AutomationListParams(TypedDict, total=False):
@@ -21,6 +22,12 @@ class AutomationListParams(TypedDict, total=False):
2122

2223
pagination: Pagination
2324

25+
sort: Sort
26+
"""sort specifies the order of results.
27+
28+
When unspecified, results are sorted alphabetically by name ascending.
29+
"""
30+
2431

2532
class Filter(TypedDict, total=False):
2633
creator_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="creatorIds")]
@@ -79,3 +86,15 @@ class Pagination(TypedDict, total=False):
7986
8087
Maximum 100.
8188
"""
89+
90+
91+
class Sort(TypedDict, total=False):
92+
"""sort specifies the order of results.
93+
94+
When unspecified, results are sorted
95+
alphabetically by name ascending.
96+
"""
97+
98+
field: Literal["SORT_FIELD_UNSPECIFIED", "SORT_FIELD_NAME", "SORT_FIELD_RECENTLY_COMPLETED"]
99+
100+
order: SortOrder

tests/api_resources/test_automations.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None:
393393
"token": "token",
394394
"page_size": 100,
395395
},
396+
sort={
397+
"field": "SORT_FIELD_UNSPECIFIED",
398+
"order": "SORT_ORDER_UNSPECIFIED",
399+
},
396400
)
397401
assert_matches_type(SyncWorkflowsPage[Workflow], automation, path=["response"])
398402

@@ -1152,6 +1156,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N
11521156
"token": "token",
11531157
"page_size": 100,
11541158
},
1159+
sort={
1160+
"field": "SORT_FIELD_UNSPECIFIED",
1161+
"order": "SORT_ORDER_UNSPECIFIED",
1162+
},
11551163
)
11561164
assert_matches_type(AsyncWorkflowsPage[Workflow], automation, path=["response"])
11571165

0 commit comments

Comments
 (0)