Skip to content

Commit 7cdce62

Browse files
feat(api): add automations resource with workflows/executions/actions
1 parent 19af3c6 commit 7cdce62

39 files changed

Lines changed: 6773 additions & 3 deletions

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 180
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-426f3adea47f1f9969b3ace193806d0b5c6cca002b59f1306ff55a53ba184d41.yml
1+
configured_endpoints: 193
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d7e6093517f83ea4606a88899e81565c0f9207614e112b6057679645e0651801.yml
33
openapi_spec_hash: c4f8786a933b74d658f315ed5587b4bd
4-
config_hash: 65442903d648b9f87a032fc0a4823e62
4+
config_hash: 8f918c43124691f0ddd95f5fd521960a

api.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,45 @@ Methods:
100100
- <code title="post /gitpod.v1.AgentService/StopAgentExecution">client.agents.<a href="./src/gitpod/resources/agents.py">stop_execution</a>(\*\*<a href="src/gitpod/types/agent_stop_execution_params.py">params</a>) -> object</code>
101101
- <code title="post /gitpod.v1.AgentService/UpdatePrompt">client.agents.<a href="./src/gitpod/resources/agents.py">update_prompt</a>(\*\*<a href="src/gitpod/types/agent_update_prompt_params.py">params</a>) -> <a href="./src/gitpod/types/agent_update_prompt_response.py">AgentUpdatePromptResponse</a></code>
102102

