Skip to content

Commit fada768

Browse files
feat(api): add sort parameter to projects list, SortOrder/SortParam types
1 parent c5c6a3a commit fada768

File tree

9 files changed

+75
-4
lines changed

9 files changed

+75
-4
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 175
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-5498c80829cdba9708b7765af11a4c6668383640159e195835b768d1d0070a2c.yml
3-
openapi_spec_hash: 9bbcc41c34e3fcc108e19e4335fa82cd
4-
config_hash: e561ac157e2bab45b5c366f2cf6b526e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-8507bc4eff2dbfe0392f2a2e18b337827935aaa2d99046653efca1c43a5f82cd.yml
3+
openapi_spec_hash: 8a9387a75d5d0dcaa53d01ba6f52f2c9
4+
config_hash: 37a21c5644cb6c8f1d592ea2ec7c66d7

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ from gitpod.types import (
555555
ProjectPhase,
556556
ProjectPrebuildConfiguration,
557557
RecommendedEditors,
558+
Sort,
559+
SortOrder,
558560
ProjectCreateResponse,
559561
ProjectRetrieveResponse,
560562
ProjectUpdateResponse,

src/gitpod/resources/projects/projects.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from ...pagination import SyncProjectsPage, AsyncProjectsPage
3939
from ..._base_client import AsyncPaginator, make_request_options
4040
from ...types.project import Project
41+
from ...types.sort_param import SortParam
4142
from .environment_clases import (
4243
EnvironmentClasesResource,
4344
AsyncEnvironmentClasesResource,
@@ -364,6 +365,7 @@ def list(
364365
page_size: int | Omit = omit,
365366
filter: project_list_params.Filter | Omit = omit,
366367
pagination: project_list_params.Pagination | Omit = omit,
368+
sort: SortParam | Omit = omit,
367369
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
368370
# The extra values given here take precedence over values defined on the client or passed to this method.
369371
extra_headers: Headers | None = None,
@@ -394,6 +396,15 @@ def list(
394396
Args:
395397
pagination: pagination contains the pagination options for listing organizations
396398
399+
sort: sort specifies the order of results. Defaults to popularity descending.
400+
401+
Supported fields:
402+
403+
- "id": Sort by project ID (UUID v7, effectively creation order). Produces a
404+
stable, deterministic result set suitable for consistent pagination.
405+
- "popularity": Sort by popularity — a precomputed score based on recent
406+
environment creation activity. Updated periodically by a background job.
407+
397408
extra_headers: Send extra headers
398409
399410
extra_query: Add additional query parameters to the request
@@ -409,6 +420,7 @@ def list(
409420
{
410421
"filter": filter,
411422
"pagination": pagination,
423+
"sort": sort,
412424
},
413425
project_list_params.ProjectListParams,
414426
),
@@ -1008,6 +1020,7 @@ def list(
10081020
page_size: int | Omit = omit,
10091021
filter: project_list_params.Filter | Omit = omit,
10101022
pagination: project_list_params.Pagination | Omit = omit,
1023+
sort: SortParam | Omit = omit,
10111024
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10121025
# The extra values given here take precedence over values defined on the client or passed to this method.
10131026
extra_headers: Headers | None = None,
@@ -1038,6 +1051,15 @@ def list(
10381051
Args:
10391052
pagination: pagination contains the pagination options for listing organizations
10401053
1054+
sort: sort specifies the order of results. Defaults to popularity descending.
1055+
1056+
Supported fields:
1057+
1058+
- "id": Sort by project ID (UUID v7, effectively creation order). Produces a
1059+
stable, deterministic result set suitable for consistent pagination.
1060+
- "popularity": Sort by popularity — a precomputed score based on recent
1061+
environment creation activity. Updated periodically by a background job.
1062+
10411063
extra_headers: Send extra headers
10421064
10431065
extra_query: Add additional query parameters to the request
@@ -1053,6 +1075,7 @@ def list(
10531075
{
10541076
"filter": filter,
10551077
"pagination": pagination,
1078+
"sort": sort,
10561079
},
10571080
project_list_params.ProjectListParams,
10581081
),

src/gitpod/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
from .prebuild import Prebuild as Prebuild
4343
from .log_level import LogLevel as LogLevel
4444
from .agent_mode import AgentMode as AgentMode
45+
from .sort_order import SortOrder as SortOrder
46+
from .sort_param import SortParam as SortParam
4547
from .veto_param import VetoParam as VetoParam
4648
from .environment import Environment as Environment
4749
from .error_level import ErrorLevel as ErrorLevel

src/gitpod/types/organization_list_members_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from .._types import SequenceNotStr
99
from .._utils import PropertyInfo
10+
from .sort_order import SortOrder
1011
from .shared.user_status import UserStatus
1112
from .shared.organization_role import OrganizationRole
1213

@@ -83,4 +84,4 @@ class Sort(TypedDict, total=False):
8384

8485
field: Literal["SORT_FIELD_UNSPECIFIED", "SORT_FIELD_NAME", "SORT_FIELD_DATE_JOINED"]
8586

86-
order: Literal["SORT_ORDER_UNSPECIFIED", "SORT_ORDER_ASC", "SORT_ORDER_DESC"]
87+
order: SortOrder

src/gitpod/types/project_list_params.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from .._types import SequenceNotStr
99
from .._utils import PropertyInfo
10+
from .sort_param import SortParam
1011
from .runner_kind import RunnerKind
1112

1213
__all__ = ["ProjectListParams", "Filter", "Pagination"]
@@ -22,6 +23,17 @@ class ProjectListParams(TypedDict, total=False):
2223
pagination: Pagination
2324
"""pagination contains the pagination options for listing organizations"""
2425

26+
sort: SortParam
27+
"""sort specifies the order of results. Defaults to popularity descending.
28+
29+
Supported fields:
30+
31+
- "id": Sort by project ID (UUID v7, effectively creation order). Produces a
32+
stable, deterministic result set suitable for consistent pagination.
33+
- "popularity": Sort by popularity — a precomputed score based on recent
34+
environment creation activity. Updated periodically by a background job.
35+
"""
36+
2537

2638
class Filter(TypedDict, total=False):
2739
project_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="projectIds")]

src/gitpod/types/sort_order.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import Literal, TypeAlias
4+
5+
__all__ = ["SortOrder"]
6+
7+
SortOrder: TypeAlias = Literal["SORT_ORDER_UNSPECIFIED", "SORT_ORDER_ASC", "SORT_ORDER_DESC"]

src/gitpod/types/sort_param.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
from .sort_order import SortOrder
8+
9+
__all__ = ["SortParam"]
10+
11+
12+
class SortParam(TypedDict, total=False):
13+
field: str
14+
"""Field name to sort by, in camelCase."""
15+
16+
order: SortOrder

tests/api_resources/test_projects.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None:
221221
"token": "token",
222222
"page_size": 20,
223223
},
224+
sort={
225+
"field": "field",
226+
"order": "SORT_ORDER_UNSPECIFIED",
227+
},
224228
)
225229
assert_matches_type(SyncProjectsPage[Project], project, path=["response"])
226230

@@ -757,6 +761,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N
757761
"token": "token",
758762
"page_size": 20,
759763
},
764+
sort={
765+
"field": "field",
766+
"order": "SORT_ORDER_UNSPECIFIED",
767+
},
760768
)
761769
assert_matches_type(AsyncProjectsPage[Project], project, path=["response"])
762770

0 commit comments

Comments
 (0)