Skip to content

Commit 616466d

Browse files
feat(api): manual updates
1 parent 2bbd706 commit 616466d

File tree

13 files changed

+184
-49
lines changed

13 files changed

+184
-49
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 14
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/miru-ml%2Fmiru-server-7d0dd143c8ea9bc230d9810d8cfb3fde8b1d4eb48295ebf2db7ea67916fb96c3.yml
3-
openapi_spec_hash: b6667a2e80a356a67bab83f8d5f6e51a
4-
config_hash: 78c50efd3bbfb4969846973cb0609eff
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/miru-ml%2Fmiru-server-1187ba20c7bd5d91919c6e65f71201c9997541aae5ea6b3068b2e8094b4b8d0c.yml
3+
openapi_spec_hash: fd892348c3cd6e7ec5bdce4d8134bf14
4+
config_hash: 1e4fdf81e8b8def15eae344d1f29e513

api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,11 @@ Methods:
6767

6868
- <code title="get /releases/{release_id}">client.releases.<a href="./src/miru_server_sdk/resources/releases.py">retrieve</a>(release_id, \*\*<a href="src/miru_server_sdk/types/release_retrieve_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/release.py">Release</a></code>
6969
- <code title="get /releases">client.releases.<a href="./src/miru_server_sdk/resources/releases.py">list</a>(\*\*<a href="src/miru_server_sdk/types/release_list_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/release_list_response.py">ReleaseListResponse</a></code>
70+
71+
# Webhooks
72+
73+
Types:
74+
75+
```python
76+
from miru_server_sdk.types import DeploymentValidateWebhookEvent, UnwrapWebhookEvent
77+
```

src/miru_server_sdk/_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222
from ._utils import is_given, get_async_library
2323
from ._version import __version__
24-
from .resources import devices, releases, deployments, config_instances
24+
from .resources import devices, releases, webhooks, deployments, config_instances
2525
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2626
from ._exceptions import MiruError, APIStatusError
2727
from ._base_client import (
@@ -38,6 +38,7 @@ class Miru(SyncAPIClient):
3838
deployments: deployments.DeploymentsResource
3939
devices: devices.DevicesResource
4040
releases: releases.ReleasesResource
41+
webhooks: webhooks.WebhooksResource
4142
with_raw_response: MiruWithRawResponse
4243
with_streaming_response: MiruWithStreamedResponse
4344

@@ -114,6 +115,7 @@ def __init__(
114115
self.deployments = deployments.DeploymentsResource(self)
115116
self.devices = devices.DevicesResource(self)
116117
self.releases = releases.ReleasesResource(self)
118+
self.webhooks = webhooks.WebhooksResource(self)
117119
self.with_raw_response = MiruWithRawResponse(self)
118120
self.with_streaming_response = MiruWithStreamedResponse(self)
119121

@@ -231,6 +233,7 @@ class AsyncMiru(AsyncAPIClient):
231233
deployments: deployments.AsyncDeploymentsResource
232234
devices: devices.AsyncDevicesResource
233235
releases: releases.AsyncReleasesResource
236+
webhooks: webhooks.AsyncWebhooksResource
234237
with_raw_response: AsyncMiruWithRawResponse
235238
with_streaming_response: AsyncMiruWithStreamedResponse
236239

@@ -307,6 +310,7 @@ def __init__(
307310
self.deployments = deployments.AsyncDeploymentsResource(self)
308311
self.devices = devices.AsyncDevicesResource(self)
309312
self.releases = releases.AsyncReleasesResource(self)
313+
self.webhooks = webhooks.AsyncWebhooksResource(self)
310314
self.with_raw_response = AsyncMiruWithRawResponse(self)
311315
self.with_streaming_response = AsyncMiruWithStreamedResponse(self)
312316

src/miru_server_sdk/resources/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ReleasesResourceWithStreamingResponse,
1717
AsyncReleasesResourceWithStreamingResponse,
1818
)
19+
from .webhooks import WebhooksResource, AsyncWebhooksResource
1920
from .deployments import (
2021
DeploymentsResource,
2122
AsyncDeploymentsResource,
@@ -58,4 +59,6 @@
5859
"AsyncReleasesResourceWithRawResponse",
5960
"ReleasesResourceWithStreamingResponse",
6061
"AsyncReleasesResourceWithStreamingResponse",
62+
"WebhooksResource",
63+
"AsyncWebhooksResource",
6164
]

src/miru_server_sdk/resources/deployments.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ def create(
7979
new_config_instances: The _new_ config instances to create for this deployment. A deployment must have
8080
exactly one config instance for each config schema in the deployment's release.
8181
If less config instances are provided than the number of schemas, the deployment
82-
will 'transfer' config instances its patch source. Archived config instances (in
83-
patch sources) cannot be transferred, they must be created anew.
82+
will 'transfer' config instances from the deployment it is patched from.
83+
Archived config instances cannot be transferred.
8484
85-
release_id: The ID of the release which this deployment adheres to.
85+
release_id: The release ID which this deployment adheres to.
8686
8787
target_status: Desired state of the deployment.
8888
@@ -94,15 +94,11 @@ def create(
9494
release is the device's current release.
9595
9696
If custom validation is enabled for the release, the deployment must pass
97-
validation before fulfilling the target status. Otherwise, the deployment fails
98-
and current deployments are unaffected.
97+
validation before fulfilling the target status.
9998
10099
expand: The fields to expand in the deployment.
101100
102-
patch_source_id: The ID of the deployment that this deployment was (optionally) patched from. If
103-
no patch source is provided, the deployment is considered to be 'new'-- it is
104-
not a delta from an existing deployment. If a patch source is provided, the
105-
deployment is considered to be a delta of changes from the patch source.
101+
patch_source_id: The ID of the deployment that this deployment was patched from.
106102
107103
extra_headers: Send extra headers
108104
@@ -275,8 +271,7 @@ def validate(
275271
config_instances: The config instance errors for this deployment.
276272
277273
is_valid: Whether the deployment is valid. If invalid, the deployment is immediately
278-
archived and marked as 'failed'. If valid, the deployment continues to its
279-
desired target status (i.e. 'pending', 'approved', or 'deployed').
274+
archived and marked as 'failed'.
280275
281276
message: A message displayed on the deployment level in the UI.
282277
@@ -355,10 +350,10 @@ async def create(
355350
new_config_instances: The _new_ config instances to create for this deployment. A deployment must have
356351
exactly one config instance for each config schema in the deployment's release.
357352
If less config instances are provided than the number of schemas, the deployment
358-
will 'transfer' config instances its patch source. Archived config instances (in
359-
patch sources) cannot be transferred, they must be created anew.
353+
will 'transfer' config instances from the deployment it is patched from.
354+
Archived config instances cannot be transferred.
360355
361-
release_id: The ID of the release which this deployment adheres to.
356+
release_id: The release ID which this deployment adheres to.
362357
363358
target_status: Desired state of the deployment.
364359
@@ -370,15 +365,11 @@ async def create(
370365
release is the device's current release.
371366
372367
If custom validation is enabled for the release, the deployment must pass
373-
validation before fulfilling the target status. Otherwise, the deployment fails
374-
and current deployments are unaffected.
368+
validation before fulfilling the target status.
375369
376370
expand: The fields to expand in the deployment.
377371
378-
patch_source_id: The ID of the deployment that this deployment was (optionally) patched from. If
379-
no patch source is provided, the deployment is considered to be 'new'-- it is
380-
not a delta from an existing deployment. If a patch source is provided, the
381-
deployment is considered to be a delta of changes from the patch source.
372+
patch_source_id: The ID of the deployment that this deployment was patched from.
382373
383374
extra_headers: Send extra headers
384375
@@ -553,8 +544,7 @@ async def validate(
553544
config_instances: The config instance errors for this deployment.
554545
555546
is_valid: Whether the deployment is valid. If invalid, the deployment is immediately
556-
archived and marked as 'failed'. If valid, the deployment continues to its
557-
desired target status (i.e. 'pending', 'approved', or 'deployed').
547+
archived and marked as 'failed'.
558548
559549
message: A message displayed on the deployment level in the UI.
560550
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import json
6+
from typing import cast
7+
8+
from .._models import construct_type
9+
from .._resource import SyncAPIResource, AsyncAPIResource
10+
from ..types.unwrap_webhook_event import UnwrapWebhookEvent
11+
12+
__all__ = ["WebhooksResource", "AsyncWebhooksResource"]
13+
14+
15+
class WebhooksResource(SyncAPIResource):
16+
def unwrap(self, payload: str) -> UnwrapWebhookEvent:
17+
return cast(
18+
UnwrapWebhookEvent,
19+
construct_type(
20+
type_=UnwrapWebhookEvent,
21+
value=json.loads(payload),
22+
),
23+
)
24+
25+
26+
class AsyncWebhooksResource(AsyncAPIResource):
27+
def unwrap(self, payload: str) -> UnwrapWebhookEvent:
28+
return cast(
29+
UnwrapWebhookEvent,
30+
construct_type(
31+
type_=UnwrapWebhookEvent,
32+
value=json.loads(payload),
33+
),
34+
)

src/miru_server_sdk/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .device_create_params import DeviceCreateParams as DeviceCreateParams
1818
from .device_list_response import DeviceListResponse as DeviceListResponse
1919
from .device_update_params import DeviceUpdateParams as DeviceUpdateParams
20+
from .unwrap_webhook_event import UnwrapWebhookEvent as UnwrapWebhookEvent
2021
from .release_list_response import ReleaseListResponse as ReleaseListResponse
2122
from .deployment_list_params import DeploymentListParams as DeploymentListParams
2223
from .device_delete_response import DeviceDeleteResponse as DeviceDeleteResponse
@@ -29,6 +30,7 @@
2930
from .deployment_validate_response import DeploymentValidateResponse as DeploymentValidateResponse
3031
from .config_instance_list_response import ConfigInstanceListResponse as ConfigInstanceListResponse
3132
from .config_instance_retrieve_params import ConfigInstanceRetrieveParams as ConfigInstanceRetrieveParams
33+
from .deployment_validate_webhook_event import DeploymentValidateWebhookEvent as DeploymentValidateWebhookEvent
3234
from .device_create_activation_token_params import (
3335
DeviceCreateActivationTokenParams as DeviceCreateActivationTokenParams,
3436
)

src/miru_server_sdk/types/deployment_create_params.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ class DeploymentCreateParams(TypedDict, total=False):
2020
2121
A deployment must have exactly one config instance for each config schema in the
2222
deployment's release. If less config instances are provided than the number of
23-
schemas, the deployment will 'transfer' config instances its patch source.
24-
Archived config instances (in patch sources) cannot be transferred, they must be
25-
created anew.
23+
schemas, the deployment will 'transfer' config instances from the deployment it
24+
is patched from. Archived config instances cannot be transferred.
2625
"""
2726

2827
release_id: Required[str]
29-
"""The ID of the release which this deployment adheres to."""
28+
"""The release ID which this deployment adheres to."""
3029

3130
target_status: Required[Literal["pending", "approved", "deployed"]]
3231
"""Desired state of the deployment.
@@ -39,20 +38,14 @@ class DeploymentCreateParams(TypedDict, total=False):
3938
release is the device's current release.
4039
4140
If custom validation is enabled for the release, the deployment must pass
42-
validation before fulfilling the target status. Otherwise, the deployment fails
43-
and current deployments are unaffected.
41+
validation before fulfilling the target status.
4442
"""
4543

4644
expand: List[Literal["device", "release", "config_instances"]]
4745
"""The fields to expand in the deployment."""
4846

4947
patch_source_id: str
50-
"""The ID of the deployment that this deployment was (optionally) patched from.
51-
52-
If no patch source is provided, the deployment is considered to be 'new'-- it is
53-
not a delta from an existing deployment. If a patch source is provided, the
54-
deployment is considered to be a delta of changes from the patch source.
55-
"""
48+
"""The ID of the deployment that this deployment was patched from."""
5649

5750

5851
class NewConfigInstance(TypedDict, total=False):

src/miru_server_sdk/types/deployment_validate_params.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ class DeploymentValidateParams(TypedDict, total=False):
1717
is_valid: Required[bool]
1818
"""Whether the deployment is valid.
1919
20-
If invalid, the deployment is immediately archived and marked as 'failed'. If
21-
valid, the deployment continues to its desired target status (i.e. 'pending',
22-
'approved', or 'deployed').
20+
If invalid, the deployment is immediately archived and marked as 'failed'.
2321
"""
2422

2523
message: Required[str]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from datetime import datetime
4+
from typing_extensions import Literal
5+
6+
from .._models import BaseModel
7+
8+
__all__ = ["DeploymentValidateWebhookEvent", "Data", "DataDeployment"]
9+
10+
11+
class DataDeployment(BaseModel):
12+
id: str
13+
"""ID of the deployment"""
14+
15+
created_at: datetime
16+
"""Timestamp of when the device release was created"""
17+
18+
device_id: str
19+
"""ID of the device"""
20+
21+
object: Literal["deployment"]
22+
23+
release_id: str
24+
"""The version of the release"""
25+
26+
27+
class Data(BaseModel):
28+
deployment: DataDeployment
29+
30+
31+
class DeploymentValidateWebhookEvent(BaseModel):
32+
data: Data
33+
"""The data associated with the event"""
34+
35+
object: Literal["event"]
36+
"""The object that occurred"""
37+
38+
timestamp: datetime
39+
"""The timestamp of the event"""
40+
41+
type: Literal["deployment.validate"]
42+
"""The type of event"""

0 commit comments

Comments
 (0)