103+
# Automations
104+
105+
Types:
106+
107+
```python
108+
from gitpod.types import (
109+
Workflow,
110+
WorkflowAction,
111+
WorkflowExecution,
112+
WorkflowExecutionAction,
113+
WorkflowStep,
114+
WorkflowTrigger,
115+
WorkflowTriggerContext,
116+
AutomationCreateResponse,
117+
AutomationRetrieveResponse,
118+
AutomationUpdateResponse,
119+
AutomationListExecutionOutputsResponse,
120+
AutomationRetrieveExecutionResponse,
121+
AutomationRetrieveExecutionActionResponse,
122+
AutomationStartExecutionResponse,
123+
)
124+
```
125+
126+
Methods:
127+
128+
- <code title="post /gitpod.v1.WorkflowService/CreateWorkflow">client.automations.<a href="./src/gitpod/resources/automations.py">create</a>(\*\*<a href="src/gitpod/types/automation_create_params.py">params</a>) -> <a href="./src/gitpod/types/automation_create_response.py">AutomationCreateResponse</a></code>
129+
- <code title="post /gitpod.v1.WorkflowService/GetWorkflow">client.automations.<a href="./src/gitpod/resources/automations.py">retrieve</a>(\*\*<a href="src/gitpod/types/automation_retrieve_params.py">params</a>) -> <a href="./src/gitpod/types/automation_retrieve_response.py">AutomationRetrieveResponse</a></code>
130+
- <code title="post /gitpod.v1.WorkflowService/UpdateWorkflow">client.automations.<a href="./src/gitpod/resources/automations.py">update</a>(\*\*<a href="src/gitpod/types/automation_update_params.py">params</a>) -> <a href="./src/gitpod/types/automation_update_response.py">AutomationUpdateResponse</a></code>
131+
- <code title="post /gitpod.v1.WorkflowService/ListWorkflows">client.automations.<a href="./src/gitpod/resources/automations.py">list</a>(\*\*<a href="src/gitpod/types/automation_list_params.py">params</a>) -> <a href="./src/gitpod/types/workflow.py">SyncWorkflowsPage[Workflow]</a></code>
132+
- <code title="post /gitpod.v1.WorkflowService/DeleteWorkflow">client.automations.<a href="./src/gitpod/resources/automations.py">delete</a>(\*\*<a href="src/gitpod/types/automation_delete_params.py">params</a>) -> object</code>
133+
- <code title="post /gitpod.v1.WorkflowService/CancelWorkflowExecution">client.automations.<a href="./src/gitpod/resources/automations.py">cancel_execution</a>(\*\*<a href="src/gitpod/types/automation_cancel_execution_params.py">params</a>) -> object</code>
134+
- <code title="post /gitpod.v1.WorkflowService/CancelWorkflowExecutionAction">client.automations.<a href="./src/gitpod/resources/automations.py">cancel_execution_action</a>(\*\*<a href="src/gitpod/types/automation_cancel_execution_action_params.py">params</a>) -> object</code>
135+
- <code title="post /gitpod.v1.WorkflowService/ListWorkflowExecutionActions">client.automations.<a href="./src/gitpod/resources/automations.py">list_execution_actions</a>(\*\*<a href="src/gitpod/types/automation_list_execution_actions_params.py">params</a>) -> <a href="./src/gitpod/types/workflow_execution_action.py">SyncWorkflowExecutionActionsPage[WorkflowExecutionAction]</a></code>
136+
- <code title="post /gitpod.v1.WorkflowService/ListWorkflowExecutionOutputs">client.automations.<a href="./src/gitpod/resources/automations.py">list_execution_outputs</a>(\*\*<a href="src/gitpod/types/automation_list_execution_outputs_params.py">params</a>) -> <a href="./src/gitpod/types/automation_list_execution_outputs_response.py">SyncOutputsPage[AutomationListExecutionOutputsResponse]</a></code>
137+
- <code title="post /gitpod.v1.WorkflowService/ListWorkflowExecutions">client.automations.<a href="./src/gitpod/resources/automations.py">list_executions</a>(\*\*<a href="src/gitpod/types/automation_list_executions_params.py">params</a>) -> <a href="./src/gitpod/types/workflow_execution.py">SyncWorkflowExecutionsPage[WorkflowExecution]</a></code>
138+
- <code title="post /gitpod.v1.WorkflowService/GetWorkflowExecution">client.automations.<a href="./src/gitpod/resources/automations.py">retrieve_execution</a>(\*\*<a href="src/gitpod/types/automation_retrieve_execution_params.py">params</a>) -> <a href="./src/gitpod/types/automation_retrieve_execution_response.py">AutomationRetrieveExecutionResponse</a></code>
139+
- <code title="post /gitpod.v1.WorkflowService/GetWorkflowExecutionAction">client.automations.<a href="./src/gitpod/resources/automations.py">retrieve_execution_action</a>(\*\*<a href="src/gitpod/types/automation_retrieve_execution_action_params.py">params</a>) -> <a href="./src/gitpod/types/automation_retrieve_execution_action_response.py">AutomationRetrieveExecutionActionResponse</a></code>
140+
- <code title="post /gitpod.v1.WorkflowService/StartWorkflow">client.automations.<a href="./src/gitpod/resources/automations.py">start_execution</a>(\*\*<a href="src/gitpod/types/automation_start_execution_params.py">params</a>) -> <a href="./src/gitpod/types/automation_start_execution_response.py">AutomationStartExecutionResponse</a></code>
141+
103142
# Editors
104143

105144
Types:

src/gitpod/_client.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
identity,
4747
projects,
4848
prebuilds,
49+
automations,
4950
environments,
5051
organizations,
5152
)
@@ -59,6 +60,7 @@
5960
from .resources.gateways import GatewaysResource, AsyncGatewaysResource
6061
from .resources.identity import IdentityResource, AsyncIdentityResource
6162
from .resources.prebuilds import PrebuildsResource, AsyncPrebuildsResource
63+
from .resources.automations import AutomationsResource, AsyncAutomationsResource
6264
from .resources.users.users import UsersResource, AsyncUsersResource
6365
from .resources.groups.groups import GroupsResource, AsyncGroupsResource
6466
from .resources.runners.runners import RunnersResource, AsyncRunnersResource
@@ -136,6 +138,12 @@ def agents(self) -> AgentsResource:
136138

137139
return AgentsResource(self)
138140

