Skip to content

Commit af22da1

Browse files
feat(api): fix pagination field names
1 parent 75dc8c4 commit af22da1

File tree

20 files changed

+250
-276
lines changed

20 files changed

+250
-276
lines changed

Diff for: api.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Methods:
1616
- <code title="post /gitpod.v1.AccountService/GetAccount">client.accounts.<a href="./src/gitpod/resources/accounts.py">retrieve</a>(\*\*<a href="src/gitpod/types/account_retrieve_params.py">params</a>) -> <a href="./src/gitpod/types/account_retrieve_response.py">AccountRetrieveResponse</a></code>
1717
- <code title="post /gitpod.v1.AccountService/DeleteAccount">client.accounts.<a href="./src/gitpod/resources/accounts.py">delete</a>(\*\*<a href="src/gitpod/types/account_delete_params.py">params</a>) -> <a href="./src/gitpod/types/account_delete_response.py">object</a></code>
1818
- <code title="post /gitpod.v1.AccountService/GetSSOLoginURL">client.accounts.<a href="./src/gitpod/resources/accounts.py">get_sso_login_url</a>(\*\*<a href="src/gitpod/types/account_get_sso_login_url_params.py">params</a>) -> <a href="./src/gitpod/types/account_get_sso_login_url_response.py">AccountGetSSOLoginURLResponse</a></code>
19-
- <code title="post /gitpod.v1.AccountService/ListLoginProviders">client.accounts.<a href="./src/gitpod/resources/accounts.py">list_login_providers</a>(\*\*<a href="src/gitpod/types/account_list_login_providers_params.py">params</a>) -> <a href="./src/gitpod/types/account_list_login_providers_response.py">AccountListLoginProvidersResponse</a></code>
19+
- <code title="post /gitpod.v1.AccountService/ListLoginProviders">client.accounts.<a href="./src/gitpod/resources/accounts.py">list_login_providers</a>(\*\*<a href="src/gitpod/types/account_list_login_providers_params.py">params</a>) -> <a href="./src/gitpod/types/account_list_login_providers_response.py">SyncLoginProvidersPage[AccountListLoginProvidersResponse]</a></code>
2020

2121
# Editors
2222

