Skip to content

Commit eda6c2c

Browse files
feat(api): update via SDK Studio
1 parent 1c70e54 commit eda6c2c

File tree

8 files changed

+320
-8
lines changed

8 files changed

+320
-8
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-3edc7a0eef4a0d4495782efbdb0d9b777a55aee058dab119f90de56019441326.yml
3-
openapi_spec_hash: dff0b1efa1c1614cf770ed8327cefab2
4-
config_hash: cb04a4d88ee9f530b303ca57ff7090b3
1+
configured_endpoints: 11
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml
3+
openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6
4+
config_hash: b3fcacd707da56b21d31ce0baf4fb87d

api.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,18 @@ Methods:
2828
Types:
2929

3030
```python
31-
from kernel.types.apps import InvocationCreateResponse, InvocationRetrieveResponse
31+
from kernel.types.apps import (
32+
InvocationCreateResponse,
33+
InvocationRetrieveResponse,
34+
InvocationUpdateResponse,
35+
)
3236
```
3337

3438
Methods:
3539

3640
- <code title="post /invocations">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">create</a>(\*\*<a href="src/kernel/types/apps/invocation_create_params.py">params</a>) -> <a href="./src/kernel/types/apps/invocation_create_response.py">InvocationCreateResponse</a></code>
3741
- <code title="get /invocations/{id}">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">retrieve</a>(id) -> <a href="./src/kernel/types/apps/invocation_retrieve_response.py">InvocationRetrieveResponse</a></code>
42+
- <code title="patch /invocations/{id}">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">update</a>(id, \*\*<a href="src/kernel/types/apps/invocation_update_params.py">params</a>) -> <a href="./src/kernel/types/apps/invocation_update_response.py">InvocationUpdateResponse</a></code>
3843

3944
# Browsers
4045

src/kernel/resources/apps/invocations.py

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from typing_extensions import Literal
6+
57
import httpx
68

79
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
@@ -14,9 +16,10 @@
1416
async_to_raw_response_wrapper,
1517
async_to_streamed_response_wrapper,
1618
)
17-
from ...types.apps import invocation_create_params
19+
from ...types.apps import invocation_create_params, invocation_update_params
1820
from ..._base_client import make_request_options
1921
from ...types.apps.invocation_create_response import InvocationCreateResponse
22+
from ...types.apps.invocation_update_response import InvocationUpdateResponse
2023
from ...types.apps.invocation_retrieve_response import InvocationRetrieveResponse
2124