141+
@cached_property
142+
def automations(self) -> AutomationsResource:
143+
from .resources.automations import AutomationsResource
144+
145+
return AutomationsResource(self)
146+
139147
@cached_property
140148
def editors(self) -> EditorsResource:
141149
from .resources.editors import EditorsResource
@@ -411,6 +419,12 @@ def agents(self) -> AsyncAgentsResource:
411419

412420
return AsyncAgentsResource(self)
413421

422+
@cached_property
423+
def automations(self) -> AsyncAutomationsResource:
424+
from .resources.automations import AsyncAutomationsResource
425+
426+
return AsyncAutomationsResource(self)
427+
414428
@cached_property
415429
def editors(self) -> AsyncEditorsResource:
416430
from .resources.editors import AsyncEditorsResource
@@ -637,6 +651,12 @@ def agents(self) -> agents.AgentsResourceWithRawResponse:
637651

638652
return AgentsResourceWithRawResponse(self._client.agents)
639653

654+
@cached_property
655+
def automations(self) -> automations.AutomationsResourceWithRawResponse:
656+
from .resources.automations import AutomationsResourceWithRawResponse
657+
658+
return AutomationsResourceWithRawResponse(self._client.automations)
659+
640660
@cached_property
641661
def editors(self) -> editors.EditorsResourceWithRawResponse:
642662
from .resources.editors import EditorsResourceWithRawResponse
@@ -751,6 +771,12 @@ def agents(self) -> agents.AsyncAgentsResourceWithRawResponse:
751771

752772
return AsyncAgentsResourceWithRawResponse(self._client.agents)
753773

774+
@cached_property
775+
def automations(self) -> automations.AsyncAutomationsResourceWithRawResponse:
776+
from .resources.automations import AsyncAutomationsResourceWithRawResponse
777+
778+
return AsyncAutomationsResourceWithRawResponse(self._client.automations)
779+
754780
@cached_property
755781
def editors(self) -> editors.AsyncEditorsResourceWithRawResponse:
756782
from .resources.editors import AsyncEditorsResourceWithRawResponse
@@ -865,6 +891,12 @@ def agents(self) -> agents.AgentsResourceWithStreamingResponse:
865891

866892
return AgentsResourceWithStreamingResponse(self._client.agents)
867893

894+
@cached_property
895+
def automations(self) -> automations.AutomationsResourceWithStreamingResponse:
896+
from .resources.automations import AutomationsResourceWithStreamingResponse
897+
898+
return AutomationsResourceWithStreamingResponse(self._client.automations)
899+
868900
@cached_property
869901
def editors(self) -> editors.EditorsResourceWithStreamingResponse:
870902
from .resources.editors import EditorsResourceWithStreamingResponse
@@ -979,6 +1011,12 @@ def agents(self) -> agents.AsyncAgentsResourceWithStreamingResponse:
9791011

9801012
return AsyncAgentsResourceWithStreamingResponse(self._client.agents)
9811013

1014+
@cached_property
1015+
def automations(self) -> automations.AsyncAutomationsResourceWithStreamingResponse:
1016+
from .resources.automations import AsyncAutomationsResourceWithStreamingResponse
1017+
1018+
return AsyncAutomationsResourceWithStreamingResponse(self._client.automations)
1019+
9821020
@cached_property
9831021
def editors(self) -> editors.AsyncEditorsResourceWithStreamingResponse:
9841022
from .resources.editors import AsyncEditorsResourceWithStreamingResponse

src/gitpod/pagination.py

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"MembersPagePagination",
5252
"SyncMembersPage",
5353
"AsyncMembersPage",
54+
"OutputsPagePagination",
55+
"SyncOutputsPage",
56+
"AsyncOutputsPage",
5457
"PersonalAccessTokensPagePagination",
5558
"SyncPersonalAccessTokensPage",
5659
"AsyncPersonalAccessTokensPage",
@@ -102,6 +105,15 @@
102105
"WarmPoolsPagePagination",
103106
"SyncWarmPoolsPage",
104107
"AsyncWarmPoolsPage",
108+
"WorkflowExecutionActionsPagePagination",
109+
"SyncWorkflowExecutionActionsPage",
110+
"AsyncWorkflowExecutionActionsPage",
111+
"WorkflowExecutionsPagePagination",
112+
"SyncWorkflowExecutionsPage",
113+
"AsyncWorkflowExecutionsPage",
114+
"WorkflowsPagePagination",
115+
"SyncWorkflowsPage",
116+
"AsyncWorkflowsPage",
105117
]
106118

