Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 11
configured_endpoints: 12
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,25 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ

Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.

## Nested params

Nested parameters are dictionaries, typed using `TypedDict`, for example:

```python
from miru_device_sdk import Miru

client = Miru()

calibration = client.calibrations.create(
component_slug="arm",
content={
"data": '{\n "enable_autonomy": true,\n "enable_remote_control": true,\n "max_payload_kg": 10.0\n}\n',
"format": "json",
},
)
print(calibration.content)
```

## Handling errors

When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `miru_device_sdk.APIConnectionError` is raised.
Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ Methods:
- <code title="get /health">client.agent.<a href="./src/miru_device_sdk/resources/agent.py">health</a>() -> <a href="./src/miru_device_sdk/types/agent_health_response.py">AgentHealthResponse</a></code>
- <code title="get /version">client.agent.<a href="./src/miru_device_sdk/resources/agent.py">version</a>() -> <a href="./src/miru_device_sdk/types/agent_version_response.py">AgentVersionResponse</a></code>

# Calibrations

Types:

```python
from miru_device_sdk.types import CalibrationCreateResponse
```

Methods:

- <code title="post /calibrations">client.calibrations.<a href="./src/miru_device_sdk/resources/calibrations.py">create</a>(\*\*<a href="src/miru_device_sdk/types/calibration_create_params.py">params</a>) -> <a href="./src/miru_device_sdk/types/calibration_create_response.py">CalibrationCreateResponse</a></code>

# Deployments

Types:
Expand Down
39 changes: 38 additions & 1 deletion src/miru_device_sdk/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@
)

if TYPE_CHECKING:
from .resources import agent, device, events, releases, file_rules, deployments, git_commits
from .resources import agent, device, events, releases, file_rules, deployments, git_commits, calibrations
from .resources.agent import AgentResource, AsyncAgentResource
from .resources.device import DeviceResource, AsyncDeviceResource
from .resources.events import EventsResource, AsyncEventsResource
from .resources.releases import ReleasesResource, AsyncReleasesResource
from .resources.file_rules import FileRulesResource, AsyncFileRulesResource
from .resources.deployments import DeploymentsResource, AsyncDeploymentsResource
from .resources.git_commits import GitCommitsResource, AsyncGitCommitsResource
from .resources.calibrations import CalibrationsResource, AsyncCalibrationsResource

__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Miru", "AsyncMiru", "Client", "AsyncClient"]

Expand Down Expand Up @@ -205,6 +206,12 @@ def agent(self) -> AgentResource:

return AgentResource(self)

@cached_property
def calibrations(self) -> CalibrationsResource:
from .resources.calibrations import CalibrationsResource

return CalibrationsResource(self)

@cached_property
def deployments(self) -> DeploymentsResource:
from .resources.deployments import DeploymentsResource
Expand Down Expand Up @@ -477,6 +484,12 @@ def agent(self) -> AsyncAgentResource:

return AsyncAgentResource(self)

@cached_property
def calibrations(self) -> AsyncCalibrationsResource:
from .resources.calibrations import AsyncCalibrationsResource

return AsyncCalibrationsResource(self)

@cached_property
def deployments(self) -> AsyncDeploymentsResource:
from .resources.deployments import AsyncDeploymentsResource
Expand Down Expand Up @@ -662,6 +675,12 @@ def agent(self) -> agent.AgentResourceWithRawResponse:

return AgentResourceWithRawResponse(self._client.agent)

@cached_property
def calibrations(self) -> calibrations.CalibrationsResourceWithRawResponse:
from .resources.calibrations import CalibrationsResourceWithRawResponse

return CalibrationsResourceWithRawResponse(self._client.calibrations)

@cached_property
def deployments(self) -> deployments.DeploymentsResourceWithRawResponse:
from .resources.deployments import DeploymentsResourceWithRawResponse
Expand Down Expand Up @@ -711,6 +730,12 @@ def agent(self) -> agent.AsyncAgentResourceWithRawResponse:

return AsyncAgentResourceWithRawResponse(self._client.agent)

@cached_property
def calibrations(self) -> calibrations.AsyncCalibrationsResourceWithRawResponse:
from .resources.calibrations import AsyncCalibrationsResourceWithRawResponse

return AsyncCalibrationsResourceWithRawResponse(self._client.calibrations)

@cached_property
def deployments(self) -> deployments.AsyncDeploymentsResourceWithRawResponse:
from .resources.deployments import AsyncDeploymentsResourceWithRawResponse
Expand Down Expand Up @@ -760,6 +785,12 @@ def agent(self) -> agent.AgentResourceWithStreamingResponse:

return AgentResourceWithStreamingResponse(self._client.agent)

@cached_property
def calibrations(self) -> calibrations.CalibrationsResourceWithStreamingResponse:
from .resources.calibrations import CalibrationsResourceWithStreamingResponse

return CalibrationsResourceWithStreamingResponse(self._client.calibrations)

@cached_property
def deployments(self) -> deployments.DeploymentsResourceWithStreamingResponse:
from .resources.deployments import DeploymentsResourceWithStreamingResponse
Expand Down Expand Up @@ -809,6 +840,12 @@ def agent(self) -> agent.AsyncAgentResourceWithStreamingResponse:

return AsyncAgentResourceWithStreamingResponse(self._client.agent)

@cached_property
def calibrations(self) -> calibrations.AsyncCalibrationsResourceWithStreamingResponse:
from .resources.calibrations import AsyncCalibrationsResourceWithStreamingResponse

return AsyncCalibrationsResourceWithStreamingResponse(self._client.calibrations)

@cached_property
def deployments(self) -> deployments.AsyncDeploymentsResourceWithStreamingResponse:
from .resources.deployments import AsyncDeploymentsResourceWithStreamingResponse
Expand Down
14 changes: 14 additions & 0 deletions src/miru_device_sdk/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
GitCommitsResourceWithStreamingResponse,
AsyncGitCommitsResourceWithStreamingResponse,
)
from .calibrations import (
CalibrationsResource,
AsyncCalibrationsResource,
CalibrationsResourceWithRawResponse,
AsyncCalibrationsResourceWithRawResponse,
CalibrationsResourceWithStreamingResponse,
AsyncCalibrationsResourceWithStreamingResponse,
)

__all__ = [
"AgentResource",
Expand All @@ -64,6 +72,12 @@
"AsyncAgentResourceWithRawResponse",
"AgentResourceWithStreamingResponse",
"AsyncAgentResourceWithStreamingResponse",
"CalibrationsResource",
"AsyncCalibrationsResource",
"CalibrationsResourceWithRawResponse",
"AsyncCalibrationsResourceWithRawResponse",
"CalibrationsResourceWithStreamingResponse",
"AsyncCalibrationsResourceWithStreamingResponse",
"DeploymentsResource",
"AsyncDeploymentsResource",
"DeploymentsResourceWithRawResponse",
Expand Down
Loading
Loading