@@ -141,7 +141,7 @@ from gitpod.types.environments.automations.tasks import (
141141
Methods:
142142

143143
- <code title="post /gitpod.v1.EnvironmentAutomationService/GetTaskExecution">client.environments.automations.tasks.executions.<a href="./src/gitpod/resources/environments/automations/tasks/executions.py">retrieve</a>(\*\*<a href="src/gitpod/types/environments/automations/tasks/execution_retrieve_params.py">params</a>) -> <a href="./src/gitpod/types/environments/automations/tasks/execution_retrieve_response.py">ExecutionRetrieveResponse</a></code>
144-
- <code title="post /gitpod.v1.EnvironmentAutomationService/ListTaskExecutions">client.environments.automations.tasks.executions.<a href="./src/gitpod/resources/environments/automations/tasks/executions.py">list</a>(\*\*<a href="src/gitpod/types/environments/automations/tasks/execution_list_params.py">params</a>) -> <a href="./src/gitpod/types/environments/automations/tasks/execution_list_response.py">ExecutionListResponse</a></code>
144+
- <code title="post /gitpod.v1.EnvironmentAutomationService/ListTaskExecutions">client.environments.automations.tasks.executions.<a href="./src/gitpod/resources/environments/automations/tasks/executions.py">list</a>(\*\*<a href="src/gitpod/types/environments/automations/tasks/execution_list_params.py">params</a>) -> <a href="./src/gitpod/types/environments/automations/tasks/execution_list_response.py">SyncTaskExecutionsPage[ExecutionListResponse]</a></code>
145145
- <code title="post /gitpod.v1.EnvironmentAutomationService/StopTaskExecution">client.environments.automations.tasks.executions.<a href="./src/gitpod/resources/environments/automations/tasks/executions.py">stop</a>(\*\*<a href="src/gitpod/types/environments/automations/tasks/execution_stop_params.py">params</a>) -> <a href="./src/gitpod/types/environments/automations/tasks/execution_stop_response.py">object</a></code>
146146

147147
## Classes
@@ -154,7 +154,7 @@ from gitpod.types.environments import ClassListResponse
154154

155155
Methods:
156156

157-
- <code title="post /gitpod.v1.EnvironmentService/ListEnvironmentClasses">client.environments.classes.<a href="./src/gitpod/resources/environments/classes.py">list</a>(\*\*<a href="src/gitpod/types/environments/class_list_params.py">params</a>) -> <a href="./src/gitpod/types/environments/class_list_response.py">ClassListResponse</a></code>
157+
- <code title="post /gitpod.v1.EnvironmentService/ListEnvironmentClasses">client.environments.classes.<a href="./src/gitpod/resources/environments/classes.py">list</a>(\*\*<a href="src/gitpod/types/environments/class_list_params.py">params</a>) -> <a href="./src/gitpod/types/environments/class_list_response.py">SyncEnvironmentClassesPage[ClassListResponse]</a></code>
158158

159159
# Events
160160

@@ -266,7 +266,7 @@ Methods:
266266
- <code title="post /gitpod.v1.OrganizationService/CreateSSOConfiguration">client.organizations.sso_configurations.<a href="./src/gitpod/resources/organizations/sso_configurations.py">create</a>(\*\*<a href="src/gitpod/types/organizations/sso_configuration_create_params.py">params</a>) -> <a href="./src/gitpod/types/organizations/sso_configuration_create_response.py">SSOConfigurationCreateResponse</a></code>
267267
- <code title="post /gitpod.v1.OrganizationService/GetSSOConfiguration">client.organizations.sso_configurations.<a href="./src/gitpod/resources/organizations/sso_configurations.py">retrieve</a>(\*\*<a href="src/gitpod/types/organizations/sso_configuration_retrieve_params.py">params</a>) -> <a href="./src/gitpod/types/organizations/sso_configuration_retrieve_response.py">SSOConfigurationRetrieveResponse</a></code>
268268
- <code title="post /gitpod.v1.OrganizationService/UpdateSSOConfiguration">client.organizations.sso_configurations.<a href="./src/gitpod/resources/organizations/sso_configurations.py">update</a>(\*\*<a href="src/gitpod/types/organizations/sso_configuration_update_params.py">params</a>) -> <a href="./src/gitpod/types/organizations/sso_configuration_update_response.py">object</a></code>
269-
- <code title="post /gitpod.v1.OrganizationService/ListSSOConfigurations">client.organizations.sso_configurations.<a href="./src/gitpod/resources/organizations/sso_configurations.py">list</a>(\*\*<a href="src/gitpod/types/organizations/sso_configuration_list_params.py">params</a>) -> <a href="./src/gitpod/types/organizations/sso_configuration_list_response.py">SSOConfigurationListResponse</a></code>
269+
- <code title="post /gitpod.v1.OrganizationService/ListSSOConfigurations">client.organizations.sso_configurations.<a href="./src/gitpod/resources/organizations/sso_configurations.py">list</a>(\*\*<a href="src/gitpod/types/organizations/sso_configuration_list_params.py">params</a>) -> <a href="./src/gitpod/types/organizations/sso_configuration_list_response.py">SyncSSOConfigurationsPage[SSOConfigurationListResponse]</a></code>
270270
- <code title="post /gitpod.v1.OrganizationService/DeleteSSOConfiguration">client.organizations.sso_configurations.<a href="./src/gitpod/resources/organizations/sso_configurations.py">delete</a>(\*\*<a href="src/gitpod/types/organizations/sso_configuration_delete_params.py">params</a>) -> <a href="./src/gitpod/types/organizations/sso_configuration_delete_response.py">object</a></code>
271271

272272
# Projects
@@ -371,7 +371,7 @@ Methods:
371371
- <code title="post /gitpod.v1.RunnerConfigurationService/CreateEnvironmentClass">client.runners.configurations.environment_classes.<a href="./src/gitpod/resources/runners/configurations/environment_classes.py">create</a>(\*\*<a href="src/gitpod/types/runners/configurations/environment_class_create_params.py">params</a>) -> <a href="./src/gitpod/types/runners/configurations/environment_class_create_response.py">EnvironmentClassCreateResponse</a></code>
372372
- <code title="post /gitpod.v1.RunnerConfigurationService/GetEnvironmentClass">client.runners.configurations.environment_classes.<a href="./src/gitpod/resources/runners/configurations/environment_classes.py">retrieve</a>(\*\*<a href="src/gitpod/types/runners/configurations/environment_class_retrieve_params.py">params</a>) -> <a href="./src/gitpod/types/runners/configurations/environment_class_retrieve_response.py">EnvironmentClassRetrieveResponse</a></code>
373373
- <code title="post /gitpod.v1.RunnerConfigurationService/UpdateEnvironmentClass">client.runners.configurations.environment_classes.<a href="./src/gitpod/resources/runners/configurations/environment_classes.py">update</a>(\*\*<a href="src/gitpod/types/runners/configurations/environment_class_update_params.py">params</a>) -> <a href="./src/gitpod/types/runners/configurations/environment_class_update_response.py">object</a></code>
374-
- <code title="post /gitpod.v1.RunnerConfigurationService/ListEnvironmentClasses">client.runners.configurations.environment_classes.<a href="./src/gitpod/resources/runners/configurations/environment_classes.py">list</a>(\*\*<a href="src/gitpod/types/runners/configurations/environment_class_list_params.py">params</a>) -> <a href="./src/gitpod/types/runners/configurations/environment_class_list_response.py">EnvironmentClassListResponse</a></code>
374+
- <code title="post /gitpod.v1.RunnerConfigurationService/ListEnvironmentClasses">client.runners.configurations.environment_classes.<a href="./src/gitpod/resources/runners/configurations/environment_classes.py">list</a>(\*\*<a href="src/gitpod/types/runners/configurations/environment_class_list_params.py">params</a>) -> <a href="./src/gitpod/types/runners/configurations/environment_class_list_response.py">SyncEnvironmentClassesPage[EnvironmentClassListResponse]</a></code>
375375

376376
### HostAuthenticationTokens
377377

@@ -494,6 +494,6 @@ from gitpod.types.users import PatListResponse, PatDeleteResponse, PatGetRespons
494494

495495
Methods:
496496

497-
- <code title="post /gitpod.v1.UserService/ListPersonalAccessTokens">client.users.pats.<a href="./src/gitpod/resources/users/pats.py">list</a>(\*\*<a href="src/gitpod/types/users/pat_list_params.py">params</a>) -> <a href="./src/gitpod/types/users/pat_list_response.py">PatListResponse</a></code>
497+
- <code title="post /gitpod.v1.UserService/ListPersonalAccessTokens">client.users.pats.<a href="./src/gitpod/resources/users/pats.py">list</a>(\*\*<a href="src/gitpod/types/users/pat_list_params.py">params</a>) -> <a href="./src/gitpod/types/users/pat_list_response.py">SyncPersonalAccessTokensPage[PatListResponse]</a></code>
498498
- <code title="post /gitpod.v1.UserService/DeletePersonalAccessToken">client.users.pats.<a href="./src/gitpod/resources/users/pats.py">delete</a>(\*\*<a href="src/gitpod/types/users/pat_delete_params.py">params</a>) -> <a href="./src/gitpod/types/users/pat_delete_response.py">object</a></code>
499499
- <code title="post /gitpod.v1.UserService/GetPersonalAccessToken">client.users.pats.<a href="./src/gitpod/resources/users/pats.py">get</a>(\*\*<a href="src/gitpod/types/users/pat_get_params.py">params</a>) -> <a href="./src/gitpod/types/users/pat_get_response.py">PatGetResponse</a></code>

Diff for: src/gitpod/pagination.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class EnvironmentClassesPagePagination(BaseModel):
176176

177177

178178
class SyncEnvironmentClassesPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
179-
environment_classes: List[_T]
179+
environment_classes: List[_T] = FieldInfo(alias="environmentClasses")
180180
pagination: Optional[EnvironmentClassesPagePagination] = None
181181

182182
@override
@@ -199,7 +199,7 @@ def next_page_info(self) -> Optional[PageInfo]:
199199

200200

201201
class AsyncEnvironmentClassesPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
202-
environment_classes: List[_T]
202+
environment_classes: List[_T] = FieldInfo(alias="environmentClasses")
203203
pagination: Optional[EnvironmentClassesPagePagination] = None
204204

205205
@override
@@ -376,7 +376,7 @@ class LoginProvidersPagePagination(BaseModel):
376376

377377

378378
class SyncLoginProvidersPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
379-
login_providers: List[_T]
379+
login_providers: List[_T] = FieldInfo(alias="loginProviders")
380380
pagination: Optional[LoginProvidersPagePagination] = None
381381

382382
@override
@@ -399,7 +399,7 @@ def next_page_info(self) -> Optional[PageInfo]:
399399

400400

401401
class AsyncLoginProvidersPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
402-
login_providers: List[_T]
402+
login_providers: List[_T] = FieldInfo(alias="loginProviders")
403403
pagination: Optional[LoginProvidersPagePagination] = None
404404

405405
@override
@@ -527,7 +527,7 @@ class PersonalAccessTokensPagePagination(BaseModel):
527527

528528
class SyncPersonalAccessTokensPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
529529
pagination: Optional[PersonalAccessTokensPagePagination] = None
530-
personal_access_tokens: List[_T]
530+
personal_access_tokens: List[_T] = FieldInfo(alias="personalAccessTokens")
531531

532532
@override
533533
def _get_page_items(self) -> List[_T]:
@@ -550,7 +550,7 @@ def next_page_info(self) -> Optional[PageInfo]:
550550

551551
class AsyncPersonalAccessTokensPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
552552
pagination: Optional[PersonalAccessTokensPagePagination] = None
553-
personal_access_tokens: List[_T]
553+
personal_access_tokens: List[_T] = FieldInfo(alias="personalAccessTokens")
554554

555555
@override
556556
def _get_page_items(self) -> List[_T]:
@@ -827,7 +827,7 @@ class SSOConfigurationsPagePagination(BaseModel):
827827

828828
class SyncSSOConfigurationsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
829829
pagination: Optional[SSOConfigurationsPagePagination] = None
830-
sso_configurations: List[_T]
830+
sso_configurations: List[_T] = FieldInfo(alias="ssoConfigurations")
831831

832832
@override
833833
def _get_page_items(self) -> List[_T]:
@@ -850,7 +850,7 @@ def next_page_info(self) -> Optional[PageInfo]:
850850

851851
class AsyncSSOConfigurationsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
852852
pagination: Optional[SSOConfigurationsPagePagination] = None
853-
sso_configurations: List[_T]
853+
sso_configurations: List[_T] = FieldInfo(alias="ssoConfigurations")
854854

855855
@override
856856
def _get_page_items(self) -> List[_T]:
@@ -877,7 +877,7 @@ class TaskExecutionsPagePagination(BaseModel):
877877

878878
class SyncTaskExecutionsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
879879
pagination: Optional[TaskExecutionsPagePagination] = None
880-
task_executions: List[_T]
880+
task_executions: List[_T] = FieldInfo(alias="taskExecutions")
881881

882882
@override
883883
def _get_page_items(self) -> List[_T]:
@@ -900,7 +900,7 @@ def next_page_info(self) -> Optional[PageInfo]:
900900

901901
class AsyncTaskExecutionsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
902902
pagination: Optional[TaskExecutionsPagePagination] = None
903-
task_executions: List[_T]
903+
task_executions: List[_T] = FieldInfo(alias="taskExecutions")
904904

905905
@override
906906
def _get_page_items(self) -> List[_T]:

Diff for: src/gitpod/resources/accounts.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
async_to_raw_response_wrapper,
2424
async_to_streamed_response_wrapper,
2525
)
26-
from .._base_client import make_request_options
26+
from ..pagination import SyncLoginProvidersPage, AsyncLoginProvidersPage
27+
from .._base_client import AsyncPaginator, make_request_options
2728
from ..types.account_retrieve_response import AccountRetrieveResponse
2829
from ..types.account_get_sso_login_url_response import AccountGetSSOLoginURLResponse
2930
from ..types.account_list_login_providers_response import AccountListLoginProvidersResponse
@@ -173,7 +174,7 @@ def list_login_providers(
173174
extra_query: Query | None = None,
174175
extra_body: Body | None = None,
175176
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
176-
) -> AccountListLoginProvidersResponse:
177+
) -> SyncLoginProvidersPage[AccountListLoginProvidersResponse]:
177178
"""
178179
ListLoginProviders returns the list of login providers matching the provided
179180
filters.
@@ -191,8 +192,9 @@ def list_login_providers(
191192
192193
timeout: Override the client-level default timeout for this request, in seconds
193194
"""
194-
return self._post(
195+
return self._get_api_list(
195196
"/gitpod.v1.AccountService/ListLoginProviders",
197+
page=SyncLoginProvidersPage[AccountListLoginProvidersResponse],
196198
body=maybe_transform(
197199
{
198200
"filter": filter,
@@ -213,7 +215,8 @@ def list_login_providers(
213215
account_list_login_providers_params.AccountListLoginProvidersParams,
214216
),
215217
),
216-
cast_to=AccountListLoginProvidersResponse,
218+
model=AccountListLoginProvidersResponse,
219+
method="post",
217220
)
218221

219222

@@ -346,7 +349,7 @@ async def get_sso_login_url(
346349
cast_to=AccountGetSSOLoginURLResponse,
347350
)
348351

349-
async def list_login_providers(
352+
def list_login_providers(
350353
self,
351354
*,
352355
token: str | NotGiven = NOT_GIVEN,
@@ -359,7 +362,7 @@ async def list_login_providers(
359362
extra_query: Query | None = None,
360363
extra_body: Body | None = None,
361364
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
362-
) -> AccountListLoginProvidersResponse:
365+
) -> AsyncPaginator[AccountListLoginProvidersResponse, AsyncLoginProvidersPage[AccountListLoginProvidersResponse]]:
363366
"""
364367
ListLoginProviders returns the list of login providers matching the provided
365368
filters.
@@ -377,9 +380,10 @@ async def list_login_providers(
377380
378381
timeout: Override the client-level default timeout for this request, in seconds
379382
"""
380-
return await self._post(
383+
return self._get_api_list(
381384
"/gitpod.v1.AccountService/ListLoginProviders",
382-
body=await async_maybe_transform(
385+
page=AsyncLoginProvidersPage[AccountListLoginProvidersResponse],
386+
body=maybe_transform(
383387
{
384388
"filter": filter,
385389
"pagination": pagination,
@@ -391,15 +395,16 @@ async def list_login_providers(
391395
extra_query=extra_query,
392396
extra_body=extra_body,
393397
timeout=timeout,
394-
query=await async_maybe_transform(
398+
query=maybe_transform(
395399
{
396400
"token": token,
397401
"page_size": page_size,
398402
},
399403
account_list_login_providers_params.AccountListLoginProvidersParams,
400404
),
401405
),
402-
cast_to=AccountListLoginProvidersResponse,
406+
model=AccountListLoginProvidersResponse,
407+
method="post",
403408
)
404409

405410

0 commit comments

Comments
 (0)