107119
_T = TypeVar("_T")
@@ -807,6 +819,56 @@ def next_page_info(self) -> Optional[PageInfo]:
807819
return PageInfo(params={"token": next_token})
808820

809821

822+
class OutputsPagePagination(BaseModel):
823+
next_token: Optional[str] = FieldInfo(alias="nextToken", default=None)
824+
825+
826+
class SyncOutputsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
827+
outputs: List[_T]
828+
pagination: Optional[OutputsPagePagination] = None
829+
830+
@override
831+
def _get_page_items(self) -> List[_T]:
832+
outputs = self.outputs
833+
if not outputs:
834+
return []
835+
return outputs
836+
837+
@override
838+
def next_page_info(self) -> Optional[PageInfo]:
839+
next_token = None
840+
if self.pagination is not None:
841+
if self.pagination.next_token is not None:
842+
next_token = self.pagination.next_token
843+
if not next_token:
844+
return None
845+
846+
return PageInfo(params={"token": next_token})
847+
848+
849+
class AsyncOutputsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
850+
outputs: List[_T]
851+
pagination: Optional[OutputsPagePagination] = None
852+
853+
@override
854+
def _get_page_items(self) -> List[_T]:
855+
outputs = self.outputs
856+
if not outputs:
857+
return []
858+
return outputs
859+
860+
@override
861+
def next_page_info(self) -> Optional[PageInfo]:
862+
next_token = None
863+
if self.pagination is not None:
864+
if self.pagination.next_token is not None:
865+
next_token = self.pagination.next_token
866+
if not next_token:
867+
return None
868+
869+
return PageInfo(params={"token": next_token})
870+
871+
810872
class PersonalAccessTokensPagePagination(BaseModel):
811873
next_token: Optional[str] = FieldInfo(alias="nextToken", default=None)
812874

@@ -1655,3 +1717,153 @@ def next_page_info(self) -> Optional[PageInfo]:
16551717
return None
16561718