2225
__all__ = ["InvocationsResource", "AsyncInvocationsResource"]
@@ -48,6 +51,7 @@ def create(
4851
action_name: str,
4952
app_name: str,
5053
version: str,
54+
async_: bool | NotGiven = NOT_GIVEN,
5155
payload: str | NotGiven = NOT_GIVEN,
5256
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5357
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -66,6 +70,9 @@ def create(
6670
6771
version: Version of the application
6872
73+
async_: If true, invoke asynchronously. When set, the API responds 202 Accepted with
74+
status "queued".
75+
6976
payload: Input data for the action, sent as a JSON string.
7077
7178
extra_headers: Send extra headers
@@ -83,6 +90,7 @@ def create(
8390
"action_name": action_name,
8491
"app_name": app_name,
8592
"version": version,
93+
"async_": async_,
8694
"payload": payload,
8795
},
8896
invocation_create_params.InvocationCreateParams,
@@ -126,6 +134,52 @@ def retrieve(
126134
cast_to=InvocationRetrieveResponse,
127135
)
128136

137+
def update(
138+
self,
139+
id: str,
140+
*,
141+
status: Literal["succeeded", "failed"],
142+
output: str | NotGiven = NOT_GIVEN,
143+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
144+
# The extra values given here take precedence over values defined on the client or passed to this method.
145+
extra_headers: Headers | None = None,
146+
extra_query: Query | None = None,
147+
extra_body: Body | None = None,
148+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
149+
) -> InvocationUpdateResponse:
150+
"""
151+
Update invocation status or output
152+
153+
Args:
154+
status: New status for the invocation.
155+
156+
output: Updated output of the invocation rendered as JSON string.
157+
158+
extra_headers: Send extra headers
159+
160+
extra_query: Add additional query parameters to the request
161+
162+
extra_body: Add additional JSON properties to the request
163+
164+
timeout: Override the client-level default timeout for this request, in seconds
165+
"""
166+
if not id:
167+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
168+
return self._patch(
169+
f"/invocations/{id}",
170+
body=maybe_transform(
171+
{
172+
"status": status,
173+
"output": output,
174+
},
175+
invocation_update_params.InvocationUpdateParams,
176+
),
177+
options=make_request_options(
178+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
179+
),
180+
cast_to=InvocationUpdateResponse,
181+
)
182+
129183

130184
class AsyncInvocationsResource(AsyncAPIResource):
131185
@cached_property
@@ -153,6 +207,7 @@ async def create(
153207
action_name: str,
154208
app_name: str,
155209
version: str,
210+
async_: bool | NotGiven = NOT_GIVEN,
156211
payload: str | NotGiven = NOT_GIVEN,
157212
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
158213
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -171,6 +226,9 @@ async def create(
171226
172227
version: Version of the application
173228
229+
async_: If true, invoke asynchronously. When set, the API responds 202 Accepted with
230+
status "queued".
231+
174232
payload: Input data for the action, sent as a JSON string.
175233
176234
extra_headers: Send extra headers
@@ -188,6 +246,7 @@ async def create(
188246
"action_name": action_name,
189247
"app_name": app_name,
190248
"version": version,
249+
"async_": async_,
191250
"payload": payload,
192251
},
193252
invocation_create_params.InvocationCreateParams,
@@ -231,6 +290,52 @@ async def retrieve(
231290
cast_to=InvocationRetrieveResponse,
232291
)
233292

293+
async def update(
294+
self,
295+
id: str,
296+
*,
297+
status: Literal["succeeded", "failed"],
298+
output: str | NotGiven = NOT_GIVEN,
299+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
300+
# The extra values given here take precedence over values defined on the client or passed to this method.
301+
extra_headers: Headers | None = None,
302+
extra_query: Query | None = None,
303+
extra_body: Body | None = None,
304+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
305+
) -> InvocationUpdateResponse:
306+
"""
307+
Update invocation status or output
308+
309+
Args:
310+
status: New status for the invocation.
311+
312+
output: Updated output of the invocation rendered as JSON string.
313+
314+
extra_headers: Send extra headers
315+
316+
extra_query: Add additional query parameters to the request
317+
318+
extra_body: Add additional JSON properties to the request
319+
320+
timeout: Override the client-level default timeout for this request, in seconds
321+
"""
322+
if not id:
323+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
324+
return await self._patch(
325+
f"/invocations/{id}",
326+
body=await async_maybe_transform(
327+
{
328+
"status": status,
329+
"output": output,
330+
},
331+
invocation_update_params.InvocationUpdateParams,
332+
),
333+
options=make_request_options(
334+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
335+
),
336+
cast_to=InvocationUpdateResponse,
337+
)
338+
234339

235340
class InvocationsResourceWithRawResponse:
236341
def __init__(self, invocations: InvocationsResource) -> None:
@@ -242,6 +347,9 @@ def __init__(self, invocations: InvocationsResource) -> None:
242347
self.retrieve = to_raw_response_wrapper(
243348
invocations.retrieve,
244349
)
350+
self.update = to_raw_response_wrapper(
351+
invocations.update,
352+
)
245353

246354

247355
class AsyncInvocationsResourceWithRawResponse:
@@ -254,6 +362,9 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None:
254362
self.retrieve = async_to_raw_response_wrapper(
255363
invocations.retrieve,
256364
)
365+
self.update = async_to_raw_response_wrapper(
366+
invocations.update,
367+
)
257368

258369

259370
class InvocationsResourceWithStreamingResponse:
@@ -266,6 +377,9 @@ def __init__(self, invocations: InvocationsResource) -> None:
266377
self.retrieve = to_streamed_response_wrapper(
267378
invocations.retrieve,
268379
)
380+
self.update = to_streamed_response_wrapper(
381+
invocations.update,
382+
)
269383

270384

271385
class AsyncInvocationsResourceWithStreamingResponse:
@@ -278,3 +392,6 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None:
278392
self.retrieve = async_to_streamed_response_wrapper(
279393
invocations.retrieve,
280394
)
395+
self.update = async_to_streamed_response_wrapper(
396+
invocations.update,
397+
)

src/kernel/types/apps/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams
66
from .invocation_create_params import InvocationCreateParams as InvocationCreateParams
7+
from .invocation_update_params import InvocationUpdateParams as InvocationUpdateParams
78
from .deployment_create_response import DeploymentCreateResponse as DeploymentCreateResponse
89
from .deployment_follow_response import DeploymentFollowResponse as DeploymentFollowResponse
910
from .invocation_create_response import InvocationCreateResponse as InvocationCreateResponse
11+
from .invocation_update_response import InvocationUpdateResponse as InvocationUpdateResponse
1012
from .invocation_retrieve_response import InvocationRetrieveResponse as InvocationRetrieveResponse

src/kernel/types/apps/invocation_create_params.py

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

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Required, Annotated, TypedDict
6+
7+
from ..._utils import PropertyInfo
68

79
__all__ = ["InvocationCreateParams"]
810

@@ -17,5 +19,11 @@ class InvocationCreateParams(TypedDict, total=False):
1719
version: Required[str]
1820
"""Version of the application"""
1921

22+
async_: Annotated[bool, PropertyInfo(alias="async")]
23+
"""If true, invoke asynchronously.
24+
25+
When set, the API responds 202 Accepted with status "queued".
26+
"""
27+
2028
payload: str
2129
"""Input data for the action, sent as a JSON string."""
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 Literal, Required, TypedDict
6+
7+
__all__ = ["InvocationUpdateParams"]
8+
9+
10+
class InvocationUpdateParams(TypedDict, total=False):
11+
status: Required[Literal["succeeded", "failed"]]
12+
"""New status for the invocation."""
13+
14+
output: str
15+
"""Updated output of the invocation rendered as JSON string."""
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from datetime import datetime
5+
from typing_extensions import Literal
6+
7+
from ..._models import BaseModel
8+
9+
__all__ = ["InvocationUpdateResponse"]
10+
11+
12+
class InvocationUpdateResponse(BaseModel):
13+
id: str
14+
"""ID of the invocation"""
15+
16+
action_name: str
17+
"""Name of the action invoked"""
18+
19+
app_name: str
20+
"""Name of the application"""
21+
22+
started_at: datetime
23+
"""RFC 3339 Nanoseconds timestamp when the invocation started"""
24+
25+
status: Literal["queued", "running", "succeeded", "failed"]
26+
"""Status of the invocation"""
27+
28+
finished_at: Optional[datetime] = None
29+
"""
30+
RFC 3339 Nanoseconds timestamp when the invocation finished (null if still
31+
running)
32+
"""
33+
34+
output: Optional[str] = None
35+
"""Output produced by the action, rendered as a JSON string.
36+
37+
This could be: string, number, boolean, array, object, or null.
38+
"""
39+
40+
payload: Optional[str] = None
41+
"""Payload provided to the invocation.
42+
43+
This is a string that can be parsed as JSON.
44+
"""
45+
46+
status_reason: Optional[str] = None
47+
"""Status reason"""

0 commit comments

Comments
 (0)