22
33from __future__ import annotations
44
5+ from typing_extensions import Literal
6+
7+ import httpx
8+
59from .invoke import (
610 InvokeResource ,
711 AsyncInvokeResource ,
1014 InvokeResourceWithStreamingResponse ,
1115 AsyncInvokeResourceWithStreamingResponse ,
1216)
17+ from ...types import automation_list_params
18+ from ..._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
19+ from ..._utils import maybe_transform , async_maybe_transform
1320from ..._compat import cached_property
1421from ..._resource import SyncAPIResource , AsyncAPIResource
22+ from ..._response import (
23+ to_raw_response_wrapper ,
24+ to_streamed_response_wrapper ,
25+ async_to_raw_response_wrapper ,
26+ async_to_streamed_response_wrapper ,
27+ )
28+ from ..._base_client import make_request_options
29+ from ...types .automation_template_list_response import AutomationTemplateListResponse
1530
1631__all__ = ["AutomationsResource" , "AsyncAutomationsResource" ]
1732
@@ -40,6 +55,55 @@ def with_streaming_response(self) -> AutomationsResourceWithStreamingResponse:
4055 """
4156 return AutomationsResourceWithStreamingResponse (self )
4257
58+ def list (
59+ self ,
60+ * ,
61+ cursor : str | Omit = omit ,
62+ version : Literal ["published" , "draft" ] | Omit = omit ,
63+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
64+ # The extra values given here take precedence over values defined on the client or passed to this method.
65+ extra_headers : Headers | None = None ,
66+ extra_query : Query | None = None ,
67+ extra_body : Body | None = None ,
68+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
69+ ) -> AutomationTemplateListResponse :
70+ """Get the list of automations.
71+
72+ Args:
73+ cursor: A cursor token for pagination.
74+
75+ Use the cursor from the previous response to
76+ fetch the next page of results.
77+
78+ version: The version of templates to retrieve. Accepted values are published (for
79+ published templates) or draft (for draft templates). Defaults to published.
80+
81+ extra_headers: Send extra headers
82+
83+ extra_query: Add additional query parameters to the request
84+
85+ extra_body: Add additional JSON properties to the request
86+
87+ timeout: Override the client-level default timeout for this request, in seconds
88+ """
89+ return self ._get (
90+ "/automations" ,
91+ options = make_request_options (
92+ extra_headers = extra_headers ,
93+ extra_query = extra_query ,
94+ extra_body = extra_body ,
95+ timeout = timeout ,
96+ query = maybe_transform (
97+ {
98+ "cursor" : cursor ,
99+ "version" : version ,
100+ },
101+ automation_list_params .AutomationListParams ,
102+ ),
103+ ),
104+ cast_to = AutomationTemplateListResponse ,
105+ )
106+
43107
44108class AsyncAutomationsResource (AsyncAPIResource ):
45109 @cached_property
@@ -65,11 +129,64 @@ def with_streaming_response(self) -> AsyncAutomationsResourceWithStreamingRespon
65129 """
66130 return AsyncAutomationsResourceWithStreamingResponse (self )
67131
132+ async def list (
133+ self ,
134+ * ,
135+ cursor : str | Omit = omit ,
136+ version : Literal ["published" , "draft" ] | Omit = omit ,
137+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
138+ # The extra values given here take precedence over values defined on the client or passed to this method.
139+ extra_headers : Headers | None = None ,
140+ extra_query : Query | None = None ,
141+ extra_body : Body | None = None ,
142+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
143+ ) -> AutomationTemplateListResponse :
144+ """Get the list of automations.
145+
146+ Args:
147+ cursor: A cursor token for pagination.
148+
149+ Use the cursor from the previous response to
150+ fetch the next page of results.
151+
152+ version: The version of templates to retrieve. Accepted values are published (for
153+ published templates) or draft (for draft templates). Defaults to published.
154+
155+ extra_headers: Send extra headers
156+
157+ extra_query: Add additional query parameters to the request
158+
159+ extra_body: Add additional JSON properties to the request
160+
161+ timeout: Override the client-level default timeout for this request, in seconds
162+ """
163+ return await self ._get (
164+ "/automations" ,
165+ options = make_request_options (
166+ extra_headers = extra_headers ,
167+ extra_query = extra_query ,
168+ extra_body = extra_body ,
169+ timeout = timeout ,
170+ query = await async_maybe_transform (
171+ {
172+ "cursor" : cursor ,
173+ "version" : version ,
174+ },
175+ automation_list_params .AutomationListParams ,
176+ ),
177+ ),
178+ cast_to = AutomationTemplateListResponse ,
179+ )
180+
68181
69182class AutomationsResourceWithRawResponse :
70183 def __init__ (self , automations : AutomationsResource ) -> None :
71184 self ._automations = automations
72185
186+ self .list = to_raw_response_wrapper (
187+ automations .list ,
188+ )
189+
73190 @cached_property
74191 def invoke (self ) -> InvokeResourceWithRawResponse :
75192 return InvokeResourceWithRawResponse (self ._automations .invoke )
@@ -79,6 +196,10 @@ class AsyncAutomationsResourceWithRawResponse:
79196 def __init__ (self , automations : AsyncAutomationsResource ) -> None :
80197 self ._automations = automations
81198
199+ self .list = async_to_raw_response_wrapper (
200+ automations .list ,
201+ )
202+
82203 @cached_property
83204 def invoke (self ) -> AsyncInvokeResourceWithRawResponse :
84205 return AsyncInvokeResourceWithRawResponse (self ._automations .invoke )
@@ -88,6 +209,10 @@ class AutomationsResourceWithStreamingResponse:
88209 def __init__ (self , automations : AutomationsResource ) -> None :
89210 self ._automations = automations
90211
212+ self .list = to_streamed_response_wrapper (
213+ automations .list ,
214+ )
215+
91216 @cached_property
92217 def invoke (self ) -> InvokeResourceWithStreamingResponse :
93218 return InvokeResourceWithStreamingResponse (self ._automations .invoke )
@@ -97,6 +222,10 @@ class AsyncAutomationsResourceWithStreamingResponse:
97222 def __init__ (self , automations : AsyncAutomationsResource ) -> None :
98223 self ._automations = automations
99224
225+ self .list = async_to_streamed_response_wrapper (
226+ automations .list ,
227+ )
228+
100229 @cached_property
101230 def invoke (self ) -> AsyncInvokeResourceWithStreamingResponse :
102231 return AsyncInvokeResourceWithStreamingResponse (self ._automations .invoke )
0 commit comments