Skip to content

Commit 90e7ae3

Browse files
feat: [api] sorting for ListMembers
1 parent c2d4c90 commit 90e7ae3

4 files changed

Lines changed: 49 additions & 4 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: 160
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-47577991d03c0dab9d0f219bd3f6cf8cb3ea386a919a10c949318091aca5b10f.yml
3-
openapi_spec_hash: ad236fd154210c60d9aca150a3fd51bc
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-3a8fb9d6b9645a483a08206e944cc388325e210f0bd54daa9e15ee561a37fabc.yml
3+
openapi_spec_hash: fe42cbf3b012e4aebf56f64a675c3dd3
44
config_hash: f36d04c8359fe8baec226396a18b309e

src/gitpod/resources/organizations/organizations.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ def list_members(
507507
page_size: int | Omit = omit,
508508
filter: organization_list_members_params.Filter | Omit = omit,
509509
pagination: organization_list_members_params.Pagination | Omit = omit,
510+
sort: organization_list_members_params.Sort | Omit = omit,
510511
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
511512
# The extra values given here take precedence over values defined on the client or passed to this method.
512513
extra_headers: Headers | None = None,
@@ -551,6 +552,11 @@ def list_members(
551552
552553
pagination: pagination contains the pagination options for listing members
553554
555+
sort: sort specifies the order of results. When unspecified, the authenticated user is
556+
returned first, followed by other members sorted by name ascending. When an
557+
explicit sort is specified, results are sorted purely by the requested field
558+
without any special handling for the authenticated user.
559+
554560
extra_headers: Send extra headers
555561
556562
extra_query: Add additional query parameters to the request
@@ -567,6 +573,7 @@ def list_members(
567573
"organization_id": organization_id,
568574
"filter": filter,
569575
"pagination": pagination,
576+
"sort": sort,
570577
},
571578
organization_list_members_params.OrganizationListMembersParams,
572579
),
@@ -1086,6 +1093,7 @@ def list_members(
10861093
page_size: int | Omit = omit,
10871094
filter: organization_list_members_params.Filter | Omit = omit,
10881095
pagination: organization_list_members_params.Pagination | Omit = omit,
1096+
sort: organization_list_members_params.Sort | Omit = omit,
10891097
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10901098
# The extra values given here take precedence over values defined on the client or passed to this method.
10911099
extra_headers: Headers | None = None,
@@ -1130,6 +1138,11 @@ def list_members(
11301138
11311139
pagination: pagination contains the pagination options for listing members
11321140
1141+
sort: sort specifies the order of results. When unspecified, the authenticated user is
1142+
returned first, followed by other members sorted by name ascending. When an
1143+
explicit sort is specified, results are sorted purely by the requested field
1144+
without any special handling for the authenticated user.
1145+
11331146
extra_headers: Send extra headers
11341147
11351148
extra_query: Add additional query parameters to the request
@@ -1146,6 +1159,7 @@ def list_members(
11461159
"organization_id": organization_id,
11471160
"filter": filter,
11481161
"pagination": pagination,
1162+
"sort": sort,
11491163
},
11501164
organization_list_members_params.OrganizationListMembersParams,
11511165
),

src/gitpod/types/organization_list_members_params.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, Annotated, TypedDict
5+
from typing_extensions import Literal, Required, Annotated, TypedDict
66

77
from .._utils import PropertyInfo
88

9-
__all__ = ["OrganizationListMembersParams", "Filter", "Pagination"]
9+
__all__ = ["OrganizationListMembersParams", "Filter", "Pagination", "Sort"]
1010

1111

1212
class OrganizationListMembersParams(TypedDict, total=False):
@@ -22,6 +22,15 @@ class OrganizationListMembersParams(TypedDict, total=False):
2222
pagination: Pagination
2323
"""pagination contains the pagination options for listing members"""
2424

25+
sort: Sort
26+
"""sort specifies the order of results.
27+
28+
When unspecified, the authenticated user is returned first, followed by other
29+
members sorted by name ascending. When an explicit sort is specified, results
30+
are sorted purely by the requested field without any special handling for the
31+
authenticated user.
32+
"""
33+
2534

2635
class Filter(TypedDict, total=False):
2736
search: str
@@ -42,3 +51,17 @@ class Pagination(TypedDict, total=False):
4251
4352
Maximum 100.
4453
"""
54+
55+
56+
class Sort(TypedDict, total=False):
57+
"""sort specifies the order of results.
58+
59+
When unspecified, the authenticated user is
60+
returned first, followed by other members sorted by name ascending. When an explicit
61+
sort is specified, results are sorted purely by the requested field without any
62+
special handling for the authenticated user.
63+
"""
64+
65+
field: Literal["SORT_FIELD_UNSPECIFIED", "SORT_FIELD_NAME", "SORT_FIELD_DATE_JOINED"]
66+
67+
order: Literal["SORT_ORDER_UNSPECIFIED", "SORT_ORDER_ASC", "SORT_ORDER_DESC"]

tests/api_resources/test_organizations.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ def test_method_list_members_with_all_params(self, client: Gitpod) -> None:
271271
"token": "token",
272272
"page_size": 20,
273273
},
274+
sort={
275+
"field": "SORT_FIELD_UNSPECIFIED",
276+
"order": "SORT_ORDER_UNSPECIFIED",
277+
},
274278
)
275279
assert_matches_type(SyncMembersPage[OrganizationMember], organization, path=["response"])
276280

@@ -600,6 +604,10 @@ async def test_method_list_members_with_all_params(self, async_client: AsyncGitp
600604
"token": "token",
601605
"page_size": 20,
602606
},
607+
sort={
608+
"field": "SORT_FIELD_UNSPECIFIED",
609+
"order": "SORT_ORDER_UNSPECIFIED",
610+
},
603611
)
604612
assert_matches_type(AsyncMembersPage[OrganizationMember], organization, path=["response"])
605613

0 commit comments

Comments
 (0)