16571719
return PageInfo(params={"token": next_token})
1720+
1721+
1722+
class WorkflowExecutionActionsPagePagination(BaseModel):
1723+
next_token: Optional[str] = FieldInfo(alias="nextToken", default=None)
1724+
1725+
1726+
class SyncWorkflowExecutionActionsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
1727+
pagination: Optional[WorkflowExecutionActionsPagePagination] = None
1728+
workflow_execution_actions: List[_T] = FieldInfo(alias="workflowExecutionActions")
1729+
1730+
@override
1731+
def _get_page_items(self) -> List[_T]:
1732+
workflow_execution_actions = self.workflow_execution_actions
1733+
if not workflow_execution_actions:
1734+
return []
1735+
return workflow_execution_actions
1736+
1737+
@override
1738+
def next_page_info(self) -> Optional[PageInfo]:
1739+
next_token = None
1740+
if self.pagination is not None:
1741+
if self.pagination.next_token is not None:
1742+
next_token = self.pagination.next_token
1743+
if not next_token:
1744+
return None
1745+
1746+
return PageInfo(params={"token": next_token})
1747+
1748+
1749+
class AsyncWorkflowExecutionActionsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
1750+
pagination: Optional[WorkflowExecutionActionsPagePagination] = None
1751+
workflow_execution_actions: List[_T] = FieldInfo(alias="workflowExecutionActions")
1752+
1753+
@override
1754+
def _get_page_items(self) -> List[_T]:
1755+
workflow_execution_actions = self.workflow_execution_actions
1756+
if not workflow_execution_actions:
1757+
return []
1758+
return workflow_execution_actions
1759+
1760+
@override
1761+
def next_page_info(self) -> Optional[PageInfo]:
1762+
next_token = None
1763+
if self.pagination is not None:
1764+
if self.pagination.next_token is not None:
1765+
next_token = self.pagination.next_token
1766+
if not next_token:
1767+
return None
1768+
1769+
return PageInfo(params={"token": next_token})
1770+
1771+
1772+
class WorkflowExecutionsPagePagination(BaseModel):
1773+
next_token: Optional[str] = FieldInfo(alias="nextToken", default=None)
1774+
1775+
1776+
class SyncWorkflowExecutionsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
1777+
pagination: Optional[WorkflowExecutionsPagePagination] = None
1778+
workflow_executions: List[_T] = FieldInfo(alias="workflowExecutions")
1779+
1780+
@override
1781+
def _get_page_items(self) -> List[_T]:
1782+
workflow_executions = self.workflow_executions
1783+
if not workflow_executions:
1784+
return []
1785+
return workflow_executions
1786+
1787+
@override
1788+
def next_page_info(self) -> Optional[PageInfo]:
1789+
next_token = None
1790+
if self.pagination is not None:
1791+
if self.pagination.next_token is not None:
1792+
next_token = self.pagination.next_token
1793+
if not next_token:
1794+
return None
1795+
1796+
return PageInfo(params={"token": next_token})
1797+
1798+
1799+
class AsyncWorkflowExecutionsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
1800+
pagination: Optional[WorkflowExecutionsPagePagination] = None
1801+
workflow_executions: List[_T] = FieldInfo(alias="workflowExecutions")
1802+
1803+
@override
1804+
def _get_page_items(self) -> List[_T]:
1805+
workflow_executions = self.workflow_executions
1806+
if not workflow_executions:
1807+
return []
1808+
return workflow_executions
1809+
1810+
@override
1811+
def next_page_info(self) -> Optional[PageInfo]:
1812+
next_token = None
1813+
if self.pagination is not None:
1814+
if self.pagination.next_token is not None:
1815+
next_token = self.pagination.next_token
1816+
if not next_token:
1817+
return None
1818+
1819+
return PageInfo(params={"token": next_token})
1820+
1821+
1822+
class WorkflowsPagePagination(BaseModel):
1823+
next_token: Optional[str] = FieldInfo(alias="nextToken", default=None)
1824+
1825+
1826+
class SyncWorkflowsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
1827+
pagination: Optional[WorkflowsPagePagination] = None
1828+
workflows: List[_T]
1829+
1830+
@override
1831+
def _get_page_items(self) -> List[_T]:
1832+
workflows = self.workflows
1833+
if not workflows:
1834+
return []
1835+
return workflows
1836+
1837+
@override
1838+
def next_page_info(self) -> Optional[PageInfo]:
1839+
next_token = None
1840+
if self.pagination is not None:
1841+
if self.pagination.next_token is not None:
1842+
next_token = self.pagination.next_token
1843+
if not next_token:
1844+
return None
1845+
1846+
return PageInfo(params={"token": next_token})
1847+
1848+
1849+
class AsyncWorkflowsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
1850+
pagination: Optional[WorkflowsPagePagination] = None
1851+
workflows: List[_T]
1852+
1853+
@override
1854+
def _get_page_items(self) -> List[_T]:
1855+
workflows = self.workflows
1856+
if not workflows:
1857+
return []
1858+
return workflows
1859+
1860+
@override
1861+
def next_page_info(self) -> Optional[PageInfo]:
1862+
next_token = None
1863+
if self.pagination is not None:
1864+
if self.pagination.next_token is not None:
1865+
next_token = self.pagination.next_token
1866+
if not next_token:
1867+
return None
1868+
1869+
return PageInfo(params={"token": next_token})

0 commit comments

Comments
 (0)