From ab1191d28943441844e81c6c1189aebc34f54980 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 10:58:40 +0000 Subject: [PATCH 1/9] feat(api): expose device count endpoint --- .stats.yml | 4 +- api.md | 3 +- src/mobilerun/resources/devices/devices.py | 51 +++++++++++++++++ src/mobilerun/types/__init__.py | 1 + src/mobilerun/types/device_count_response.py | 22 ++++++++ tests/api_resources/test_devices.py | 58 +++++++++++++++++++- 6 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 src/mobilerun/types/device_count_response.py diff --git a/.stats.yml b/.stats.yml index 7a32e45..09bc604 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 49 +configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-f80ecf1ef8ff0bf85d545b660eeef8677c62d571dc692b47fc044fc82378d330.yml openapi_spec_hash: 51d80499a2291f8d223276f759392574 -config_hash: 12fc3bd7f141a7f09f5ad38cfa42ba3d +config_hash: d1f61f26938ee3af50fa5f703318307d diff --git a/api.md b/api.md index 20d08ea..0d58a6a 100644 --- a/api.md +++ b/api.md @@ -59,7 +59,7 @@ Methods: Types: ```python -from mobilerun.types import Device, DeviceListResponse +from mobilerun.types import Device, DeviceListResponse, DeviceCountResponse ``` Methods: @@ -67,6 +67,7 @@ Methods: - client.devices.create(\*\*params) -> Device - client.devices.retrieve(device_id) -> Device - client.devices.list(\*\*params) -> DeviceListResponse +- client.devices.count() -> DeviceCountResponse - client.devices.terminate(device_id) -> None - client.devices.wait_ready(device_id) -> Device diff --git a/src/mobilerun/resources/devices/devices.py b/src/mobilerun/resources/devices/devices.py index bc1dbe8..63be619 100644 --- a/src/mobilerun/resources/devices/devices.py +++ b/src/mobilerun/resources/devices/devices.py @@ -69,6 +69,7 @@ from ..._base_client import make_request_options from ...types.device import Device from ...types.device_list_response import DeviceListResponse +from ...types.device_count_response import DeviceCountResponse __all__ = ["DevicesResource", "AsyncDevicesResource"] @@ -263,6 +264,25 @@ def list( cast_to=DeviceListResponse, ) + def count( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> DeviceCountResponse: + """Count claimed devices""" + return self._get( + "/devices/count", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeviceCountResponse, + ) + def terminate( self, device_id: str, @@ -521,6 +541,25 @@ async def list( cast_to=DeviceListResponse, ) + async def count( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> DeviceCountResponse: + """Count claimed devices""" + return await self._get( + "/devices/count", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeviceCountResponse, + ) + async def terminate( self, device_id: str, @@ -602,6 +641,9 @@ def __init__(self, devices: DevicesResource) -> None: self.list = to_raw_response_wrapper( devices.list, ) + self.count = to_raw_response_wrapper( + devices.count, + ) self.terminate = to_raw_response_wrapper( devices.terminate, ) @@ -647,6 +689,9 @@ def __init__(self, devices: AsyncDevicesResource) -> None: self.list = async_to_raw_response_wrapper( devices.list, ) + self.count = async_to_raw_response_wrapper( + devices.count, + ) self.terminate = async_to_raw_response_wrapper( devices.terminate, ) @@ -692,6 +737,9 @@ def __init__(self, devices: DevicesResource) -> None: self.list = to_streamed_response_wrapper( devices.list, ) + self.count = to_streamed_response_wrapper( + devices.count, + ) self.terminate = to_streamed_response_wrapper( devices.terminate, ) @@ -737,6 +785,9 @@ def __init__(self, devices: AsyncDevicesResource) -> None: self.list = async_to_streamed_response_wrapper( devices.list, ) + self.count = async_to_streamed_response_wrapper( + devices.count, + ) self.terminate = async_to_streamed_response_wrapper( devices.terminate, ) diff --git a/src/mobilerun/types/__init__.py b/src/mobilerun/types/__init__.py index e5925bb..72eddf4 100644 --- a/src/mobilerun/types/__init__.py +++ b/src/mobilerun/types/__init__.py @@ -20,6 +20,7 @@ from .device_create_params import DeviceCreateParams as DeviceCreateParams from .device_list_response import DeviceListResponse as DeviceListResponse from .hook_update_response import HookUpdateResponse as HookUpdateResponse +from .device_count_response import DeviceCountResponse as DeviceCountResponse from .hook_perform_response import HookPerformResponse as HookPerformResponse from .hook_subscribe_params import HookSubscribeParams as HookSubscribeParams from .hook_retrieve_response import HookRetrieveResponse as HookRetrieveResponse diff --git a/src/mobilerun/types/device_count_response.py b/src/mobilerun/types/device_count_response.py new file mode 100644 index 0000000..517cdeb --- /dev/null +++ b/src/mobilerun/types/device_count_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["DeviceCountResponse"] + + +class DeviceCountResponse(BaseModel): + limrun: int + + personal: int + + remote: int + + roidrun: int + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/tests/api_resources/test_devices.py b/tests/api_resources/test_devices.py index 0f3babb..f762064 100644 --- a/tests/api_resources/test_devices.py +++ b/tests/api_resources/test_devices.py @@ -9,7 +9,7 @@ from mobilerun import Mobilerun, AsyncMobilerun from tests.utils import assert_matches_type -from mobilerun.types import Device, DeviceListResponse +from mobilerun.types import Device, DeviceListResponse, DeviceCountResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -150,6 +150,34 @@ def test_streaming_response_list(self, client: Mobilerun) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_count(self, client: Mobilerun) -> None: + device = client.devices.count() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_count(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.count() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_count(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.count() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_terminate(self, client: Mobilerun) -> None: @@ -373,6 +401,34 @@ async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> No assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_count(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.count() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_count(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.count() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_count(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.count() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_terminate(self, async_client: AsyncMobilerun) -> None: From c6668af5dbd83d7ab1dd1fe4f68253422e055e73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 10:52:57 +0000 Subject: [PATCH 2/9] feat(client): add support for binary request streaming --- src/mobilerun/_base_client.py | 145 ++++++++++++++++++++++++-- src/mobilerun/_models.py | 17 +++- src/mobilerun/_types.py | 9 ++ tests/test_client.py | 187 +++++++++++++++++++++++++++++++++- 4 files changed, 344 insertions(+), 14 deletions(-) diff --git a/src/mobilerun/_base_client.py b/src/mobilerun/_base_client.py index f24e0dc..5177829 100644 --- a/src/mobilerun/_base_client.py +++ b/src/mobilerun/_base_client.py @@ -9,6 +9,7 @@ import inspect import logging import platform +import warnings import email.utils from types import TracebackType from random import random @@ -51,9 +52,11 @@ ResponseT, AnyMapping, PostParser, + BinaryTypes, RequestFiles, HttpxSendArgs, RequestOptions, + AsyncBinaryTypes, HttpxRequestFiles, ModelBuilderProtocol, not_given, @@ -477,8 +480,19 @@ def _build_request( retries_taken: int = 0, ) -> httpx.Request: if log.isEnabledFor(logging.DEBUG): - log.debug("Request options: %s", model_dump(options, exclude_unset=True)) - + log.debug( + "Request options: %s", + model_dump( + options, + exclude_unset=True, + # Pydantic v1 can't dump every type we support in content, so we exclude it for now. + exclude={ + "content", + } + if PYDANTIC_V1 + else {}, + ), + ) kwargs: dict[str, Any] = {} json_data = options.json_data @@ -532,7 +546,13 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - if isinstance(json_data, bytes): + if options.content is not None and json_data is not None: + raise TypeError("Passing both `content` and `json_data` is not supported") + if options.content is not None and files is not None: + raise TypeError("Passing both `content` and `files` is not supported") + if options.content is not None: + kwargs["content"] = options.content + elif isinstance(json_data, bytes): kwargs["content"] = json_data else: kwargs["json"] = json_data if is_given(json_data) else None @@ -1194,6 +1214,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, @@ -1206,6 +1227,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[True], @@ -1219,6 +1241,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool, @@ -1231,13 +1254,25 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) @@ -1247,11 +1282,23 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1261,11 +1308,23 @@ def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1275,9 +1334,19 @@ def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return self.request(cast_to, opts) def get_api_list( @@ -1717,6 +1786,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, @@ -1729,6 +1799,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[True], @@ -1742,6 +1813,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool, @@ -1754,13 +1826,25 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, ) -> ResponseT | _AsyncStreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) @@ -1770,11 +1854,28 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="patch", + url=path, + json_data=body, + content=content, + files=await async_to_httpx_files(files), + **options, ) return await self.request(cast_to, opts) @@ -1784,11 +1885,23 @@ async def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) @@ -1798,9 +1911,19 @@ async def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return await self.request(cast_to, opts) def get_api_list( diff --git a/src/mobilerun/_models.py b/src/mobilerun/_models.py index ca9500b..29070e0 100644 --- a/src/mobilerun/_models.py +++ b/src/mobilerun/_models.py @@ -3,7 +3,20 @@ import os import inspect import weakref -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast +from typing import ( + IO, + TYPE_CHECKING, + Any, + Type, + Union, + Generic, + TypeVar, + Callable, + Iterable, + Optional, + AsyncIterable, + cast, +) from datetime import date, datetime from typing_extensions import ( List, @@ -787,6 +800,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): timeout: float | Timeout | None files: HttpxRequestFiles | None idempotency_key: str + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] json_data: Body extra_json: AnyMapping follow_redirects: bool @@ -805,6 +819,7 @@ class FinalRequestOptions(pydantic.BaseModel): post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() follow_redirects: Union[bool, None] = None + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. json_data: Union[Body, None] = None diff --git a/src/mobilerun/_types.py b/src/mobilerun/_types.py index f9f729e..6fa6541 100644 --- a/src/mobilerun/_types.py +++ b/src/mobilerun/_types.py @@ -13,9 +13,11 @@ Mapping, TypeVar, Callable, + Iterable, Iterator, Optional, Sequence, + AsyncIterable, ) from typing_extensions import ( Set, @@ -56,6 +58,13 @@ else: Base64FileInput = Union[IO[bytes], PathLike] FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8. + + +# Used for sending raw binary data / streaming data in request bodies +# e.g. for file uploads without multipart encoding +BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]] +AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]] + FileTypes = Union[ # file (or bytes) FileContent, diff --git a/tests/test_client.py b/tests/test_client.py index add5de8..8c4f9eb 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -8,10 +8,11 @@ import json import asyncio import inspect +import dataclasses import tracemalloc -from typing import Any, Union, cast +from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock -from typing_extensions import Literal +from typing_extensions import Literal, AsyncIterator, override import httpx import pytest @@ -36,6 +37,7 @@ from .utils import update_env +T = TypeVar("T") base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" @@ -50,6 +52,57 @@ def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 +def mirror_request_content(request: httpx.Request) -> httpx.Response: + return httpx.Response(200, content=request.content) + + +# note: we can't use the httpx.MockTransport class as it consumes the request +# body itself, which means we can't test that the body is read lazily +class MockTransport(httpx.BaseTransport, httpx.AsyncBaseTransport): + def __init__( + self, + handler: Callable[[httpx.Request], httpx.Response] + | Callable[[httpx.Request], Coroutine[Any, Any, httpx.Response]], + ) -> None: + self.handler = handler + + @override + def handle_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert not inspect.iscoroutinefunction(self.handler), "handler must not be a coroutine function" + assert inspect.isfunction(self.handler), "handler must be a function" + return self.handler(request) + + @override + async def handle_async_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert inspect.iscoroutinefunction(self.handler), "handler must be a coroutine function" + return await self.handler(request) + + +@dataclasses.dataclass +class Counter: + value: int = 0 + + +def _make_sync_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> Iterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + +async def _make_async_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> AsyncIterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + def _get_open_connections(client: Mobilerun | AsyncMobilerun) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -511,6 +564,70 @@ def test_multipart_repeating_array(self, client: Mobilerun) -> None: b"", ] + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload(self, respx_mock: MockRouter, client: Mobilerun) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + def test_binary_content_upload_with_iterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_sync_iterator([file_content], counter=counter) + + def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=request.read()) + + with Mobilerun( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(transport=MockTransport(handler=mock_handler)), + ) as client: + response = client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRouter, client: Mobilerun) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) def test_basic_union_response(self, respx_mock: MockRouter, client: Mobilerun) -> None: class Model1(BaseModel): @@ -1339,6 +1456,72 @@ def test_multipart_repeating_array(self, async_client: AsyncMobilerun) -> None: b"", ] + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload(self, respx_mock: MockRouter, async_client: AsyncMobilerun) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = await async_client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + async def test_binary_content_upload_with_asynciterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_async_iterator([file_content], counter=counter) + + async def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=await request.aread()) + + async with AsyncMobilerun( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(transport=MockTransport(handler=mock_handler)), + ) as client: + response = await client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload_with_body_is_deprecated( + self, respx_mock: MockRouter, async_client: AsyncMobilerun + ) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = await async_client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncMobilerun) -> None: class Model1(BaseModel): From 416142eb345a07aefea8404a97231ed0acd74678 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 14:42:28 +0000 Subject: [PATCH 3/9] feat(api): api update --- .stats.yml | 6 +- README.md | 20 - api.md | 86 -- src/mobilerun/_client.py | 39 +- src/mobilerun/resources/__init__.py | 14 - src/mobilerun/resources/devices/__init__.py | 103 --- src/mobilerun/resources/devices/actions.py | 424 --------- src/mobilerun/resources/devices/apps.py | 495 ----------- src/mobilerun/resources/devices/devices.py | 820 ------------------ src/mobilerun/resources/devices/keyboard.py | 390 --------- src/mobilerun/resources/devices/packages.py | 195 ----- src/mobilerun/resources/devices/state.py | 385 -------- src/mobilerun/resources/devices/tasks.py | 199 ----- src/mobilerun/types/__init__.py | 5 - src/mobilerun/types/device.py | 47 - src/mobilerun/types/device_count_response.py | 22 - src/mobilerun/types/device_create_params.py | 40 - src/mobilerun/types/device_list_params.py | 29 - src/mobilerun/types/device_list_response.py | 33 - src/mobilerun/types/devices/__init__.py | 19 - .../types/devices/action_global_params.py | 15 - .../types/devices/action_swipe_params.py | 24 - .../types/devices/action_tap_params.py | 17 - .../types/devices/app_install_params.py | 15 - .../types/devices/app_list_params.py | 15 - .../types/devices/app_list_response.py | 25 - .../types/devices/app_start_params.py | 17 - .../types/devices/keyboard_key_params.py | 15 - .../types/devices/keyboard_write_params.py | 17 - .../types/devices/package_list_params.py | 15 - .../types/devices/package_list_response.py | 8 - .../types/devices/state_screenshot_params.py | 15 - .../devices/state_screenshot_response.py | 7 - .../types/devices/state_time_response.py | 7 - .../types/devices/state_ui_params.py | 15 - .../types/devices/state_ui_response.py | 91 -- .../types/devices/task_list_params.py | 19 - .../types/devices/task_list_response.py | 41 - tests/api_resources/devices/__init__.py | 1 - tests/api_resources/devices/test_actions.py | 408 --------- tests/api_resources/devices/test_apps.py | 490 ----------- tests/api_resources/devices/test_keyboard.py | 358 -------- tests/api_resources/devices/test_packages.py | 128 --- tests/api_resources/devices/test_state.py | 336 ------- tests/api_resources/devices/test_tasks.py | 132 --- tests/api_resources/test_devices.py | 514 ----------- 46 files changed, 4 insertions(+), 6112 deletions(-) delete mode 100644 src/mobilerun/resources/devices/__init__.py delete mode 100644 src/mobilerun/resources/devices/actions.py delete mode 100644 src/mobilerun/resources/devices/apps.py delete mode 100644 src/mobilerun/resources/devices/devices.py delete mode 100644 src/mobilerun/resources/devices/keyboard.py delete mode 100644 src/mobilerun/resources/devices/packages.py delete mode 100644 src/mobilerun/resources/devices/state.py delete mode 100644 src/mobilerun/resources/devices/tasks.py delete mode 100644 src/mobilerun/types/device.py delete mode 100644 src/mobilerun/types/device_count_response.py delete mode 100644 src/mobilerun/types/device_create_params.py delete mode 100644 src/mobilerun/types/device_list_params.py delete mode 100644 src/mobilerun/types/device_list_response.py delete mode 100644 src/mobilerun/types/devices/action_global_params.py delete mode 100644 src/mobilerun/types/devices/action_swipe_params.py delete mode 100644 src/mobilerun/types/devices/action_tap_params.py delete mode 100644 src/mobilerun/types/devices/app_install_params.py delete mode 100644 src/mobilerun/types/devices/app_list_params.py delete mode 100644 src/mobilerun/types/devices/app_list_response.py delete mode 100644 src/mobilerun/types/devices/app_start_params.py delete mode 100644 src/mobilerun/types/devices/keyboard_key_params.py delete mode 100644 src/mobilerun/types/devices/keyboard_write_params.py delete mode 100644 src/mobilerun/types/devices/package_list_params.py delete mode 100644 src/mobilerun/types/devices/package_list_response.py delete mode 100644 src/mobilerun/types/devices/state_screenshot_params.py delete mode 100644 src/mobilerun/types/devices/state_screenshot_response.py delete mode 100644 src/mobilerun/types/devices/state_time_response.py delete mode 100644 src/mobilerun/types/devices/state_ui_params.py delete mode 100644 src/mobilerun/types/devices/state_ui_response.py delete mode 100644 src/mobilerun/types/devices/task_list_params.py delete mode 100644 src/mobilerun/types/devices/task_list_response.py delete mode 100644 tests/api_resources/devices/__init__.py delete mode 100644 tests/api_resources/devices/test_actions.py delete mode 100644 tests/api_resources/devices/test_apps.py delete mode 100644 tests/api_resources/devices/test_keyboard.py delete mode 100644 tests/api_resources/devices/test_packages.py delete mode 100644 tests/api_resources/devices/test_state.py delete mode 100644 tests/api_resources/devices/test_tasks.py delete mode 100644 tests/api_resources/test_devices.py diff --git a/.stats.yml b/.stats.yml index 09bc604..d703f41 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 50 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-f80ecf1ef8ff0bf85d545b660eeef8677c62d571dc692b47fc044fc82378d330.yml -openapi_spec_hash: 51d80499a2291f8d223276f759392574 +configured_endpoints: 29 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-9bc196694afd948cfd36c21c4779815df718b41928ded5b93760f4d6afa853ef.yml +openapi_spec_hash: dd56ae43482890faf056c390294ecff5 config_hash: d1f61f26938ee3af50fa5f703318307d diff --git a/README.md b/README.md index 0eece63..84c1f14 100644 --- a/README.md +++ b/README.md @@ -115,26 +115,6 @@ 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 mobilerun import Mobilerun - -client = Mobilerun() - -device = client.devices.create( - proxy={ - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, -) -print(device.proxy) -``` - ## 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 `mobilerun.APIConnectionError` is raised. diff --git a/api.md b/api.md index 0d58a6a..f518023 100644 --- a/api.md +++ b/api.md @@ -54,92 +54,6 @@ Methods: - client.tasks.ui_states.retrieve(index, \*, task_id) -> MediaResponse - client.tasks.ui_states.list(task_id) -> UiStateListResponse -# Devices - -Types: - -```python -from mobilerun.types import Device, DeviceListResponse, DeviceCountResponse -``` - -Methods: - -- client.devices.create(\*\*params) -> Device -- client.devices.retrieve(device_id) -> Device -- client.devices.list(\*\*params) -> DeviceListResponse -- client.devices.count() -> DeviceCountResponse -- client.devices.terminate(device_id) -> None -- client.devices.wait_ready(device_id) -> Device - -## Actions - -Methods: - -- client.devices.actions.global\_(device_id, \*\*params) -> None -- client.devices.actions.swipe(device_id, \*\*params) -> None -- client.devices.actions.tap(device_id, \*\*params) -> None - -## State - -Types: - -```python -from mobilerun.types.devices import StateScreenshotResponse, StateTimeResponse, StateUiResponse -``` - -Methods: - -- client.devices.state.screenshot(device_id, \*\*params) -> str -- client.devices.state.time(device_id) -> str -- client.devices.state.ui(device_id, \*\*params) -> StateUiResponse - -## Apps - -Types: - -```python -from mobilerun.types.devices import AppListResponse -``` - -Methods: - -- client.devices.apps.list(device_id, \*\*params) -> Optional[AppListResponse] -- client.devices.apps.delete(package_name, \*, device_id) -> None -- client.devices.apps.install(device_id, \*\*params) -> None -- client.devices.apps.start(package_name, \*, device_id, \*\*params) -> None - -## Packages - -Types: - -```python -from mobilerun.types.devices import PackageListResponse -``` - -Methods: - -- client.devices.packages.list(device_id, \*\*params) -> Optional[PackageListResponse] - -## Keyboard - -Methods: - -- client.devices.keyboard.clear(device_id) -> None -- client.devices.keyboard.key(device_id, \*\*params) -> None -- client.devices.keyboard.write(device_id, \*\*params) -> None - -## Tasks - -Types: - -```python -from mobilerun.types.devices import TaskListResponse -``` - -Methods: - -- client.devices.tasks.list(device_id, \*\*params) -> TaskListResponse - # Apps Types: diff --git a/src/mobilerun/_client.py b/src/mobilerun/_client.py index dd728b1..271bb95 100644 --- a/src/mobilerun/_client.py +++ b/src/mobilerun/_client.py @@ -32,11 +32,10 @@ ) if TYPE_CHECKING: - from .resources import apps, hooks, tasks, devices, credentials + from .resources import apps, hooks, tasks, credentials from .resources.apps import AppsResource, AsyncAppsResource from .resources.hooks import HooksResource, AsyncHooksResource from .resources.tasks.tasks import TasksResource, AsyncTasksResource - from .resources.devices.devices import DevicesResource, AsyncDevicesResource from .resources.credentials.credentials import CredentialsResource, AsyncCredentialsResource __all__ = [ @@ -108,12 +107,6 @@ def tasks(self) -> TasksResource: return TasksResource(self) - @cached_property - def devices(self) -> DevicesResource: - from .resources.devices import DevicesResource - - return DevicesResource(self) - @cached_property def apps(self) -> AppsResource: from .resources.apps import AppsResource @@ -313,12 +306,6 @@ def tasks(self) -> AsyncTasksResource: return AsyncTasksResource(self) - @cached_property - def devices(self) -> AsyncDevicesResource: - from .resources.devices import AsyncDevicesResource - - return AsyncDevicesResource(self) - @cached_property def apps(self) -> AsyncAppsResource: from .resources.apps import AsyncAppsResource @@ -473,12 +460,6 @@ def tasks(self) -> tasks.TasksResourceWithRawResponse: return TasksResourceWithRawResponse(self._client.tasks) - @cached_property - def devices(self) -> devices.DevicesResourceWithRawResponse: - from .resources.devices import DevicesResourceWithRawResponse - - return DevicesResourceWithRawResponse(self._client.devices) - @cached_property def apps(self) -> apps.AppsResourceWithRawResponse: from .resources.apps import AppsResourceWithRawResponse @@ -510,12 +491,6 @@ def tasks(self) -> tasks.AsyncTasksResourceWithRawResponse: return AsyncTasksResourceWithRawResponse(self._client.tasks) - @cached_property - def devices(self) -> devices.AsyncDevicesResourceWithRawResponse: - from .resources.devices import AsyncDevicesResourceWithRawResponse - - return AsyncDevicesResourceWithRawResponse(self._client.devices) - @cached_property def apps(self) -> apps.AsyncAppsResourceWithRawResponse: from .resources.apps import AsyncAppsResourceWithRawResponse @@ -547,12 +522,6 @@ def tasks(self) -> tasks.TasksResourceWithStreamingResponse: return TasksResourceWithStreamingResponse(self._client.tasks) - @cached_property - def devices(self) -> devices.DevicesResourceWithStreamingResponse: - from .resources.devices import DevicesResourceWithStreamingResponse - - return DevicesResourceWithStreamingResponse(self._client.devices) - @cached_property def apps(self) -> apps.AppsResourceWithStreamingResponse: from .resources.apps import AppsResourceWithStreamingResponse @@ -584,12 +553,6 @@ def tasks(self) -> tasks.AsyncTasksResourceWithStreamingResponse: return AsyncTasksResourceWithStreamingResponse(self._client.tasks) - @cached_property - def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse: - from .resources.devices import AsyncDevicesResourceWithStreamingResponse - - return AsyncDevicesResourceWithStreamingResponse(self._client.devices) - @cached_property def apps(self) -> apps.AsyncAppsResourceWithStreamingResponse: from .resources.apps import AsyncAppsResourceWithStreamingResponse diff --git a/src/mobilerun/resources/__init__.py b/src/mobilerun/resources/__init__.py index c65175f..9204f81 100644 --- a/src/mobilerun/resources/__init__.py +++ b/src/mobilerun/resources/__init__.py @@ -24,14 +24,6 @@ TasksResourceWithStreamingResponse, AsyncTasksResourceWithStreamingResponse, ) -from .devices import ( - DevicesResource, - AsyncDevicesResource, - DevicesResourceWithRawResponse, - AsyncDevicesResourceWithRawResponse, - DevicesResourceWithStreamingResponse, - AsyncDevicesResourceWithStreamingResponse, -) from .credentials import ( CredentialsResource, AsyncCredentialsResource, @@ -48,12 +40,6 @@ "AsyncTasksResourceWithRawResponse", "TasksResourceWithStreamingResponse", "AsyncTasksResourceWithStreamingResponse", - "DevicesResource", - "AsyncDevicesResource", - "DevicesResourceWithRawResponse", - "AsyncDevicesResourceWithRawResponse", - "DevicesResourceWithStreamingResponse", - "AsyncDevicesResourceWithStreamingResponse", "AppsResource", "AsyncAppsResource", "AppsResourceWithRawResponse", diff --git a/src/mobilerun/resources/devices/__init__.py b/src/mobilerun/resources/devices/__init__.py deleted file mode 100644 index db9559e..0000000 --- a/src/mobilerun/resources/devices/__init__.py +++ /dev/null @@ -1,103 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .apps import ( - AppsResource, - AsyncAppsResource, - AppsResourceWithRawResponse, - AsyncAppsResourceWithRawResponse, - AppsResourceWithStreamingResponse, - AsyncAppsResourceWithStreamingResponse, -) -from .state import ( - StateResource, - AsyncStateResource, - StateResourceWithRawResponse, - AsyncStateResourceWithRawResponse, - StateResourceWithStreamingResponse, - AsyncStateResourceWithStreamingResponse, -) -from .tasks import ( - TasksResource, - AsyncTasksResource, - TasksResourceWithRawResponse, - AsyncTasksResourceWithRawResponse, - TasksResourceWithStreamingResponse, - AsyncTasksResourceWithStreamingResponse, -) -from .actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) -from .devices import ( - DevicesResource, - AsyncDevicesResource, - DevicesResourceWithRawResponse, - AsyncDevicesResourceWithRawResponse, - DevicesResourceWithStreamingResponse, - AsyncDevicesResourceWithStreamingResponse, -) -from .keyboard import ( - KeyboardResource, - AsyncKeyboardResource, - KeyboardResourceWithRawResponse, - AsyncKeyboardResourceWithRawResponse, - KeyboardResourceWithStreamingResponse, - AsyncKeyboardResourceWithStreamingResponse, -) -from .packages import ( - PackagesResource, - AsyncPackagesResource, - PackagesResourceWithRawResponse, - AsyncPackagesResourceWithRawResponse, - PackagesResourceWithStreamingResponse, - AsyncPackagesResourceWithStreamingResponse, -) - -__all__ = [ - "ActionsResource", - "AsyncActionsResource", - "ActionsResourceWithRawResponse", - "AsyncActionsResourceWithRawResponse", - "ActionsResourceWithStreamingResponse", - "AsyncActionsResourceWithStreamingResponse", - "StateResource", - "AsyncStateResource", - "StateResourceWithRawResponse", - "AsyncStateResourceWithRawResponse", - "StateResourceWithStreamingResponse", - "AsyncStateResourceWithStreamingResponse", - "AppsResource", - "AsyncAppsResource", - "AppsResourceWithRawResponse", - "AsyncAppsResourceWithRawResponse", - "AppsResourceWithStreamingResponse", - "AsyncAppsResourceWithStreamingResponse", - "PackagesResource", - "AsyncPackagesResource", - "PackagesResourceWithRawResponse", - "AsyncPackagesResourceWithRawResponse", - "PackagesResourceWithStreamingResponse", - "AsyncPackagesResourceWithStreamingResponse", - "KeyboardResource", - "AsyncKeyboardResource", - "KeyboardResourceWithRawResponse", - "AsyncKeyboardResourceWithRawResponse", - "KeyboardResourceWithStreamingResponse", - "AsyncKeyboardResourceWithStreamingResponse", - "TasksResource", - "AsyncTasksResource", - "TasksResourceWithRawResponse", - "AsyncTasksResourceWithRawResponse", - "TasksResourceWithStreamingResponse", - "AsyncTasksResourceWithStreamingResponse", - "DevicesResource", - "AsyncDevicesResource", - "DevicesResourceWithRawResponse", - "AsyncDevicesResourceWithRawResponse", - "DevicesResourceWithStreamingResponse", - "AsyncDevicesResourceWithStreamingResponse", -] diff --git a/src/mobilerun/resources/devices/actions.py b/src/mobilerun/resources/devices/actions.py deleted file mode 100644 index b0e404a..0000000 --- a/src/mobilerun/resources/devices/actions.py +++ /dev/null @@ -1,424 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.devices import action_tap_params, action_swipe_params, action_global_params - -__all__ = ["ActionsResource", "AsyncActionsResource"] - - -class ActionsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ActionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return ActionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ActionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return ActionsResourceWithStreamingResponse(self) - - def global_( - self, - device_id: str, - *, - action: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Perform a global action - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._post( - f"/devices/{device_id}/global", - body=maybe_transform({"action": action}, action_global_params.ActionGlobalParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def swipe( - self, - device_id: str, - *, - duration: int, - end_x: int, - end_y: int, - start_x: int, - start_y: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Swipe - - Args: - duration: Swipe duration in milliseconds - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._post( - f"/devices/{device_id}/swipe", - body=maybe_transform( - { - "duration": duration, - "end_x": end_x, - "end_y": end_y, - "start_x": start_x, - "start_y": start_y, - }, - action_swipe_params.ActionSwipeParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def tap( - self, - device_id: str, - *, - x: int, - y: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Tap by coordinates - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._post( - f"/devices/{device_id}/tap", - body=maybe_transform( - { - "x": x, - "y": y, - }, - action_tap_params.ActionTapParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncActionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncActionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncActionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncActionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AsyncActionsResourceWithStreamingResponse(self) - - async def global_( - self, - device_id: str, - *, - action: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Perform a global action - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._post( - f"/devices/{device_id}/global", - body=await async_maybe_transform({"action": action}, action_global_params.ActionGlobalParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def swipe( - self, - device_id: str, - *, - duration: int, - end_x: int, - end_y: int, - start_x: int, - start_y: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Swipe - - Args: - duration: Swipe duration in milliseconds - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._post( - f"/devices/{device_id}/swipe", - body=await async_maybe_transform( - { - "duration": duration, - "end_x": end_x, - "end_y": end_y, - "start_x": start_x, - "start_y": start_y, - }, - action_swipe_params.ActionSwipeParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def tap( - self, - device_id: str, - *, - x: int, - y: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Tap by coordinates - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._post( - f"/devices/{device_id}/tap", - body=await async_maybe_transform( - { - "x": x, - "y": y, - }, - action_tap_params.ActionTapParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class ActionsResourceWithRawResponse: - def __init__(self, actions: ActionsResource) -> None: - self._actions = actions - - self.global_ = to_raw_response_wrapper( - actions.global_, - ) - self.swipe = to_raw_response_wrapper( - actions.swipe, - ) - self.tap = to_raw_response_wrapper( - actions.tap, - ) - - -class AsyncActionsResourceWithRawResponse: - def __init__(self, actions: AsyncActionsResource) -> None: - self._actions = actions - - self.global_ = async_to_raw_response_wrapper( - actions.global_, - ) - self.swipe = async_to_raw_response_wrapper( - actions.swipe, - ) - self.tap = async_to_raw_response_wrapper( - actions.tap, - ) - - -class ActionsResourceWithStreamingResponse: - def __init__(self, actions: ActionsResource) -> None: - self._actions = actions - - self.global_ = to_streamed_response_wrapper( - actions.global_, - ) - self.swipe = to_streamed_response_wrapper( - actions.swipe, - ) - self.tap = to_streamed_response_wrapper( - actions.tap, - ) - - -class AsyncActionsResourceWithStreamingResponse: - def __init__(self, actions: AsyncActionsResource) -> None: - self._actions = actions - - self.global_ = async_to_streamed_response_wrapper( - actions.global_, - ) - self.swipe = async_to_streamed_response_wrapper( - actions.swipe, - ) - self.tap = async_to_streamed_response_wrapper( - actions.tap, - ) diff --git a/src/mobilerun/resources/devices/apps.py b/src/mobilerun/resources/devices/apps.py deleted file mode 100644 index e0ddd9b..0000000 --- a/src/mobilerun/resources/devices/apps.py +++ /dev/null @@ -1,495 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional - -import httpx - -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.devices import app_list_params, app_start_params, app_install_params -from ...types.devices.app_list_response import AppListResponse - -__all__ = ["AppsResource", "AsyncAppsResource"] - - -class AppsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AppsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AppsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AppsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AppsResourceWithStreamingResponse(self) - - def list( - self, - device_id: str, - *, - include_system_apps: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Optional[AppListResponse]: - """ - List apps - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._get( - f"/devices/{device_id}/apps", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"include_system_apps": include_system_apps}, app_list_params.AppListParams), - ), - cast_to=AppListResponse, - ) - - def delete( - self, - package_name: str, - *, - device_id: str, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete app - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - if not package_name: - raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._delete( - f"/devices/{device_id}/apps/{package_name}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def install( - self, - device_id: str, - *, - package_name: str, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Install app - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._post( - f"/devices/{device_id}/apps", - body=maybe_transform({"package_name": package_name}, app_install_params.AppInstallParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def start( - self, - package_name: str, - *, - device_id: str, - activity: str | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Start app - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - if not package_name: - raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._put( - f"/devices/{device_id}/apps/{package_name}", - body=maybe_transform({"activity": activity}, app_start_params.AppStartParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncAppsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAppsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncAppsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AsyncAppsResourceWithStreamingResponse(self) - - async def list( - self, - device_id: str, - *, - include_system_apps: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Optional[AppListResponse]: - """ - List apps - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._get( - f"/devices/{device_id}/apps", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"include_system_apps": include_system_apps}, app_list_params.AppListParams - ), - ), - cast_to=AppListResponse, - ) - - async def delete( - self, - package_name: str, - *, - device_id: str, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete app - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - if not package_name: - raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._delete( - f"/devices/{device_id}/apps/{package_name}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def install( - self, - device_id: str, - *, - package_name: str, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Install app - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._post( - f"/devices/{device_id}/apps", - body=await async_maybe_transform({"package_name": package_name}, app_install_params.AppInstallParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def start( - self, - package_name: str, - *, - device_id: str, - activity: str | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Start app - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - if not package_name: - raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._put( - f"/devices/{device_id}/apps/{package_name}", - body=await async_maybe_transform({"activity": activity}, app_start_params.AppStartParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AppsResourceWithRawResponse: - def __init__(self, apps: AppsResource) -> None: - self._apps = apps - - self.list = to_raw_response_wrapper( - apps.list, - ) - self.delete = to_raw_response_wrapper( - apps.delete, - ) - self.install = to_raw_response_wrapper( - apps.install, - ) - self.start = to_raw_response_wrapper( - apps.start, - ) - - -class AsyncAppsResourceWithRawResponse: - def __init__(self, apps: AsyncAppsResource) -> None: - self._apps = apps - - self.list = async_to_raw_response_wrapper( - apps.list, - ) - self.delete = async_to_raw_response_wrapper( - apps.delete, - ) - self.install = async_to_raw_response_wrapper( - apps.install, - ) - self.start = async_to_raw_response_wrapper( - apps.start, - ) - - -class AppsResourceWithStreamingResponse: - def __init__(self, apps: AppsResource) -> None: - self._apps = apps - - self.list = to_streamed_response_wrapper( - apps.list, - ) - self.delete = to_streamed_response_wrapper( - apps.delete, - ) - self.install = to_streamed_response_wrapper( - apps.install, - ) - self.start = to_streamed_response_wrapper( - apps.start, - ) - - -class AsyncAppsResourceWithStreamingResponse: - def __init__(self, apps: AsyncAppsResource) -> None: - self._apps = apps - - self.list = async_to_streamed_response_wrapper( - apps.list, - ) - self.delete = async_to_streamed_response_wrapper( - apps.delete, - ) - self.install = async_to_streamed_response_wrapper( - apps.install, - ) - self.start = async_to_streamed_response_wrapper( - apps.start, - ) diff --git a/src/mobilerun/resources/devices/devices.py b/src/mobilerun/resources/devices/devices.py deleted file mode 100644 index 63be619..0000000 --- a/src/mobilerun/resources/devices/devices.py +++ /dev/null @@ -1,820 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal - -import httpx - -from .apps import ( - AppsResource, - AsyncAppsResource, - AppsResourceWithRawResponse, - AsyncAppsResourceWithRawResponse, - AppsResourceWithStreamingResponse, - AsyncAppsResourceWithStreamingResponse, -) -from .state import ( - StateResource, - AsyncStateResource, - StateResourceWithRawResponse, - AsyncStateResourceWithRawResponse, - StateResourceWithStreamingResponse, - AsyncStateResourceWithStreamingResponse, -) -from .tasks import ( - TasksResource, - AsyncTasksResource, - TasksResourceWithRawResponse, - AsyncTasksResourceWithRawResponse, - TasksResourceWithStreamingResponse, - AsyncTasksResourceWithStreamingResponse, -) -from ...types import device_list_params, device_create_params -from .actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from .keyboard import ( - KeyboardResource, - AsyncKeyboardResource, - KeyboardResourceWithRawResponse, - AsyncKeyboardResourceWithRawResponse, - KeyboardResourceWithStreamingResponse, - AsyncKeyboardResourceWithStreamingResponse, -) -from .packages import ( - PackagesResource, - AsyncPackagesResource, - PackagesResourceWithRawResponse, - AsyncPackagesResourceWithRawResponse, - PackagesResourceWithStreamingResponse, - AsyncPackagesResourceWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.device import Device -from ...types.device_list_response import DeviceListResponse -from ...types.device_count_response import DeviceCountResponse - -__all__ = ["DevicesResource", "AsyncDevicesResource"] - - -class DevicesResource(SyncAPIResource): - @cached_property - def actions(self) -> ActionsResource: - return ActionsResource(self._client) - - @cached_property - def state(self) -> StateResource: - return StateResource(self._client) - - @cached_property - def apps(self) -> AppsResource: - return AppsResource(self._client) - - @cached_property - def packages(self) -> PackagesResource: - return PackagesResource(self._client) - - @cached_property - def keyboard(self) -> KeyboardResource: - return KeyboardResource(self._client) - - @cached_property - def tasks(self) -> TasksResource: - return TasksResource(self._client) - - @cached_property - def with_raw_response(self) -> DevicesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return DevicesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DevicesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return DevicesResourceWithStreamingResponse(self) - - def create( - self, - *, - device_type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, - provider: Literal["limrun", "remote", "roidrun"] | Omit = omit, - apps: Optional[SequenceNotStr[str]] | Omit = omit, - country: str | Omit = omit, - files: Optional[SequenceNotStr[str]] | Omit = omit, - name: str | Omit = omit, - proxy: device_create_params.Proxy | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Device: - """ - Provision a new device - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/devices", - body=maybe_transform( - { - "apps": apps, - "country": country, - "files": files, - "name": name, - "proxy": proxy, - }, - device_create_params.DeviceCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "device_type": device_type, - "provider": provider, - }, - device_create_params.DeviceCreateParams, - ), - ), - cast_to=Device, - ) - - def retrieve( - self, - device_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Device: - """ - Get device info - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return self._get( - f"/devices/{device_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Device, - ) - - def list( - self, - *, - country: str | Omit = omit, - name: str | Omit = omit, - order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - provider: Literal["limrun", "personal", "remote", "roidrun"] | Omit = omit, - state: Literal["creating", "assigned", "ready", "terminated", "unknown"] | Omit = omit, - type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DeviceListResponse: - """ - List devices - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/devices", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "country": country, - "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "provider": provider, - "state": state, - "type": type, - }, - device_list_params.DeviceListParams, - ), - ), - cast_to=DeviceListResponse, - ) - - def count( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DeviceCountResponse: - """Count claimed devices""" - return self._get( - "/devices/count", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DeviceCountResponse, - ) - - def terminate( - self, - device_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Terminate a device - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/devices/{device_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def wait_ready( - self, - device_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Device: - """ - Wait for device to be ready - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return self._get( - f"/devices/{device_id}/wait", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Device, - ) - - -class AsyncDevicesResource(AsyncAPIResource): - @cached_property - def actions(self) -> AsyncActionsResource: - return AsyncActionsResource(self._client) - - @cached_property - def state(self) -> AsyncStateResource: - return AsyncStateResource(self._client) - - @cached_property - def apps(self) -> AsyncAppsResource: - return AsyncAppsResource(self._client) - - @cached_property - def packages(self) -> AsyncPackagesResource: - return AsyncPackagesResource(self._client) - - @cached_property - def keyboard(self) -> AsyncKeyboardResource: - return AsyncKeyboardResource(self._client) - - @cached_property - def tasks(self) -> AsyncTasksResource: - return AsyncTasksResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncDevicesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncDevicesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDevicesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AsyncDevicesResourceWithStreamingResponse(self) - - async def create( - self, - *, - device_type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, - provider: Literal["limrun", "remote", "roidrun"] | Omit = omit, - apps: Optional[SequenceNotStr[str]] | Omit = omit, - country: str | Omit = omit, - files: Optional[SequenceNotStr[str]] | Omit = omit, - name: str | Omit = omit, - proxy: device_create_params.Proxy | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Device: - """ - Provision a new device - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/devices", - body=await async_maybe_transform( - { - "apps": apps, - "country": country, - "files": files, - "name": name, - "proxy": proxy, - }, - device_create_params.DeviceCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "device_type": device_type, - "provider": provider, - }, - device_create_params.DeviceCreateParams, - ), - ), - cast_to=Device, - ) - - async def retrieve( - self, - device_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Device: - """ - Get device info - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return await self._get( - f"/devices/{device_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Device, - ) - - async def list( - self, - *, - country: str | Omit = omit, - name: str | Omit = omit, - order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - provider: Literal["limrun", "personal", "remote", "roidrun"] | Omit = omit, - state: Literal["creating", "assigned", "ready", "terminated", "unknown"] | Omit = omit, - type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DeviceListResponse: - """ - List devices - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/devices", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "country": country, - "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "provider": provider, - "state": state, - "type": type, - }, - device_list_params.DeviceListParams, - ), - ), - cast_to=DeviceListResponse, - ) - - async def count( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> DeviceCountResponse: - """Count claimed devices""" - return await self._get( - "/devices/count", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DeviceCountResponse, - ) - - async def terminate( - self, - device_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Terminate a device - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/devices/{device_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def wait_ready( - self, - device_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Device: - """ - Wait for device to be ready - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return await self._get( - f"/devices/{device_id}/wait", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Device, - ) - - -class DevicesResourceWithRawResponse: - def __init__(self, devices: DevicesResource) -> None: - self._devices = devices - - self.create = to_raw_response_wrapper( - devices.create, - ) - self.retrieve = to_raw_response_wrapper( - devices.retrieve, - ) - self.list = to_raw_response_wrapper( - devices.list, - ) - self.count = to_raw_response_wrapper( - devices.count, - ) - self.terminate = to_raw_response_wrapper( - devices.terminate, - ) - self.wait_ready = to_raw_response_wrapper( - devices.wait_ready, - ) - - @cached_property - def actions(self) -> ActionsResourceWithRawResponse: - return ActionsResourceWithRawResponse(self._devices.actions) - - @cached_property - def state(self) -> StateResourceWithRawResponse: - return StateResourceWithRawResponse(self._devices.state) - - @cached_property - def apps(self) -> AppsResourceWithRawResponse: - return AppsResourceWithRawResponse(self._devices.apps) - - @cached_property - def packages(self) -> PackagesResourceWithRawResponse: - return PackagesResourceWithRawResponse(self._devices.packages) - - @cached_property - def keyboard(self) -> KeyboardResourceWithRawResponse: - return KeyboardResourceWithRawResponse(self._devices.keyboard) - - @cached_property - def tasks(self) -> TasksResourceWithRawResponse: - return TasksResourceWithRawResponse(self._devices.tasks) - - -class AsyncDevicesResourceWithRawResponse: - def __init__(self, devices: AsyncDevicesResource) -> None: - self._devices = devices - - self.create = async_to_raw_response_wrapper( - devices.create, - ) - self.retrieve = async_to_raw_response_wrapper( - devices.retrieve, - ) - self.list = async_to_raw_response_wrapper( - devices.list, - ) - self.count = async_to_raw_response_wrapper( - devices.count, - ) - self.terminate = async_to_raw_response_wrapper( - devices.terminate, - ) - self.wait_ready = async_to_raw_response_wrapper( - devices.wait_ready, - ) - - @cached_property - def actions(self) -> AsyncActionsResourceWithRawResponse: - return AsyncActionsResourceWithRawResponse(self._devices.actions) - - @cached_property - def state(self) -> AsyncStateResourceWithRawResponse: - return AsyncStateResourceWithRawResponse(self._devices.state) - - @cached_property - def apps(self) -> AsyncAppsResourceWithRawResponse: - return AsyncAppsResourceWithRawResponse(self._devices.apps) - - @cached_property - def packages(self) -> AsyncPackagesResourceWithRawResponse: - return AsyncPackagesResourceWithRawResponse(self._devices.packages) - - @cached_property - def keyboard(self) -> AsyncKeyboardResourceWithRawResponse: - return AsyncKeyboardResourceWithRawResponse(self._devices.keyboard) - - @cached_property - def tasks(self) -> AsyncTasksResourceWithRawResponse: - return AsyncTasksResourceWithRawResponse(self._devices.tasks) - - -class DevicesResourceWithStreamingResponse: - def __init__(self, devices: DevicesResource) -> None: - self._devices = devices - - self.create = to_streamed_response_wrapper( - devices.create, - ) - self.retrieve = to_streamed_response_wrapper( - devices.retrieve, - ) - self.list = to_streamed_response_wrapper( - devices.list, - ) - self.count = to_streamed_response_wrapper( - devices.count, - ) - self.terminate = to_streamed_response_wrapper( - devices.terminate, - ) - self.wait_ready = to_streamed_response_wrapper( - devices.wait_ready, - ) - - @cached_property - def actions(self) -> ActionsResourceWithStreamingResponse: - return ActionsResourceWithStreamingResponse(self._devices.actions) - - @cached_property - def state(self) -> StateResourceWithStreamingResponse: - return StateResourceWithStreamingResponse(self._devices.state) - - @cached_property - def apps(self) -> AppsResourceWithStreamingResponse: - return AppsResourceWithStreamingResponse(self._devices.apps) - - @cached_property - def packages(self) -> PackagesResourceWithStreamingResponse: - return PackagesResourceWithStreamingResponse(self._devices.packages) - - @cached_property - def keyboard(self) -> KeyboardResourceWithStreamingResponse: - return KeyboardResourceWithStreamingResponse(self._devices.keyboard) - - @cached_property - def tasks(self) -> TasksResourceWithStreamingResponse: - return TasksResourceWithStreamingResponse(self._devices.tasks) - - -class AsyncDevicesResourceWithStreamingResponse: - def __init__(self, devices: AsyncDevicesResource) -> None: - self._devices = devices - - self.create = async_to_streamed_response_wrapper( - devices.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - devices.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - devices.list, - ) - self.count = async_to_streamed_response_wrapper( - devices.count, - ) - self.terminate = async_to_streamed_response_wrapper( - devices.terminate, - ) - self.wait_ready = async_to_streamed_response_wrapper( - devices.wait_ready, - ) - - @cached_property - def actions(self) -> AsyncActionsResourceWithStreamingResponse: - return AsyncActionsResourceWithStreamingResponse(self._devices.actions) - - @cached_property - def state(self) -> AsyncStateResourceWithStreamingResponse: - return AsyncStateResourceWithStreamingResponse(self._devices.state) - - @cached_property - def apps(self) -> AsyncAppsResourceWithStreamingResponse: - return AsyncAppsResourceWithStreamingResponse(self._devices.apps) - - @cached_property - def packages(self) -> AsyncPackagesResourceWithStreamingResponse: - return AsyncPackagesResourceWithStreamingResponse(self._devices.packages) - - @cached_property - def keyboard(self) -> AsyncKeyboardResourceWithStreamingResponse: - return AsyncKeyboardResourceWithStreamingResponse(self._devices.keyboard) - - @cached_property - def tasks(self) -> AsyncTasksResourceWithStreamingResponse: - return AsyncTasksResourceWithStreamingResponse(self._devices.tasks) diff --git a/src/mobilerun/resources/devices/keyboard.py b/src/mobilerun/resources/devices/keyboard.py deleted file mode 100644 index 81d8459..0000000 --- a/src/mobilerun/resources/devices/keyboard.py +++ /dev/null @@ -1,390 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.devices import keyboard_key_params, keyboard_write_params - -__all__ = ["KeyboardResource", "AsyncKeyboardResource"] - - -class KeyboardResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> KeyboardResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return KeyboardResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> KeyboardResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return KeyboardResourceWithStreamingResponse(self) - - def clear( - self, - device_id: str, - *, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Clear input - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._delete( - f"/devices/{device_id}/keyboard", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def key( - self, - device_id: str, - *, - key: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Input key - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._put( - f"/devices/{device_id}/keyboard", - body=maybe_transform({"key": key}, keyboard_key_params.KeyboardKeyParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def write( - self, - device_id: str, - *, - clear: bool, - text: str, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Input text - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._post( - f"/devices/{device_id}/keyboard", - body=maybe_transform( - { - "clear": clear, - "text": text, - }, - keyboard_write_params.KeyboardWriteParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncKeyboardResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncKeyboardResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncKeyboardResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncKeyboardResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AsyncKeyboardResourceWithStreamingResponse(self) - - async def clear( - self, - device_id: str, - *, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Clear input - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._delete( - f"/devices/{device_id}/keyboard", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def key( - self, - device_id: str, - *, - key: int, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Input key - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._put( - f"/devices/{device_id}/keyboard", - body=await async_maybe_transform({"key": key}, keyboard_key_params.KeyboardKeyParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def write( - self, - device_id: str, - *, - clear: bool, - text: str, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Input text - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._post( - f"/devices/{device_id}/keyboard", - body=await async_maybe_transform( - { - "clear": clear, - "text": text, - }, - keyboard_write_params.KeyboardWriteParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class KeyboardResourceWithRawResponse: - def __init__(self, keyboard: KeyboardResource) -> None: - self._keyboard = keyboard - - self.clear = to_raw_response_wrapper( - keyboard.clear, - ) - self.key = to_raw_response_wrapper( - keyboard.key, - ) - self.write = to_raw_response_wrapper( - keyboard.write, - ) - - -class AsyncKeyboardResourceWithRawResponse: - def __init__(self, keyboard: AsyncKeyboardResource) -> None: - self._keyboard = keyboard - - self.clear = async_to_raw_response_wrapper( - keyboard.clear, - ) - self.key = async_to_raw_response_wrapper( - keyboard.key, - ) - self.write = async_to_raw_response_wrapper( - keyboard.write, - ) - - -class KeyboardResourceWithStreamingResponse: - def __init__(self, keyboard: KeyboardResource) -> None: - self._keyboard = keyboard - - self.clear = to_streamed_response_wrapper( - keyboard.clear, - ) - self.key = to_streamed_response_wrapper( - keyboard.key, - ) - self.write = to_streamed_response_wrapper( - keyboard.write, - ) - - -class AsyncKeyboardResourceWithStreamingResponse: - def __init__(self, keyboard: AsyncKeyboardResource) -> None: - self._keyboard = keyboard - - self.clear = async_to_streamed_response_wrapper( - keyboard.clear, - ) - self.key = async_to_streamed_response_wrapper( - keyboard.key, - ) - self.write = async_to_streamed_response_wrapper( - keyboard.write, - ) diff --git a/src/mobilerun/resources/devices/packages.py b/src/mobilerun/resources/devices/packages.py deleted file mode 100644 index ed3ead4..0000000 --- a/src/mobilerun/resources/devices/packages.py +++ /dev/null @@ -1,195 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional - -import httpx - -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.devices import package_list_params -from ...types.devices.package_list_response import PackageListResponse - -__all__ = ["PackagesResource", "AsyncPackagesResource"] - - -class PackagesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PackagesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return PackagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PackagesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return PackagesResourceWithStreamingResponse(self) - - def list( - self, - device_id: str, - *, - include_system_packages: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Optional[PackageListResponse]: - """ - List packages - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._get( - f"/devices/{device_id}/packages", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - {"include_system_packages": include_system_packages}, package_list_params.PackageListParams - ), - ), - cast_to=PackageListResponse, - ) - - -class AsyncPackagesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPackagesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncPackagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPackagesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AsyncPackagesResourceWithStreamingResponse(self) - - async def list( - self, - device_id: str, - *, - include_system_packages: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Optional[PackageListResponse]: - """ - List packages - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._get( - f"/devices/{device_id}/packages", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"include_system_packages": include_system_packages}, package_list_params.PackageListParams - ), - ), - cast_to=PackageListResponse, - ) - - -class PackagesResourceWithRawResponse: - def __init__(self, packages: PackagesResource) -> None: - self._packages = packages - - self.list = to_raw_response_wrapper( - packages.list, - ) - - -class AsyncPackagesResourceWithRawResponse: - def __init__(self, packages: AsyncPackagesResource) -> None: - self._packages = packages - - self.list = async_to_raw_response_wrapper( - packages.list, - ) - - -class PackagesResourceWithStreamingResponse: - def __init__(self, packages: PackagesResource) -> None: - self._packages = packages - - self.list = to_streamed_response_wrapper( - packages.list, - ) - - -class AsyncPackagesResourceWithStreamingResponse: - def __init__(self, packages: AsyncPackagesResource) -> None: - self._packages = packages - - self.list = async_to_streamed_response_wrapper( - packages.list, - ) diff --git a/src/mobilerun/resources/devices/state.py b/src/mobilerun/resources/devices/state.py deleted file mode 100644 index 10521ea..0000000 --- a/src/mobilerun/resources/devices/state.py +++ /dev/null @@ -1,385 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.devices import state_ui_params, state_screenshot_params -from ...types.devices.state_ui_response import StateUiResponse - -__all__ = ["StateResource", "AsyncStateResource"] - - -class StateResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> StateResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return StateResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> StateResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return StateResourceWithStreamingResponse(self) - - def screenshot( - self, - device_id: str, - *, - hide_overlay: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> str: - """ - Take screenshot - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._get( - f"/devices/{device_id}/screenshot", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"hide_overlay": hide_overlay}, state_screenshot_params.StateScreenshotParams), - ), - cast_to=str, - ) - - def time( - self, - device_id: str, - *, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> str: - """ - Device time - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._get( - f"/devices/{device_id}/time", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=str, - ) - - def ui( - self, - device_id: str, - *, - filter: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StateUiResponse: - """ - UI state - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return self._get( - f"/devices/{device_id}/ui-state", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"filter": filter}, state_ui_params.StateUiParams), - ), - cast_to=StateUiResponse, - ) - - -class AsyncStateResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncStateResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncStateResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncStateResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AsyncStateResourceWithStreamingResponse(self) - - async def screenshot( - self, - device_id: str, - *, - hide_overlay: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> str: - """ - Take screenshot - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._get( - f"/devices/{device_id}/screenshot", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"hide_overlay": hide_overlay}, state_screenshot_params.StateScreenshotParams - ), - ), - cast_to=str, - ) - - async def time( - self, - device_id: str, - *, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> str: - """ - Device time - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._get( - f"/devices/{device_id}/time", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=str, - ) - - async def ui( - self, - device_id: str, - *, - filter: bool | Omit = omit, - x_device_display_id: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StateUiResponse: - """ - UI state - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - extra_headers = { - **strip_not_given( - {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} - ), - **(extra_headers or {}), - } - return await self._get( - f"/devices/{device_id}/ui-state", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"filter": filter}, state_ui_params.StateUiParams), - ), - cast_to=StateUiResponse, - ) - - -class StateResourceWithRawResponse: - def __init__(self, state: StateResource) -> None: - self._state = state - - self.screenshot = to_raw_response_wrapper( - state.screenshot, - ) - self.time = to_raw_response_wrapper( - state.time, - ) - self.ui = to_raw_response_wrapper( - state.ui, - ) - - -class AsyncStateResourceWithRawResponse: - def __init__(self, state: AsyncStateResource) -> None: - self._state = state - - self.screenshot = async_to_raw_response_wrapper( - state.screenshot, - ) - self.time = async_to_raw_response_wrapper( - state.time, - ) - self.ui = async_to_raw_response_wrapper( - state.ui, - ) - - -class StateResourceWithStreamingResponse: - def __init__(self, state: StateResource) -> None: - self._state = state - - self.screenshot = to_streamed_response_wrapper( - state.screenshot, - ) - self.time = to_streamed_response_wrapper( - state.time, - ) - self.ui = to_streamed_response_wrapper( - state.ui, - ) - - -class AsyncStateResourceWithStreamingResponse: - def __init__(self, state: AsyncStateResource) -> None: - self._state = state - - self.screenshot = async_to_streamed_response_wrapper( - state.screenshot, - ) - self.time = async_to_streamed_response_wrapper( - state.time, - ) - self.ui = async_to_streamed_response_wrapper( - state.ui, - ) diff --git a/src/mobilerun/resources/devices/tasks.py b/src/mobilerun/resources/devices/tasks.py deleted file mode 100644 index 69e27f4..0000000 --- a/src/mobilerun/resources/devices/tasks.py +++ /dev/null @@ -1,199 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.devices import task_list_params -from ...types.devices.task_list_response import TaskListResponse - -__all__ = ["TasksResource", "AsyncTasksResource"] - - -class TasksResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TasksResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return TasksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TasksResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return TasksResourceWithStreamingResponse(self) - - def list( - self, - device_id: str, - *, - order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskListResponse: - """ - List tasks for a device - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return self._get( - f"/devices/{device_id}/tasks", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - }, - task_list_params.TaskListParams, - ), - ), - cast_to=TaskListResponse, - ) - - -class AsyncTasksResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncTasksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response - """ - return AsyncTasksResourceWithStreamingResponse(self) - - async def list( - self, - device_id: str, - *, - order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskListResponse: - """ - List tasks for a device - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not device_id: - raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") - return await self._get( - f"/devices/{device_id}/tasks", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - }, - task_list_params.TaskListParams, - ), - ), - cast_to=TaskListResponse, - ) - - -class TasksResourceWithRawResponse: - def __init__(self, tasks: TasksResource) -> None: - self._tasks = tasks - - self.list = to_raw_response_wrapper( - tasks.list, - ) - - -class AsyncTasksResourceWithRawResponse: - def __init__(self, tasks: AsyncTasksResource) -> None: - self._tasks = tasks - - self.list = async_to_raw_response_wrapper( - tasks.list, - ) - - -class TasksResourceWithStreamingResponse: - def __init__(self, tasks: TasksResource) -> None: - self._tasks = tasks - - self.list = to_streamed_response_wrapper( - tasks.list, - ) - - -class AsyncTasksResourceWithStreamingResponse: - def __init__(self, tasks: AsyncTasksResource) -> None: - self._tasks = tasks - - self.list = async_to_streamed_response_wrapper( - tasks.list, - ) diff --git a/src/mobilerun/types/__init__.py b/src/mobilerun/types/__init__.py index 72eddf4..48e9ccc 100644 --- a/src/mobilerun/types/__init__.py +++ b/src/mobilerun/types/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .task import Task as Task -from .device import Device as Device from .llm_model import LlmModel as LlmModel from .task_status import TaskStatus as TaskStatus from .app_list_params import AppListParams as AppListParams @@ -12,15 +11,11 @@ from .task_list_params import TaskListParams as TaskListParams from .app_list_response import AppListResponse as AppListResponse from .task_run_response import TaskRunResponse as TaskRunResponse -from .device_list_params import DeviceListParams as DeviceListParams from .hook_list_response import HookListResponse as HookListResponse from .hook_update_params import HookUpdateParams as HookUpdateParams from .task_list_response import TaskListResponse as TaskListResponse from .task_stop_response import TaskStopResponse as TaskStopResponse -from .device_create_params import DeviceCreateParams as DeviceCreateParams -from .device_list_response import DeviceListResponse as DeviceListResponse from .hook_update_response import HookUpdateResponse as HookUpdateResponse -from .device_count_response import DeviceCountResponse as DeviceCountResponse from .hook_perform_response import HookPerformResponse as HookPerformResponse from .hook_subscribe_params import HookSubscribeParams as HookSubscribeParams from .hook_retrieve_response import HookRetrieveResponse as HookRetrieveResponse diff --git a/src/mobilerun/types/device.py b/src/mobilerun/types/device.py deleted file mode 100644 index 3d570c1..0000000 --- a/src/mobilerun/types/device.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["Device"] - - -class Device(BaseModel): - id: str - - apps: Optional[List[str]] = None - - assigned_at: Optional[datetime] = FieldInfo(alias="assignedAt", default=None) - - country: str - - created_at: datetime = FieldInfo(alias="createdAt") - - device_type: str = FieldInfo(alias="deviceType") - - files: Optional[List[str]] = None - - name: str - - provider: str - - state: str - - state_message: str = FieldInfo(alias="stateMessage") - - stream_token: str = FieldInfo(alias="streamToken") - - stream_url: str = FieldInfo(alias="streamUrl") - - task_count: int = FieldInfo(alias="taskCount") - - updated_at: datetime = FieldInfo(alias="updatedAt") - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" - - user_id: Optional[str] = FieldInfo(alias="userId", default=None) diff --git a/src/mobilerun/types/device_count_response.py b/src/mobilerun/types/device_count_response.py deleted file mode 100644 index 517cdeb..0000000 --- a/src/mobilerun/types/device_count_response.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["DeviceCountResponse"] - - -class DeviceCountResponse(BaseModel): - limrun: int - - personal: int - - remote: int - - roidrun: int - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun/types/device_create_params.py b/src/mobilerun/types/device_create_params.py deleted file mode 100644 index 4134f5a..0000000 --- a/src/mobilerun/types/device_create_params.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import SequenceNotStr -from .._utils import PropertyInfo - -__all__ = ["DeviceCreateParams", "Proxy"] - - -class DeviceCreateParams(TypedDict, total=False): - device_type: Annotated[ - Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"], - PropertyInfo(alias="deviceType"), - ] - - provider: Literal["limrun", "remote", "roidrun"] - - apps: Optional[SequenceNotStr[str]] - - country: str - - files: Optional[SequenceNotStr[str]] - - name: str - - proxy: Proxy - - -class Proxy(TypedDict, total=False): - host: Required[str] - - password: Required[str] - - port: Required[int] - - user: Required[str] diff --git a/src/mobilerun/types/device_list_params.py b/src/mobilerun/types/device_list_params.py deleted file mode 100644 index 48b5c7f..0000000 --- a/src/mobilerun/types/device_list_params.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["DeviceListParams"] - - -class DeviceListParams(TypedDict, total=False): - country: str - - name: str - - order_by: Annotated[Literal["id", "createdAt", "updatedAt", "assignedAt"], PropertyInfo(alias="orderBy")] - - order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] - - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - - provider: Literal["limrun", "personal", "remote", "roidrun"] - - state: Literal["creating", "assigned", "ready", "terminated", "unknown"] - - type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] diff --git a/src/mobilerun/types/device_list_response.py b/src/mobilerun/types/device_list_response.py deleted file mode 100644 index cd6cc01..0000000 --- a/src/mobilerun/types/device_list_response.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from .device import Device -from .._models import BaseModel - -__all__ = ["DeviceListResponse", "Pagination"] - - -class Pagination(BaseModel): - has_next: bool = FieldInfo(alias="hasNext") - - has_prev: bool = FieldInfo(alias="hasPrev") - - page: int - - pages: int - - page_size: int = FieldInfo(alias="pageSize") - - total: int - - -class DeviceListResponse(BaseModel): - items: Optional[List[Device]] = None - - pagination: Pagination - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun/types/devices/__init__.py b/src/mobilerun/types/devices/__init__.py index 6bf3b6f..f8ee8b1 100644 --- a/src/mobilerun/types/devices/__init__.py +++ b/src/mobilerun/types/devices/__init__.py @@ -1,22 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .app_list_params import AppListParams as AppListParams -from .state_ui_params import StateUiParams as StateUiParams -from .app_start_params import AppStartParams as AppStartParams -from .task_list_params import TaskListParams as TaskListParams -from .action_tap_params import ActionTapParams as ActionTapParams -from .app_list_response import AppListResponse as AppListResponse -from .state_ui_response import StateUiResponse as StateUiResponse -from .app_install_params import AppInstallParams as AppInstallParams -from .task_list_response import TaskListResponse as TaskListResponse -from .action_swipe_params import ActionSwipeParams as ActionSwipeParams -from .keyboard_key_params import KeyboardKeyParams as KeyboardKeyParams -from .package_list_params import PackageListParams as PackageListParams -from .state_time_response import StateTimeResponse as StateTimeResponse -from .action_global_params import ActionGlobalParams as ActionGlobalParams -from .keyboard_write_params import KeyboardWriteParams as KeyboardWriteParams -from .package_list_response import PackageListResponse as PackageListResponse -from .state_screenshot_params import StateScreenshotParams as StateScreenshotParams -from .state_screenshot_response import StateScreenshotResponse as StateScreenshotResponse diff --git a/src/mobilerun/types/devices/action_global_params.py b/src/mobilerun/types/devices/action_global_params.py deleted file mode 100644 index a8fca37..0000000 --- a/src/mobilerun/types/devices/action_global_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ActionGlobalParams"] - - -class ActionGlobalParams(TypedDict, total=False): - action: Required[int] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/action_swipe_params.py b/src/mobilerun/types/devices/action_swipe_params.py deleted file mode 100644 index 2f9df10..0000000 --- a/src/mobilerun/types/devices/action_swipe_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ActionSwipeParams"] - - -class ActionSwipeParams(TypedDict, total=False): - duration: Required[int] - """Swipe duration in milliseconds""" - - end_x: Required[Annotated[int, PropertyInfo(alias="endX")]] - - end_y: Required[Annotated[int, PropertyInfo(alias="endY")]] - - start_x: Required[Annotated[int, PropertyInfo(alias="startX")]] - - start_y: Required[Annotated[int, PropertyInfo(alias="startY")]] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/action_tap_params.py b/src/mobilerun/types/devices/action_tap_params.py deleted file mode 100644 index 006f57d..0000000 --- a/src/mobilerun/types/devices/action_tap_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ActionTapParams"] - - -class ActionTapParams(TypedDict, total=False): - x: Required[int] - - y: Required[int] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/app_install_params.py b/src/mobilerun/types/devices/app_install_params.py deleted file mode 100644 index 915231c..0000000 --- a/src/mobilerun/types/devices/app_install_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["AppInstallParams"] - - -class AppInstallParams(TypedDict, total=False): - package_name: Required[Annotated[str, PropertyInfo(alias="packageName")]] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/app_list_params.py b/src/mobilerun/types/devices/app_list_params.py deleted file mode 100644 index 762be54..0000000 --- a/src/mobilerun/types/devices/app_list_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["AppListParams"] - - -class AppListParams(TypedDict, total=False): - include_system_apps: Annotated[bool, PropertyInfo(alias="includeSystemApps")] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/app_list_response.py b/src/mobilerun/types/devices/app_list_response.py deleted file mode 100644 index c8f8f4e..0000000 --- a/src/mobilerun/types/devices/app_list_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["AppListResponse", "AppListResponseItem"] - - -class AppListResponseItem(BaseModel): - is_system_app: bool = FieldInfo(alias="isSystemApp") - - label: str - - package_name: str = FieldInfo(alias="packageName") - - version_code: int = FieldInfo(alias="versionCode") - - version_name: str = FieldInfo(alias="versionName") - - -AppListResponse: TypeAlias = List[AppListResponseItem] diff --git a/src/mobilerun/types/devices/app_start_params.py b/src/mobilerun/types/devices/app_start_params.py deleted file mode 100644 index f5761f1..0000000 --- a/src/mobilerun/types/devices/app_start_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["AppStartParams"] - - -class AppStartParams(TypedDict, total=False): - device_id: Required[Annotated[str, PropertyInfo(alias="deviceId")]] - - activity: str - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/keyboard_key_params.py b/src/mobilerun/types/devices/keyboard_key_params.py deleted file mode 100644 index 85854de..0000000 --- a/src/mobilerun/types/devices/keyboard_key_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["KeyboardKeyParams"] - - -class KeyboardKeyParams(TypedDict, total=False): - key: Required[int] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/keyboard_write_params.py b/src/mobilerun/types/devices/keyboard_write_params.py deleted file mode 100644 index 69b8714..0000000 --- a/src/mobilerun/types/devices/keyboard_write_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["KeyboardWriteParams"] - - -class KeyboardWriteParams(TypedDict, total=False): - clear: Required[bool] - - text: Required[str] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/package_list_params.py b/src/mobilerun/types/devices/package_list_params.py deleted file mode 100644 index 450223e..0000000 --- a/src/mobilerun/types/devices/package_list_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["PackageListParams"] - - -class PackageListParams(TypedDict, total=False): - include_system_packages: Annotated[bool, PropertyInfo(alias="includeSystemPackages")] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/package_list_response.py b/src/mobilerun/types/devices/package_list_response.py deleted file mode 100644 index 0ab9e4b..0000000 --- a/src/mobilerun/types/devices/package_list_response.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -__all__ = ["PackageListResponse"] - -PackageListResponse: TypeAlias = List[str] diff --git a/src/mobilerun/types/devices/state_screenshot_params.py b/src/mobilerun/types/devices/state_screenshot_params.py deleted file mode 100644 index fa4d0bd..0000000 --- a/src/mobilerun/types/devices/state_screenshot_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["StateScreenshotParams"] - - -class StateScreenshotParams(TypedDict, total=False): - hide_overlay: Annotated[bool, PropertyInfo(alias="hideOverlay")] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/state_screenshot_response.py b/src/mobilerun/types/devices/state_screenshot_response.py deleted file mode 100644 index aaa4a93..0000000 --- a/src/mobilerun/types/devices/state_screenshot_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import TypeAlias - -__all__ = ["StateScreenshotResponse"] - -StateScreenshotResponse: TypeAlias = str diff --git a/src/mobilerun/types/devices/state_time_response.py b/src/mobilerun/types/devices/state_time_response.py deleted file mode 100644 index 6aed1eb..0000000 --- a/src/mobilerun/types/devices/state_time_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import TypeAlias - -__all__ = ["StateTimeResponse"] - -StateTimeResponse: TypeAlias = str diff --git a/src/mobilerun/types/devices/state_ui_params.py b/src/mobilerun/types/devices/state_ui_params.py deleted file mode 100644 index de012d2..0000000 --- a/src/mobilerun/types/devices/state_ui_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["StateUiParams"] - - -class StateUiParams(TypedDict, total=False): - filter: bool - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/state_ui_response.py b/src/mobilerun/types/devices/state_ui_response.py deleted file mode 100644 index 5254229..0000000 --- a/src/mobilerun/types/devices/state_ui_response.py +++ /dev/null @@ -1,91 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = [ - "StateUiResponse", - "DeviceContext", - "DeviceContextDisplayMetrics", - "DeviceContextFilteringParams", - "DeviceContextScreenBounds", - "DeviceContextScreenSize", - "PhoneState", - "PhoneStateFocusedElement", -] - - -class DeviceContextDisplayMetrics(BaseModel): - density: float - - density_dpi: int = FieldInfo(alias="densityDpi") - - height_pixels: int = FieldInfo(alias="heightPixels") - - scaled_density: float = FieldInfo(alias="scaledDensity") - - width_pixels: int = FieldInfo(alias="widthPixels") - - -class DeviceContextFilteringParams(BaseModel): - min_element_size: int - - overlay_offset: int - - -class DeviceContextScreenBounds(BaseModel): - height: int - - width: int - - -class DeviceContextScreenSize(BaseModel): - height: int - - width: int - - -class DeviceContext(BaseModel): - display_metrics: DeviceContextDisplayMetrics - - filtering_params: DeviceContextFilteringParams - - screen_bounds: DeviceContextScreenBounds - - screen_size: DeviceContextScreenSize = FieldInfo(alias="screenSize") - - -class PhoneStateFocusedElement(BaseModel): - class_name: Optional[str] = FieldInfo(alias="className", default=None) - - resource_id: Optional[str] = FieldInfo(alias="resourceId", default=None) - - text: Optional[str] = None - - -class PhoneState(BaseModel): - is_editable: bool = FieldInfo(alias="isEditable") - - keyboard_visible: bool = FieldInfo(alias="keyboardVisible") - - activity_name: Optional[str] = FieldInfo(alias="activityName", default=None) - - current_app: Optional[str] = FieldInfo(alias="currentApp", default=None) - - focused_element: Optional[PhoneStateFocusedElement] = FieldInfo(alias="focusedElement", default=None) - - package_name: Optional[str] = FieldInfo(alias="packageName", default=None) - - -class StateUiResponse(BaseModel): - a11y_tree: object - - device_context: DeviceContext - - phone_state: PhoneState - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun/types/devices/task_list_params.py b/src/mobilerun/types/devices/task_list_params.py deleted file mode 100644 index 6c98a67..0000000 --- a/src/mobilerun/types/devices/task_list_params.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["TaskListParams"] - - -class TaskListParams(TypedDict, total=False): - order_by: Annotated[Literal["id", "createdAt", "updatedAt", "assignedAt"], PropertyInfo(alias="orderBy")] - - order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] - - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] diff --git a/src/mobilerun/types/devices/task_list_response.py b/src/mobilerun/types/devices/task_list_response.py deleted file mode 100644 index a767345..0000000 --- a/src/mobilerun/types/devices/task_list_response.py +++ /dev/null @@ -1,41 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["TaskListResponse", "Item", "Pagination"] - - -class Item(BaseModel): - created_at: datetime = FieldInfo(alias="createdAt") - - task_id: str = FieldInfo(alias="taskId") - - updated_at: datetime = FieldInfo(alias="updatedAt") - - -class Pagination(BaseModel): - has_next: bool = FieldInfo(alias="hasNext") - - has_prev: bool = FieldInfo(alias="hasPrev") - - page: int - - pages: int - - page_size: int = FieldInfo(alias="pageSize") - - total: int - - -class TaskListResponse(BaseModel): - items: Optional[List[Item]] = None - - pagination: Pagination - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/tests/api_resources/devices/__init__.py b/tests/api_resources/devices/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/devices/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/devices/test_actions.py b/tests/api_resources/devices/test_actions.py deleted file mode 100644 index dec3120..0000000 --- a/tests/api_resources/devices/test_actions.py +++ /dev/null @@ -1,408 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from mobilerun import Mobilerun, AsyncMobilerun - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestActions: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_global(self, client: Mobilerun) -> None: - action = client.devices.actions.global_( - device_id="deviceId", - action=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_global_with_all_params(self, client: Mobilerun) -> None: - action = client.devices.actions.global_( - device_id="deviceId", - action=0, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_global(self, client: Mobilerun) -> None: - response = client.devices.actions.with_raw_response.global_( - device_id="deviceId", - action=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_global(self, client: Mobilerun) -> None: - with client.devices.actions.with_streaming_response.global_( - device_id="deviceId", - action=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert action is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_global(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.actions.with_raw_response.global_( - device_id="", - action=0, - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_swipe(self, client: Mobilerun) -> None: - action = client.devices.actions.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_swipe_with_all_params(self, client: Mobilerun) -> None: - action = client.devices.actions.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_swipe(self, client: Mobilerun) -> None: - response = client.devices.actions.with_raw_response.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_swipe(self, client: Mobilerun) -> None: - with client.devices.actions.with_streaming_response.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert action is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_swipe(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.actions.with_raw_response.swipe( - device_id="", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_tap(self, client: Mobilerun) -> None: - action = client.devices.actions.tap( - device_id="deviceId", - x=0, - y=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_tap_with_all_params(self, client: Mobilerun) -> None: - action = client.devices.actions.tap( - device_id="deviceId", - x=0, - y=0, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_tap(self, client: Mobilerun) -> None: - response = client.devices.actions.with_raw_response.tap( - device_id="deviceId", - x=0, - y=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_tap(self, client: Mobilerun) -> None: - with client.devices.actions.with_streaming_response.tap( - device_id="deviceId", - x=0, - y=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert action is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_tap(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.actions.with_raw_response.tap( - device_id="", - x=0, - y=0, - ) - - -class TestAsyncActions: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_global(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.global_( - device_id="deviceId", - action=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_global_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.global_( - device_id="deviceId", - action=0, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_global(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.actions.with_raw_response.global_( - device_id="deviceId", - action=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_global(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.actions.with_streaming_response.global_( - device_id="deviceId", - action=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert action is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_global(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.actions.with_raw_response.global_( - device_id="", - action=0, - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_swipe(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_swipe_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_swipe(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.actions.with_raw_response.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_swipe(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.actions.with_streaming_response.swipe( - device_id="deviceId", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert action is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_swipe(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.actions.with_raw_response.swipe( - device_id="", - duration=10, - end_x=0, - end_y=0, - start_x=0, - start_y=0, - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_tap(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.tap( - device_id="deviceId", - x=0, - y=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_tap_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.tap( - device_id="deviceId", - x=0, - y=0, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_tap(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.actions.with_raw_response.tap( - device_id="deviceId", - x=0, - y=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert action is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_tap(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.actions.with_streaming_response.tap( - device_id="deviceId", - x=0, - y=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert action is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_tap(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.actions.with_raw_response.tap( - device_id="", - x=0, - y=0, - ) diff --git a/tests/api_resources/devices/test_apps.py b/tests/api_resources/devices/test_apps.py deleted file mode 100644 index 6469d82..0000000 --- a/tests/api_resources/devices/test_apps.py +++ /dev/null @@ -1,490 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from mobilerun import Mobilerun, AsyncMobilerun -from tests.utils import assert_matches_type -from mobilerun.types.devices import AppListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestApps: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - app = client.devices.apps.list( - device_id="deviceId", - ) - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - app = client.devices.apps.list( - device_id="deviceId", - include_system_apps=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.devices.apps.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = response.parse() - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.devices.apps.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = response.parse() - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_list(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.apps.with_raw_response.list( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_delete(self, client: Mobilerun) -> None: - app = client.devices.apps.delete( - package_name="packageName", - device_id="deviceId", - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_delete_with_all_params(self, client: Mobilerun) -> None: - app = client.devices.apps.delete( - package_name="packageName", - device_id="deviceId", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_delete(self, client: Mobilerun) -> None: - response = client.devices.apps.with_raw_response.delete( - package_name="packageName", - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = response.parse() - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_delete(self, client: Mobilerun) -> None: - with client.devices.apps.with_streaming_response.delete( - package_name="packageName", - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = response.parse() - assert app is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_delete(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.apps.with_raw_response.delete( - package_name="packageName", - device_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): - client.devices.apps.with_raw_response.delete( - package_name="", - device_id="deviceId", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_install(self, client: Mobilerun) -> None: - app = client.devices.apps.install( - device_id="deviceId", - package_name="packageName", - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_install_with_all_params(self, client: Mobilerun) -> None: - app = client.devices.apps.install( - device_id="deviceId", - package_name="packageName", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_install(self, client: Mobilerun) -> None: - response = client.devices.apps.with_raw_response.install( - device_id="deviceId", - package_name="packageName", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = response.parse() - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_install(self, client: Mobilerun) -> None: - with client.devices.apps.with_streaming_response.install( - device_id="deviceId", - package_name="packageName", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = response.parse() - assert app is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_install(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.apps.with_raw_response.install( - device_id="", - package_name="packageName", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_start(self, client: Mobilerun) -> None: - app = client.devices.apps.start( - package_name="packageName", - device_id="deviceId", - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_start_with_all_params(self, client: Mobilerun) -> None: - app = client.devices.apps.start( - package_name="packageName", - device_id="deviceId", - activity="activity", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_start(self, client: Mobilerun) -> None: - response = client.devices.apps.with_raw_response.start( - package_name="packageName", - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = response.parse() - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_start(self, client: Mobilerun) -> None: - with client.devices.apps.with_streaming_response.start( - package_name="packageName", - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = response.parse() - assert app is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_start(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.apps.with_raw_response.start( - package_name="packageName", - device_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): - client.devices.apps.with_raw_response.start( - package_name="", - device_id="deviceId", - ) - - -class TestAsyncApps: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.list( - device_id="deviceId", - ) - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.list( - device_id="deviceId", - include_system_apps=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.apps.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = await response.parse() - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.apps.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = await response.parse() - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_list(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.apps.with_raw_response.list( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_delete(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.delete( - package_name="packageName", - device_id="deviceId", - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.delete( - package_name="packageName", - device_id="deviceId", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.apps.with_raw_response.delete( - package_name="packageName", - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = await response.parse() - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.apps.with_streaming_response.delete( - package_name="packageName", - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = await response.parse() - assert app is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_delete(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.apps.with_raw_response.delete( - package_name="packageName", - device_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): - await async_client.devices.apps.with_raw_response.delete( - package_name="", - device_id="deviceId", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_install(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.install( - device_id="deviceId", - package_name="packageName", - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_install_with_all_params(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.install( - device_id="deviceId", - package_name="packageName", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_install(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.apps.with_raw_response.install( - device_id="deviceId", - package_name="packageName", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = await response.parse() - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_install(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.apps.with_streaming_response.install( - device_id="deviceId", - package_name="packageName", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = await response.parse() - assert app is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_install(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.apps.with_raw_response.install( - device_id="", - package_name="packageName", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_start(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.start( - package_name="packageName", - device_id="deviceId", - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_start_with_all_params(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.start( - package_name="packageName", - device_id="deviceId", - activity="activity", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_start(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.apps.with_raw_response.start( - package_name="packageName", - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = await response.parse() - assert app is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_start(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.apps.with_streaming_response.start( - package_name="packageName", - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = await response.parse() - assert app is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_start(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.apps.with_raw_response.start( - package_name="packageName", - device_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): - await async_client.devices.apps.with_raw_response.start( - package_name="", - device_id="deviceId", - ) diff --git a/tests/api_resources/devices/test_keyboard.py b/tests/api_resources/devices/test_keyboard.py deleted file mode 100644 index 0b329c3..0000000 --- a/tests/api_resources/devices/test_keyboard.py +++ /dev/null @@ -1,358 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from mobilerun import Mobilerun, AsyncMobilerun - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestKeyboard: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_clear(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.clear( - device_id="deviceId", - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_clear_with_all_params(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.clear( - device_id="deviceId", - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_clear(self, client: Mobilerun) -> None: - response = client.devices.keyboard.with_raw_response.clear( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - keyboard = response.parse() - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_clear(self, client: Mobilerun) -> None: - with client.devices.keyboard.with_streaming_response.clear( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - keyboard = response.parse() - assert keyboard is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_clear(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.keyboard.with_raw_response.clear( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_key(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.key( - device_id="deviceId", - key=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_key_with_all_params(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.key( - device_id="deviceId", - key=0, - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_key(self, client: Mobilerun) -> None: - response = client.devices.keyboard.with_raw_response.key( - device_id="deviceId", - key=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - keyboard = response.parse() - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_key(self, client: Mobilerun) -> None: - with client.devices.keyboard.with_streaming_response.key( - device_id="deviceId", - key=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - keyboard = response.parse() - assert keyboard is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_key(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.keyboard.with_raw_response.key( - device_id="", - key=0, - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_write(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.write( - device_id="deviceId", - clear=True, - text="text", - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_write_with_all_params(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.write( - device_id="deviceId", - clear=True, - text="text", - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_write(self, client: Mobilerun) -> None: - response = client.devices.keyboard.with_raw_response.write( - device_id="deviceId", - clear=True, - text="text", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - keyboard = response.parse() - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_write(self, client: Mobilerun) -> None: - with client.devices.keyboard.with_streaming_response.write( - device_id="deviceId", - clear=True, - text="text", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - keyboard = response.parse() - assert keyboard is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_write(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.keyboard.with_raw_response.write( - device_id="", - clear=True, - text="text", - ) - - -class TestAsyncKeyboard: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_clear(self, async_client: AsyncMobilerun) -> None: - keyboard = await async_client.devices.keyboard.clear( - device_id="deviceId", - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_clear_with_all_params(self, async_client: AsyncMobilerun) -> None: - keyboard = await async_client.devices.keyboard.clear( - device_id="deviceId", - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_clear(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.keyboard.with_raw_response.clear( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - keyboard = await response.parse() - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_clear(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.keyboard.with_streaming_response.clear( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - keyboard = await response.parse() - assert keyboard is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_clear(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.keyboard.with_raw_response.clear( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_key(self, async_client: AsyncMobilerun) -> None: - keyboard = await async_client.devices.keyboard.key( - device_id="deviceId", - key=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_key_with_all_params(self, async_client: AsyncMobilerun) -> None: - keyboard = await async_client.devices.keyboard.key( - device_id="deviceId", - key=0, - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_key(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.keyboard.with_raw_response.key( - device_id="deviceId", - key=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - keyboard = await response.parse() - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_key(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.keyboard.with_streaming_response.key( - device_id="deviceId", - key=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - keyboard = await response.parse() - assert keyboard is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_key(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.keyboard.with_raw_response.key( - device_id="", - key=0, - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_write(self, async_client: AsyncMobilerun) -> None: - keyboard = await async_client.devices.keyboard.write( - device_id="deviceId", - clear=True, - text="text", - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_write_with_all_params(self, async_client: AsyncMobilerun) -> None: - keyboard = await async_client.devices.keyboard.write( - device_id="deviceId", - clear=True, - text="text", - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_write(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.keyboard.with_raw_response.write( - device_id="deviceId", - clear=True, - text="text", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - keyboard = await response.parse() - assert keyboard is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_write(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.keyboard.with_streaming_response.write( - device_id="deviceId", - clear=True, - text="text", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - keyboard = await response.parse() - assert keyboard is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_write(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.keyboard.with_raw_response.write( - device_id="", - clear=True, - text="text", - ) diff --git a/tests/api_resources/devices/test_packages.py b/tests/api_resources/devices/test_packages.py deleted file mode 100644 index 1a02296..0000000 --- a/tests/api_resources/devices/test_packages.py +++ /dev/null @@ -1,128 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from mobilerun import Mobilerun, AsyncMobilerun -from tests.utils import assert_matches_type -from mobilerun.types.devices import PackageListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPackages: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - package = client.devices.packages.list( - device_id="deviceId", - ) - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - package = client.devices.packages.list( - device_id="deviceId", - include_system_packages=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.devices.packages.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - package = response.parse() - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.devices.packages.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - package = response.parse() - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_list(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.packages.with_raw_response.list( - device_id="", - ) - - -class TestAsyncPackages: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - package = await async_client.devices.packages.list( - device_id="deviceId", - ) - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - package = await async_client.devices.packages.list( - device_id="deviceId", - include_system_packages=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.packages.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - package = await response.parse() - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.packages.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - package = await response.parse() - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_list(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.packages.with_raw_response.list( - device_id="", - ) diff --git a/tests/api_resources/devices/test_state.py b/tests/api_resources/devices/test_state.py deleted file mode 100644 index 27879b7..0000000 --- a/tests/api_resources/devices/test_state.py +++ /dev/null @@ -1,336 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from mobilerun import Mobilerun, AsyncMobilerun -from tests.utils import assert_matches_type -from mobilerun.types.devices import ( - StateUiResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestState: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_screenshot(self, client: Mobilerun) -> None: - state = client.devices.state.screenshot( - device_id="deviceId", - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_screenshot_with_all_params(self, client: Mobilerun) -> None: - state = client.devices.state.screenshot( - device_id="deviceId", - hide_overlay=True, - x_device_display_id=0, - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_screenshot(self, client: Mobilerun) -> None: - response = client.devices.state.with_raw_response.screenshot( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = response.parse() - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_screenshot(self, client: Mobilerun) -> None: - with client.devices.state.with_streaming_response.screenshot( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = response.parse() - assert_matches_type(str, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_screenshot(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.state.with_raw_response.screenshot( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_time(self, client: Mobilerun) -> None: - state = client.devices.state.time( - device_id="deviceId", - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_time_with_all_params(self, client: Mobilerun) -> None: - state = client.devices.state.time( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_time(self, client: Mobilerun) -> None: - response = client.devices.state.with_raw_response.time( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = response.parse() - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_time(self, client: Mobilerun) -> None: - with client.devices.state.with_streaming_response.time( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = response.parse() - assert_matches_type(str, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_time(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.state.with_raw_response.time( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_ui(self, client: Mobilerun) -> None: - state = client.devices.state.ui( - device_id="deviceId", - ) - assert_matches_type(StateUiResponse, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_ui_with_all_params(self, client: Mobilerun) -> None: - state = client.devices.state.ui( - device_id="deviceId", - filter=True, - x_device_display_id=0, - ) - assert_matches_type(StateUiResponse, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_ui(self, client: Mobilerun) -> None: - response = client.devices.state.with_raw_response.ui( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = response.parse() - assert_matches_type(StateUiResponse, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_ui(self, client: Mobilerun) -> None: - with client.devices.state.with_streaming_response.ui( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = response.parse() - assert_matches_type(StateUiResponse, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_ui(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.state.with_raw_response.ui( - device_id="", - ) - - -class TestAsyncState: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_screenshot(self, async_client: AsyncMobilerun) -> None: - state = await async_client.devices.state.screenshot( - device_id="deviceId", - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_screenshot_with_all_params(self, async_client: AsyncMobilerun) -> None: - state = await async_client.devices.state.screenshot( - device_id="deviceId", - hide_overlay=True, - x_device_display_id=0, - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_screenshot(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.state.with_raw_response.screenshot( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = await response.parse() - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_screenshot(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.state.with_streaming_response.screenshot( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = await response.parse() - assert_matches_type(str, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_screenshot(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.state.with_raw_response.screenshot( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_time(self, async_client: AsyncMobilerun) -> None: - state = await async_client.devices.state.time( - device_id="deviceId", - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_time_with_all_params(self, async_client: AsyncMobilerun) -> None: - state = await async_client.devices.state.time( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_time(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.state.with_raw_response.time( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = await response.parse() - assert_matches_type(str, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_time(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.state.with_streaming_response.time( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = await response.parse() - assert_matches_type(str, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_time(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.state.with_raw_response.time( - device_id="", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_ui(self, async_client: AsyncMobilerun) -> None: - state = await async_client.devices.state.ui( - device_id="deviceId", - ) - assert_matches_type(StateUiResponse, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_ui_with_all_params(self, async_client: AsyncMobilerun) -> None: - state = await async_client.devices.state.ui( - device_id="deviceId", - filter=True, - x_device_display_id=0, - ) - assert_matches_type(StateUiResponse, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_ui(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.state.with_raw_response.ui( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = await response.parse() - assert_matches_type(StateUiResponse, state, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_ui(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.state.with_streaming_response.ui( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = await response.parse() - assert_matches_type(StateUiResponse, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_ui(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.state.with_raw_response.ui( - device_id="", - ) diff --git a/tests/api_resources/devices/test_tasks.py b/tests/api_resources/devices/test_tasks.py deleted file mode 100644 index 0b41b32..0000000 --- a/tests/api_resources/devices/test_tasks.py +++ /dev/null @@ -1,132 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from mobilerun import Mobilerun, AsyncMobilerun -from tests.utils import assert_matches_type -from mobilerun.types.devices import TaskListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTasks: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - task = client.devices.tasks.list( - device_id="deviceId", - ) - assert_matches_type(TaskListResponse, task, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - task = client.devices.tasks.list( - device_id="deviceId", - order_by="id", - order_by_direction="asc", - page=0, - page_size=0, - ) - assert_matches_type(TaskListResponse, task, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.devices.tasks.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - task = response.parse() - assert_matches_type(TaskListResponse, task, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.devices.tasks.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - task = response.parse() - assert_matches_type(TaskListResponse, task, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_list(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.tasks.with_raw_response.list( - device_id="", - ) - - -class TestAsyncTasks: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - task = await async_client.devices.tasks.list( - device_id="deviceId", - ) - assert_matches_type(TaskListResponse, task, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - task = await async_client.devices.tasks.list( - device_id="deviceId", - order_by="id", - order_by_direction="asc", - page=0, - page_size=0, - ) - assert_matches_type(TaskListResponse, task, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.tasks.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - task = await response.parse() - assert_matches_type(TaskListResponse, task, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.tasks.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - task = await response.parse() - assert_matches_type(TaskListResponse, task, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_list(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.tasks.with_raw_response.list( - device_id="", - ) diff --git a/tests/api_resources/test_devices.py b/tests/api_resources/test_devices.py deleted file mode 100644 index f762064..0000000 --- a/tests/api_resources/test_devices.py +++ /dev/null @@ -1,514 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from mobilerun import Mobilerun, AsyncMobilerun -from tests.utils import assert_matches_type -from mobilerun.types import Device, DeviceListResponse, DeviceCountResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDevices: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_create(self, client: Mobilerun) -> None: - device = client.devices.create() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_create_with_all_params(self, client: Mobilerun) -> None: - device = client.devices.create( - device_type="device_slot", - provider="limrun", - apps=["string"], - country="country", - files=["string"], - name="name", - proxy={ - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_create(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = response.parse() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_create(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = response.parse() - assert_matches_type(Device, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - device = client.devices.retrieve( - "deviceId", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.retrieve( - "deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = response.parse() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.retrieve( - "deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = response.parse() - assert_matches_type(Device, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_retrieve(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - device = client.devices.list() - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - device = client.devices.list( - country="country", - name="name", - order_by="id", - order_by_direction="asc", - page=0, - page_size=0, - provider="limrun", - state="creating", - type="device_slot", - ) - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = response.parse() - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = response.parse() - assert_matches_type(DeviceListResponse, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_count(self, client: Mobilerun) -> None: - device = client.devices.count() - assert_matches_type(DeviceCountResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_count(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.count() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = response.parse() - assert_matches_type(DeviceCountResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_count(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.count() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = response.parse() - assert_matches_type(DeviceCountResponse, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_terminate(self, client: Mobilerun) -> None: - device = client.devices.terminate( - "deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_terminate(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.terminate( - "deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = response.parse() - assert device is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_terminate(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.terminate( - "deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = response.parse() - assert device is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_terminate(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.with_raw_response.terminate( - "", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_method_wait_ready(self, client: Mobilerun) -> None: - device = client.devices.wait_ready( - "deviceId", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_raw_response_wait_ready(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.wait_ready( - "deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = response.parse() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_streaming_response_wait_ready(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.wait_ready( - "deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = response.parse() - assert_matches_type(Device, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - def test_path_params_wait_ready(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.with_raw_response.wait_ready( - "", - ) - - -class TestAsyncDevices: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_create(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.create() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.create( - device_type="device_slot", - provider="limrun", - apps=["string"], - country="country", - files=["string"], - name="name", - proxy={ - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = await response.parse() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = await response.parse() - assert_matches_type(Device, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.retrieve( - "deviceId", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.retrieve( - "deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = await response.parse() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.retrieve( - "deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = await response.parse() - assert_matches_type(Device, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.list() - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.list( - country="country", - name="name", - order_by="id", - order_by_direction="asc", - page=0, - page_size=0, - provider="limrun", - state="creating", - type="device_slot", - ) - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = await response.parse() - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = await response.parse() - assert_matches_type(DeviceListResponse, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_count(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.count() - assert_matches_type(DeviceCountResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_count(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.count() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = await response.parse() - assert_matches_type(DeviceCountResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_count(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.count() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = await response.parse() - assert_matches_type(DeviceCountResponse, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_terminate(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.terminate( - "deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_terminate(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.terminate( - "deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = await response.parse() - assert device is None - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_terminate(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.terminate( - "deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = await response.parse() - assert device is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_terminate(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.with_raw_response.terminate( - "", - ) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_method_wait_ready(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.wait_ready( - "deviceId", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_raw_response_wait_ready(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.wait_ready( - "deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = await response.parse() - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_streaming_response_wait_ready(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.wait_ready( - "deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = await response.parse() - assert_matches_type(Device, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are disabled") - @parametrize - async def test_path_params_wait_ready(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - await async_client.devices.with_raw_response.wait_ready( - "", - ) From 866c20ec6ebd177c861777fee900259186347ef0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 14:53:37 +0000 Subject: [PATCH 4/9] feat(api): api update --- .stats.yml | 6 +- README.md | 20 + api.md | 86 ++ src/mobilerun/_client.py | 39 +- src/mobilerun/resources/__init__.py | 14 + src/mobilerun/resources/devices/__init__.py | 103 +++ src/mobilerun/resources/devices/actions.py | 424 +++++++++ src/mobilerun/resources/devices/apps.py | 495 +++++++++++ src/mobilerun/resources/devices/devices.py | 820 ++++++++++++++++++ src/mobilerun/resources/devices/keyboard.py | 390 +++++++++ src/mobilerun/resources/devices/packages.py | 195 +++++ src/mobilerun/resources/devices/state.py | 385 ++++++++ src/mobilerun/resources/devices/tasks.py | 199 +++++ src/mobilerun/types/__init__.py | 5 + src/mobilerun/types/device.py | 47 + src/mobilerun/types/device_count_response.py | 22 + src/mobilerun/types/device_create_params.py | 40 + src/mobilerun/types/device_list_params.py | 29 + src/mobilerun/types/device_list_response.py | 33 + src/mobilerun/types/devices/__init__.py | 19 + .../types/devices/action_global_params.py | 15 + .../types/devices/action_swipe_params.py | 24 + .../types/devices/action_tap_params.py | 17 + .../types/devices/app_install_params.py | 15 + .../types/devices/app_list_params.py | 15 + .../types/devices/app_list_response.py | 25 + .../types/devices/app_start_params.py | 17 + .../types/devices/keyboard_key_params.py | 15 + .../types/devices/keyboard_write_params.py | 17 + .../types/devices/package_list_params.py | 15 + .../types/devices/package_list_response.py | 8 + .../types/devices/state_screenshot_params.py | 15 + .../devices/state_screenshot_response.py | 7 + .../types/devices/state_time_response.py | 7 + .../types/devices/state_ui_params.py | 15 + .../types/devices/state_ui_response.py | 91 ++ .../types/devices/task_list_params.py | 19 + .../types/devices/task_list_response.py | 41 + tests/api_resources/devices/__init__.py | 1 + tests/api_resources/devices/test_actions.py | 408 +++++++++ tests/api_resources/devices/test_apps.py | 490 +++++++++++ tests/api_resources/devices/test_keyboard.py | 358 ++++++++ tests/api_resources/devices/test_packages.py | 128 +++ tests/api_resources/devices/test_state.py | 336 +++++++ tests/api_resources/devices/test_tasks.py | 132 +++ tests/api_resources/test_devices.py | 514 +++++++++++ 46 files changed, 6112 insertions(+), 4 deletions(-) create mode 100644 src/mobilerun/resources/devices/__init__.py create mode 100644 src/mobilerun/resources/devices/actions.py create mode 100644 src/mobilerun/resources/devices/apps.py create mode 100644 src/mobilerun/resources/devices/devices.py create mode 100644 src/mobilerun/resources/devices/keyboard.py create mode 100644 src/mobilerun/resources/devices/packages.py create mode 100644 src/mobilerun/resources/devices/state.py create mode 100644 src/mobilerun/resources/devices/tasks.py create mode 100644 src/mobilerun/types/device.py create mode 100644 src/mobilerun/types/device_count_response.py create mode 100644 src/mobilerun/types/device_create_params.py create mode 100644 src/mobilerun/types/device_list_params.py create mode 100644 src/mobilerun/types/device_list_response.py create mode 100644 src/mobilerun/types/devices/action_global_params.py create mode 100644 src/mobilerun/types/devices/action_swipe_params.py create mode 100644 src/mobilerun/types/devices/action_tap_params.py create mode 100644 src/mobilerun/types/devices/app_install_params.py create mode 100644 src/mobilerun/types/devices/app_list_params.py create mode 100644 src/mobilerun/types/devices/app_list_response.py create mode 100644 src/mobilerun/types/devices/app_start_params.py create mode 100644 src/mobilerun/types/devices/keyboard_key_params.py create mode 100644 src/mobilerun/types/devices/keyboard_write_params.py create mode 100644 src/mobilerun/types/devices/package_list_params.py create mode 100644 src/mobilerun/types/devices/package_list_response.py create mode 100644 src/mobilerun/types/devices/state_screenshot_params.py create mode 100644 src/mobilerun/types/devices/state_screenshot_response.py create mode 100644 src/mobilerun/types/devices/state_time_response.py create mode 100644 src/mobilerun/types/devices/state_ui_params.py create mode 100644 src/mobilerun/types/devices/state_ui_response.py create mode 100644 src/mobilerun/types/devices/task_list_params.py create mode 100644 src/mobilerun/types/devices/task_list_response.py create mode 100644 tests/api_resources/devices/__init__.py create mode 100644 tests/api_resources/devices/test_actions.py create mode 100644 tests/api_resources/devices/test_apps.py create mode 100644 tests/api_resources/devices/test_keyboard.py create mode 100644 tests/api_resources/devices/test_packages.py create mode 100644 tests/api_resources/devices/test_state.py create mode 100644 tests/api_resources/devices/test_tasks.py create mode 100644 tests/api_resources/test_devices.py diff --git a/.stats.yml b/.stats.yml index d703f41..abeefba 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-9bc196694afd948cfd36c21c4779815df718b41928ded5b93760f4d6afa853ef.yml -openapi_spec_hash: dd56ae43482890faf056c390294ecff5 +configured_endpoints: 50 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-b3dca99ca43851c1e9adbb78ad6a8a5841cf0b559bf66663c947c41e8635901e.yml +openapi_spec_hash: 50964e3f8e40873dcb0a768a7fdf855d config_hash: d1f61f26938ee3af50fa5f703318307d diff --git a/README.md b/README.md index 84c1f14..0eece63 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,26 @@ 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 mobilerun import Mobilerun + +client = Mobilerun() + +device = client.devices.create( + proxy={ + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, +) +print(device.proxy) +``` + ## 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 `mobilerun.APIConnectionError` is raised. diff --git a/api.md b/api.md index f518023..0d58a6a 100644 --- a/api.md +++ b/api.md @@ -54,6 +54,92 @@ Methods: - client.tasks.ui_states.retrieve(index, \*, task_id) -> MediaResponse - client.tasks.ui_states.list(task_id) -> UiStateListResponse +# Devices + +Types: + +```python +from mobilerun.types import Device, DeviceListResponse, DeviceCountResponse +``` + +Methods: + +- client.devices.create(\*\*params) -> Device +- client.devices.retrieve(device_id) -> Device +- client.devices.list(\*\*params) -> DeviceListResponse +- client.devices.count() -> DeviceCountResponse +- client.devices.terminate(device_id) -> None +- client.devices.wait_ready(device_id) -> Device + +## Actions + +Methods: + +- client.devices.actions.global\_(device_id, \*\*params) -> None +- client.devices.actions.swipe(device_id, \*\*params) -> None +- client.devices.actions.tap(device_id, \*\*params) -> None + +## State + +Types: + +```python +from mobilerun.types.devices import StateScreenshotResponse, StateTimeResponse, StateUiResponse +``` + +Methods: + +- client.devices.state.screenshot(device_id, \*\*params) -> str +- client.devices.state.time(device_id) -> str +- client.devices.state.ui(device_id, \*\*params) -> StateUiResponse + +## Apps + +Types: + +```python +from mobilerun.types.devices import AppListResponse +``` + +Methods: + +- client.devices.apps.list(device_id, \*\*params) -> Optional[AppListResponse] +- client.devices.apps.delete(package_name, \*, device_id) -> None +- client.devices.apps.install(device_id, \*\*params) -> None +- client.devices.apps.start(package_name, \*, device_id, \*\*params) -> None + +## Packages + +Types: + +```python +from mobilerun.types.devices import PackageListResponse +``` + +Methods: + +- client.devices.packages.list(device_id, \*\*params) -> Optional[PackageListResponse] + +## Keyboard + +Methods: + +- client.devices.keyboard.clear(device_id) -> None +- client.devices.keyboard.key(device_id, \*\*params) -> None +- client.devices.keyboard.write(device_id, \*\*params) -> None + +## Tasks + +Types: + +```python +from mobilerun.types.devices import TaskListResponse +``` + +Methods: + +- client.devices.tasks.list(device_id, \*\*params) -> TaskListResponse + # Apps Types: diff --git a/src/mobilerun/_client.py b/src/mobilerun/_client.py index 271bb95..dd728b1 100644 --- a/src/mobilerun/_client.py +++ b/src/mobilerun/_client.py @@ -32,10 +32,11 @@ ) if TYPE_CHECKING: - from .resources import apps, hooks, tasks, credentials + from .resources import apps, hooks, tasks, devices, credentials from .resources.apps import AppsResource, AsyncAppsResource from .resources.hooks import HooksResource, AsyncHooksResource from .resources.tasks.tasks import TasksResource, AsyncTasksResource + from .resources.devices.devices import DevicesResource, AsyncDevicesResource from .resources.credentials.credentials import CredentialsResource, AsyncCredentialsResource __all__ = [ @@ -107,6 +108,12 @@ def tasks(self) -> TasksResource: return TasksResource(self) + @cached_property + def devices(self) -> DevicesResource: + from .resources.devices import DevicesResource + + return DevicesResource(self) + @cached_property def apps(self) -> AppsResource: from .resources.apps import AppsResource @@ -306,6 +313,12 @@ def tasks(self) -> AsyncTasksResource: return AsyncTasksResource(self) + @cached_property + def devices(self) -> AsyncDevicesResource: + from .resources.devices import AsyncDevicesResource + + return AsyncDevicesResource(self) + @cached_property def apps(self) -> AsyncAppsResource: from .resources.apps import AsyncAppsResource @@ -460,6 +473,12 @@ def tasks(self) -> tasks.TasksResourceWithRawResponse: return TasksResourceWithRawResponse(self._client.tasks) + @cached_property + def devices(self) -> devices.DevicesResourceWithRawResponse: + from .resources.devices import DevicesResourceWithRawResponse + + return DevicesResourceWithRawResponse(self._client.devices) + @cached_property def apps(self) -> apps.AppsResourceWithRawResponse: from .resources.apps import AppsResourceWithRawResponse @@ -491,6 +510,12 @@ def tasks(self) -> tasks.AsyncTasksResourceWithRawResponse: return AsyncTasksResourceWithRawResponse(self._client.tasks) + @cached_property + def devices(self) -> devices.AsyncDevicesResourceWithRawResponse: + from .resources.devices import AsyncDevicesResourceWithRawResponse + + return AsyncDevicesResourceWithRawResponse(self._client.devices) + @cached_property def apps(self) -> apps.AsyncAppsResourceWithRawResponse: from .resources.apps import AsyncAppsResourceWithRawResponse @@ -522,6 +547,12 @@ def tasks(self) -> tasks.TasksResourceWithStreamingResponse: return TasksResourceWithStreamingResponse(self._client.tasks) + @cached_property + def devices(self) -> devices.DevicesResourceWithStreamingResponse: + from .resources.devices import DevicesResourceWithStreamingResponse + + return DevicesResourceWithStreamingResponse(self._client.devices) + @cached_property def apps(self) -> apps.AppsResourceWithStreamingResponse: from .resources.apps import AppsResourceWithStreamingResponse @@ -553,6 +584,12 @@ def tasks(self) -> tasks.AsyncTasksResourceWithStreamingResponse: return AsyncTasksResourceWithStreamingResponse(self._client.tasks) + @cached_property + def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse: + from .resources.devices import AsyncDevicesResourceWithStreamingResponse + + return AsyncDevicesResourceWithStreamingResponse(self._client.devices) + @cached_property def apps(self) -> apps.AsyncAppsResourceWithStreamingResponse: from .resources.apps import AsyncAppsResourceWithStreamingResponse diff --git a/src/mobilerun/resources/__init__.py b/src/mobilerun/resources/__init__.py index 9204f81..c65175f 100644 --- a/src/mobilerun/resources/__init__.py +++ b/src/mobilerun/resources/__init__.py @@ -24,6 +24,14 @@ TasksResourceWithStreamingResponse, AsyncTasksResourceWithStreamingResponse, ) +from .devices import ( + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, +) from .credentials import ( CredentialsResource, AsyncCredentialsResource, @@ -40,6 +48,12 @@ "AsyncTasksResourceWithRawResponse", "TasksResourceWithStreamingResponse", "AsyncTasksResourceWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", "AppsResource", "AsyncAppsResource", "AppsResourceWithRawResponse", diff --git a/src/mobilerun/resources/devices/__init__.py b/src/mobilerun/resources/devices/__init__.py new file mode 100644 index 0000000..db9559e --- /dev/null +++ b/src/mobilerun/resources/devices/__init__.py @@ -0,0 +1,103 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) +from .state import ( + StateResource, + AsyncStateResource, + StateResourceWithRawResponse, + AsyncStateResourceWithRawResponse, + StateResourceWithStreamingResponse, + AsyncStateResourceWithStreamingResponse, +) +from .tasks import ( + TasksResource, + AsyncTasksResource, + TasksResourceWithRawResponse, + AsyncTasksResourceWithRawResponse, + TasksResourceWithStreamingResponse, + AsyncTasksResourceWithStreamingResponse, +) +from .actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) +from .devices import ( + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, +) +from .keyboard import ( + KeyboardResource, + AsyncKeyboardResource, + KeyboardResourceWithRawResponse, + AsyncKeyboardResourceWithRawResponse, + KeyboardResourceWithStreamingResponse, + AsyncKeyboardResourceWithStreamingResponse, +) +from .packages import ( + PackagesResource, + AsyncPackagesResource, + PackagesResourceWithRawResponse, + AsyncPackagesResourceWithRawResponse, + PackagesResourceWithStreamingResponse, + AsyncPackagesResourceWithStreamingResponse, +) + +__all__ = [ + "ActionsResource", + "AsyncActionsResource", + "ActionsResourceWithRawResponse", + "AsyncActionsResourceWithRawResponse", + "ActionsResourceWithStreamingResponse", + "AsyncActionsResourceWithStreamingResponse", + "StateResource", + "AsyncStateResource", + "StateResourceWithRawResponse", + "AsyncStateResourceWithRawResponse", + "StateResourceWithStreamingResponse", + "AsyncStateResourceWithStreamingResponse", + "AppsResource", + "AsyncAppsResource", + "AppsResourceWithRawResponse", + "AsyncAppsResourceWithRawResponse", + "AppsResourceWithStreamingResponse", + "AsyncAppsResourceWithStreamingResponse", + "PackagesResource", + "AsyncPackagesResource", + "PackagesResourceWithRawResponse", + "AsyncPackagesResourceWithRawResponse", + "PackagesResourceWithStreamingResponse", + "AsyncPackagesResourceWithStreamingResponse", + "KeyboardResource", + "AsyncKeyboardResource", + "KeyboardResourceWithRawResponse", + "AsyncKeyboardResourceWithRawResponse", + "KeyboardResourceWithStreamingResponse", + "AsyncKeyboardResourceWithStreamingResponse", + "TasksResource", + "AsyncTasksResource", + "TasksResourceWithRawResponse", + "AsyncTasksResourceWithRawResponse", + "TasksResourceWithStreamingResponse", + "AsyncTasksResourceWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", +] diff --git a/src/mobilerun/resources/devices/actions.py b/src/mobilerun/resources/devices/actions.py new file mode 100644 index 0000000..b0e404a --- /dev/null +++ b/src/mobilerun/resources/devices/actions.py @@ -0,0 +1,424 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.devices import action_tap_params, action_swipe_params, action_global_params + +__all__ = ["ActionsResource", "AsyncActionsResource"] + + +class ActionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ActionsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return ActionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ActionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return ActionsResourceWithStreamingResponse(self) + + def global_( + self, + device_id: str, + *, + action: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Perform a global action + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._post( + f"/devices/{device_id}/global", + body=maybe_transform({"action": action}, action_global_params.ActionGlobalParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def swipe( + self, + device_id: str, + *, + duration: int, + end_x: int, + end_y: int, + start_x: int, + start_y: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Swipe + + Args: + duration: Swipe duration in milliseconds + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._post( + f"/devices/{device_id}/swipe", + body=maybe_transform( + { + "duration": duration, + "end_x": end_x, + "end_y": end_y, + "start_x": start_x, + "start_y": start_y, + }, + action_swipe_params.ActionSwipeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def tap( + self, + device_id: str, + *, + x: int, + y: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Tap by coordinates + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._post( + f"/devices/{device_id}/tap", + body=maybe_transform( + { + "x": x, + "y": y, + }, + action_tap_params.ActionTapParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncActionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncActionsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncActionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncActionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AsyncActionsResourceWithStreamingResponse(self) + + async def global_( + self, + device_id: str, + *, + action: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Perform a global action + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._post( + f"/devices/{device_id}/global", + body=await async_maybe_transform({"action": action}, action_global_params.ActionGlobalParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def swipe( + self, + device_id: str, + *, + duration: int, + end_x: int, + end_y: int, + start_x: int, + start_y: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Swipe + + Args: + duration: Swipe duration in milliseconds + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._post( + f"/devices/{device_id}/swipe", + body=await async_maybe_transform( + { + "duration": duration, + "end_x": end_x, + "end_y": end_y, + "start_x": start_x, + "start_y": start_y, + }, + action_swipe_params.ActionSwipeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def tap( + self, + device_id: str, + *, + x: int, + y: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Tap by coordinates + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._post( + f"/devices/{device_id}/tap", + body=await async_maybe_transform( + { + "x": x, + "y": y, + }, + action_tap_params.ActionTapParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class ActionsResourceWithRawResponse: + def __init__(self, actions: ActionsResource) -> None: + self._actions = actions + + self.global_ = to_raw_response_wrapper( + actions.global_, + ) + self.swipe = to_raw_response_wrapper( + actions.swipe, + ) + self.tap = to_raw_response_wrapper( + actions.tap, + ) + + +class AsyncActionsResourceWithRawResponse: + def __init__(self, actions: AsyncActionsResource) -> None: + self._actions = actions + + self.global_ = async_to_raw_response_wrapper( + actions.global_, + ) + self.swipe = async_to_raw_response_wrapper( + actions.swipe, + ) + self.tap = async_to_raw_response_wrapper( + actions.tap, + ) + + +class ActionsResourceWithStreamingResponse: + def __init__(self, actions: ActionsResource) -> None: + self._actions = actions + + self.global_ = to_streamed_response_wrapper( + actions.global_, + ) + self.swipe = to_streamed_response_wrapper( + actions.swipe, + ) + self.tap = to_streamed_response_wrapper( + actions.tap, + ) + + +class AsyncActionsResourceWithStreamingResponse: + def __init__(self, actions: AsyncActionsResource) -> None: + self._actions = actions + + self.global_ = async_to_streamed_response_wrapper( + actions.global_, + ) + self.swipe = async_to_streamed_response_wrapper( + actions.swipe, + ) + self.tap = async_to_streamed_response_wrapper( + actions.tap, + ) diff --git a/src/mobilerun/resources/devices/apps.py b/src/mobilerun/resources/devices/apps.py new file mode 100644 index 0000000..e0ddd9b --- /dev/null +++ b/src/mobilerun/resources/devices/apps.py @@ -0,0 +1,495 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.devices import app_list_params, app_start_params, app_install_params +from ...types.devices.app_list_response import AppListResponse + +__all__ = ["AppsResource", "AsyncAppsResource"] + + +class AppsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AppsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AppsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AppsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AppsResourceWithStreamingResponse(self) + + def list( + self, + device_id: str, + *, + include_system_apps: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Optional[AppListResponse]: + """ + List apps + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._get( + f"/devices/{device_id}/apps", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"include_system_apps": include_system_apps}, app_list_params.AppListParams), + ), + cast_to=AppListResponse, + ) + + def delete( + self, + package_name: str, + *, + device_id: str, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + if not package_name: + raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._delete( + f"/devices/{device_id}/apps/{package_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def install( + self, + device_id: str, + *, + package_name: str, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Install app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._post( + f"/devices/{device_id}/apps", + body=maybe_transform({"package_name": package_name}, app_install_params.AppInstallParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def start( + self, + package_name: str, + *, + device_id: str, + activity: str | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Start app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + if not package_name: + raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._put( + f"/devices/{device_id}/apps/{package_name}", + body=maybe_transform({"activity": activity}, app_start_params.AppStartParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncAppsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAppsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncAppsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AsyncAppsResourceWithStreamingResponse(self) + + async def list( + self, + device_id: str, + *, + include_system_apps: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Optional[AppListResponse]: + """ + List apps + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._get( + f"/devices/{device_id}/apps", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"include_system_apps": include_system_apps}, app_list_params.AppListParams + ), + ), + cast_to=AppListResponse, + ) + + async def delete( + self, + package_name: str, + *, + device_id: str, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + if not package_name: + raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._delete( + f"/devices/{device_id}/apps/{package_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def install( + self, + device_id: str, + *, + package_name: str, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Install app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._post( + f"/devices/{device_id}/apps", + body=await async_maybe_transform({"package_name": package_name}, app_install_params.AppInstallParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def start( + self, + package_name: str, + *, + device_id: str, + activity: str | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Start app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + if not package_name: + raise ValueError(f"Expected a non-empty value for `package_name` but received {package_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._put( + f"/devices/{device_id}/apps/{package_name}", + body=await async_maybe_transform({"activity": activity}, app_start_params.AppStartParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AppsResourceWithRawResponse: + def __init__(self, apps: AppsResource) -> None: + self._apps = apps + + self.list = to_raw_response_wrapper( + apps.list, + ) + self.delete = to_raw_response_wrapper( + apps.delete, + ) + self.install = to_raw_response_wrapper( + apps.install, + ) + self.start = to_raw_response_wrapper( + apps.start, + ) + + +class AsyncAppsResourceWithRawResponse: + def __init__(self, apps: AsyncAppsResource) -> None: + self._apps = apps + + self.list = async_to_raw_response_wrapper( + apps.list, + ) + self.delete = async_to_raw_response_wrapper( + apps.delete, + ) + self.install = async_to_raw_response_wrapper( + apps.install, + ) + self.start = async_to_raw_response_wrapper( + apps.start, + ) + + +class AppsResourceWithStreamingResponse: + def __init__(self, apps: AppsResource) -> None: + self._apps = apps + + self.list = to_streamed_response_wrapper( + apps.list, + ) + self.delete = to_streamed_response_wrapper( + apps.delete, + ) + self.install = to_streamed_response_wrapper( + apps.install, + ) + self.start = to_streamed_response_wrapper( + apps.start, + ) + + +class AsyncAppsResourceWithStreamingResponse: + def __init__(self, apps: AsyncAppsResource) -> None: + self._apps = apps + + self.list = async_to_streamed_response_wrapper( + apps.list, + ) + self.delete = async_to_streamed_response_wrapper( + apps.delete, + ) + self.install = async_to_streamed_response_wrapper( + apps.install, + ) + self.start = async_to_streamed_response_wrapper( + apps.start, + ) diff --git a/src/mobilerun/resources/devices/devices.py b/src/mobilerun/resources/devices/devices.py new file mode 100644 index 0000000..63be619 --- /dev/null +++ b/src/mobilerun/resources/devices/devices.py @@ -0,0 +1,820 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) +from .state import ( + StateResource, + AsyncStateResource, + StateResourceWithRawResponse, + AsyncStateResourceWithRawResponse, + StateResourceWithStreamingResponse, + AsyncStateResourceWithStreamingResponse, +) +from .tasks import ( + TasksResource, + AsyncTasksResource, + TasksResourceWithRawResponse, + AsyncTasksResourceWithRawResponse, + TasksResourceWithStreamingResponse, + AsyncTasksResourceWithStreamingResponse, +) +from ...types import device_list_params, device_create_params +from .actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from .keyboard import ( + KeyboardResource, + AsyncKeyboardResource, + KeyboardResourceWithRawResponse, + AsyncKeyboardResourceWithRawResponse, + KeyboardResourceWithStreamingResponse, + AsyncKeyboardResourceWithStreamingResponse, +) +from .packages import ( + PackagesResource, + AsyncPackagesResource, + PackagesResourceWithRawResponse, + AsyncPackagesResourceWithRawResponse, + PackagesResourceWithStreamingResponse, + AsyncPackagesResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.device import Device +from ...types.device_list_response import DeviceListResponse +from ...types.device_count_response import DeviceCountResponse + +__all__ = ["DevicesResource", "AsyncDevicesResource"] + + +class DevicesResource(SyncAPIResource): + @cached_property + def actions(self) -> ActionsResource: + return ActionsResource(self._client) + + @cached_property + def state(self) -> StateResource: + return StateResource(self._client) + + @cached_property + def apps(self) -> AppsResource: + return AppsResource(self._client) + + @cached_property + def packages(self) -> PackagesResource: + return PackagesResource(self._client) + + @cached_property + def keyboard(self) -> KeyboardResource: + return KeyboardResource(self._client) + + @cached_property + def tasks(self) -> TasksResource: + return TasksResource(self._client) + + @cached_property + def with_raw_response(self) -> DevicesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return DevicesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DevicesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return DevicesResourceWithStreamingResponse(self) + + def create( + self, + *, + device_type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, + provider: Literal["limrun", "remote", "roidrun"] | Omit = omit, + apps: Optional[SequenceNotStr[str]] | Omit = omit, + country: str | Omit = omit, + files: Optional[SequenceNotStr[str]] | Omit = omit, + name: str | Omit = omit, + proxy: device_create_params.Proxy | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Device: + """ + Provision a new device + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/devices", + body=maybe_transform( + { + "apps": apps, + "country": country, + "files": files, + "name": name, + "proxy": proxy, + }, + device_create_params.DeviceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "device_type": device_type, + "provider": provider, + }, + device_create_params.DeviceCreateParams, + ), + ), + cast_to=Device, + ) + + def retrieve( + self, + device_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Device: + """ + Get device info + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + return self._get( + f"/devices/{device_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Device, + ) + + def list( + self, + *, + country: str | Omit = omit, + name: str | Omit = omit, + order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + provider: Literal["limrun", "personal", "remote", "roidrun"] | Omit = omit, + state: Literal["creating", "assigned", "ready", "terminated", "unknown"] | Omit = omit, + type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> DeviceListResponse: + """ + List devices + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/devices", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "country": country, + "name": name, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "provider": provider, + "state": state, + "type": type, + }, + device_list_params.DeviceListParams, + ), + ), + cast_to=DeviceListResponse, + ) + + def count( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> DeviceCountResponse: + """Count claimed devices""" + return self._get( + "/devices/count", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeviceCountResponse, + ) + + def terminate( + self, + device_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Terminate a device + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/devices/{device_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def wait_ready( + self, + device_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Device: + """ + Wait for device to be ready + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + return self._get( + f"/devices/{device_id}/wait", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Device, + ) + + +class AsyncDevicesResource(AsyncAPIResource): + @cached_property + def actions(self) -> AsyncActionsResource: + return AsyncActionsResource(self._client) + + @cached_property + def state(self) -> AsyncStateResource: + return AsyncStateResource(self._client) + + @cached_property + def apps(self) -> AsyncAppsResource: + return AsyncAppsResource(self._client) + + @cached_property + def packages(self) -> AsyncPackagesResource: + return AsyncPackagesResource(self._client) + + @cached_property + def keyboard(self) -> AsyncKeyboardResource: + return AsyncKeyboardResource(self._client) + + @cached_property + def tasks(self) -> AsyncTasksResource: + return AsyncTasksResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncDevicesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncDevicesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDevicesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AsyncDevicesResourceWithStreamingResponse(self) + + async def create( + self, + *, + device_type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, + provider: Literal["limrun", "remote", "roidrun"] | Omit = omit, + apps: Optional[SequenceNotStr[str]] | Omit = omit, + country: str | Omit = omit, + files: Optional[SequenceNotStr[str]] | Omit = omit, + name: str | Omit = omit, + proxy: device_create_params.Proxy | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Device: + """ + Provision a new device + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/devices", + body=await async_maybe_transform( + { + "apps": apps, + "country": country, + "files": files, + "name": name, + "proxy": proxy, + }, + device_create_params.DeviceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "device_type": device_type, + "provider": provider, + }, + device_create_params.DeviceCreateParams, + ), + ), + cast_to=Device, + ) + + async def retrieve( + self, + device_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Device: + """ + Get device info + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + return await self._get( + f"/devices/{device_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Device, + ) + + async def list( + self, + *, + country: str | Omit = omit, + name: str | Omit = omit, + order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + provider: Literal["limrun", "personal", "remote", "roidrun"] | Omit = omit, + state: Literal["creating", "assigned", "ready", "terminated", "unknown"] | Omit = omit, + type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> DeviceListResponse: + """ + List devices + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/devices", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "country": country, + "name": name, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "provider": provider, + "state": state, + "type": type, + }, + device_list_params.DeviceListParams, + ), + ), + cast_to=DeviceListResponse, + ) + + async def count( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> DeviceCountResponse: + """Count claimed devices""" + return await self._get( + "/devices/count", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeviceCountResponse, + ) + + async def terminate( + self, + device_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Terminate a device + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/devices/{device_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def wait_ready( + self, + device_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Device: + """ + Wait for device to be ready + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + return await self._get( + f"/devices/{device_id}/wait", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Device, + ) + + +class DevicesResourceWithRawResponse: + def __init__(self, devices: DevicesResource) -> None: + self._devices = devices + + self.create = to_raw_response_wrapper( + devices.create, + ) + self.retrieve = to_raw_response_wrapper( + devices.retrieve, + ) + self.list = to_raw_response_wrapper( + devices.list, + ) + self.count = to_raw_response_wrapper( + devices.count, + ) + self.terminate = to_raw_response_wrapper( + devices.terminate, + ) + self.wait_ready = to_raw_response_wrapper( + devices.wait_ready, + ) + + @cached_property + def actions(self) -> ActionsResourceWithRawResponse: + return ActionsResourceWithRawResponse(self._devices.actions) + + @cached_property + def state(self) -> StateResourceWithRawResponse: + return StateResourceWithRawResponse(self._devices.state) + + @cached_property + def apps(self) -> AppsResourceWithRawResponse: + return AppsResourceWithRawResponse(self._devices.apps) + + @cached_property + def packages(self) -> PackagesResourceWithRawResponse: + return PackagesResourceWithRawResponse(self._devices.packages) + + @cached_property + def keyboard(self) -> KeyboardResourceWithRawResponse: + return KeyboardResourceWithRawResponse(self._devices.keyboard) + + @cached_property + def tasks(self) -> TasksResourceWithRawResponse: + return TasksResourceWithRawResponse(self._devices.tasks) + + +class AsyncDevicesResourceWithRawResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: + self._devices = devices + + self.create = async_to_raw_response_wrapper( + devices.create, + ) + self.retrieve = async_to_raw_response_wrapper( + devices.retrieve, + ) + self.list = async_to_raw_response_wrapper( + devices.list, + ) + self.count = async_to_raw_response_wrapper( + devices.count, + ) + self.terminate = async_to_raw_response_wrapper( + devices.terminate, + ) + self.wait_ready = async_to_raw_response_wrapper( + devices.wait_ready, + ) + + @cached_property + def actions(self) -> AsyncActionsResourceWithRawResponse: + return AsyncActionsResourceWithRawResponse(self._devices.actions) + + @cached_property + def state(self) -> AsyncStateResourceWithRawResponse: + return AsyncStateResourceWithRawResponse(self._devices.state) + + @cached_property + def apps(self) -> AsyncAppsResourceWithRawResponse: + return AsyncAppsResourceWithRawResponse(self._devices.apps) + + @cached_property + def packages(self) -> AsyncPackagesResourceWithRawResponse: + return AsyncPackagesResourceWithRawResponse(self._devices.packages) + + @cached_property + def keyboard(self) -> AsyncKeyboardResourceWithRawResponse: + return AsyncKeyboardResourceWithRawResponse(self._devices.keyboard) + + @cached_property + def tasks(self) -> AsyncTasksResourceWithRawResponse: + return AsyncTasksResourceWithRawResponse(self._devices.tasks) + + +class DevicesResourceWithStreamingResponse: + def __init__(self, devices: DevicesResource) -> None: + self._devices = devices + + self.create = to_streamed_response_wrapper( + devices.create, + ) + self.retrieve = to_streamed_response_wrapper( + devices.retrieve, + ) + self.list = to_streamed_response_wrapper( + devices.list, + ) + self.count = to_streamed_response_wrapper( + devices.count, + ) + self.terminate = to_streamed_response_wrapper( + devices.terminate, + ) + self.wait_ready = to_streamed_response_wrapper( + devices.wait_ready, + ) + + @cached_property + def actions(self) -> ActionsResourceWithStreamingResponse: + return ActionsResourceWithStreamingResponse(self._devices.actions) + + @cached_property + def state(self) -> StateResourceWithStreamingResponse: + return StateResourceWithStreamingResponse(self._devices.state) + + @cached_property + def apps(self) -> AppsResourceWithStreamingResponse: + return AppsResourceWithStreamingResponse(self._devices.apps) + + @cached_property + def packages(self) -> PackagesResourceWithStreamingResponse: + return PackagesResourceWithStreamingResponse(self._devices.packages) + + @cached_property + def keyboard(self) -> KeyboardResourceWithStreamingResponse: + return KeyboardResourceWithStreamingResponse(self._devices.keyboard) + + @cached_property + def tasks(self) -> TasksResourceWithStreamingResponse: + return TasksResourceWithStreamingResponse(self._devices.tasks) + + +class AsyncDevicesResourceWithStreamingResponse: + def __init__(self, devices: AsyncDevicesResource) -> None: + self._devices = devices + + self.create = async_to_streamed_response_wrapper( + devices.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + devices.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + devices.list, + ) + self.count = async_to_streamed_response_wrapper( + devices.count, + ) + self.terminate = async_to_streamed_response_wrapper( + devices.terminate, + ) + self.wait_ready = async_to_streamed_response_wrapper( + devices.wait_ready, + ) + + @cached_property + def actions(self) -> AsyncActionsResourceWithStreamingResponse: + return AsyncActionsResourceWithStreamingResponse(self._devices.actions) + + @cached_property + def state(self) -> AsyncStateResourceWithStreamingResponse: + return AsyncStateResourceWithStreamingResponse(self._devices.state) + + @cached_property + def apps(self) -> AsyncAppsResourceWithStreamingResponse: + return AsyncAppsResourceWithStreamingResponse(self._devices.apps) + + @cached_property + def packages(self) -> AsyncPackagesResourceWithStreamingResponse: + return AsyncPackagesResourceWithStreamingResponse(self._devices.packages) + + @cached_property + def keyboard(self) -> AsyncKeyboardResourceWithStreamingResponse: + return AsyncKeyboardResourceWithStreamingResponse(self._devices.keyboard) + + @cached_property + def tasks(self) -> AsyncTasksResourceWithStreamingResponse: + return AsyncTasksResourceWithStreamingResponse(self._devices.tasks) diff --git a/src/mobilerun/resources/devices/keyboard.py b/src/mobilerun/resources/devices/keyboard.py new file mode 100644 index 0000000..81d8459 --- /dev/null +++ b/src/mobilerun/resources/devices/keyboard.py @@ -0,0 +1,390 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.devices import keyboard_key_params, keyboard_write_params + +__all__ = ["KeyboardResource", "AsyncKeyboardResource"] + + +class KeyboardResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> KeyboardResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return KeyboardResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> KeyboardResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return KeyboardResourceWithStreamingResponse(self) + + def clear( + self, + device_id: str, + *, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Clear input + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._delete( + f"/devices/{device_id}/keyboard", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def key( + self, + device_id: str, + *, + key: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Input key + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._put( + f"/devices/{device_id}/keyboard", + body=maybe_transform({"key": key}, keyboard_key_params.KeyboardKeyParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def write( + self, + device_id: str, + *, + clear: bool, + text: str, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Input text + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._post( + f"/devices/{device_id}/keyboard", + body=maybe_transform( + { + "clear": clear, + "text": text, + }, + keyboard_write_params.KeyboardWriteParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncKeyboardResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncKeyboardResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncKeyboardResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncKeyboardResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AsyncKeyboardResourceWithStreamingResponse(self) + + async def clear( + self, + device_id: str, + *, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Clear input + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._delete( + f"/devices/{device_id}/keyboard", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def key( + self, + device_id: str, + *, + key: int, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Input key + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._put( + f"/devices/{device_id}/keyboard", + body=await async_maybe_transform({"key": key}, keyboard_key_params.KeyboardKeyParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def write( + self, + device_id: str, + *, + clear: bool, + text: str, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Input text + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._post( + f"/devices/{device_id}/keyboard", + body=await async_maybe_transform( + { + "clear": clear, + "text": text, + }, + keyboard_write_params.KeyboardWriteParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class KeyboardResourceWithRawResponse: + def __init__(self, keyboard: KeyboardResource) -> None: + self._keyboard = keyboard + + self.clear = to_raw_response_wrapper( + keyboard.clear, + ) + self.key = to_raw_response_wrapper( + keyboard.key, + ) + self.write = to_raw_response_wrapper( + keyboard.write, + ) + + +class AsyncKeyboardResourceWithRawResponse: + def __init__(self, keyboard: AsyncKeyboardResource) -> None: + self._keyboard = keyboard + + self.clear = async_to_raw_response_wrapper( + keyboard.clear, + ) + self.key = async_to_raw_response_wrapper( + keyboard.key, + ) + self.write = async_to_raw_response_wrapper( + keyboard.write, + ) + + +class KeyboardResourceWithStreamingResponse: + def __init__(self, keyboard: KeyboardResource) -> None: + self._keyboard = keyboard + + self.clear = to_streamed_response_wrapper( + keyboard.clear, + ) + self.key = to_streamed_response_wrapper( + keyboard.key, + ) + self.write = to_streamed_response_wrapper( + keyboard.write, + ) + + +class AsyncKeyboardResourceWithStreamingResponse: + def __init__(self, keyboard: AsyncKeyboardResource) -> None: + self._keyboard = keyboard + + self.clear = async_to_streamed_response_wrapper( + keyboard.clear, + ) + self.key = async_to_streamed_response_wrapper( + keyboard.key, + ) + self.write = async_to_streamed_response_wrapper( + keyboard.write, + ) diff --git a/src/mobilerun/resources/devices/packages.py b/src/mobilerun/resources/devices/packages.py new file mode 100644 index 0000000..ed3ead4 --- /dev/null +++ b/src/mobilerun/resources/devices/packages.py @@ -0,0 +1,195 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.devices import package_list_params +from ...types.devices.package_list_response import PackageListResponse + +__all__ = ["PackagesResource", "AsyncPackagesResource"] + + +class PackagesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PackagesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return PackagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PackagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return PackagesResourceWithStreamingResponse(self) + + def list( + self, + device_id: str, + *, + include_system_packages: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Optional[PackageListResponse]: + """ + List packages + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._get( + f"/devices/{device_id}/packages", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"include_system_packages": include_system_packages}, package_list_params.PackageListParams + ), + ), + cast_to=PackageListResponse, + ) + + +class AsyncPackagesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPackagesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncPackagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPackagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AsyncPackagesResourceWithStreamingResponse(self) + + async def list( + self, + device_id: str, + *, + include_system_packages: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Optional[PackageListResponse]: + """ + List packages + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._get( + f"/devices/{device_id}/packages", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"include_system_packages": include_system_packages}, package_list_params.PackageListParams + ), + ), + cast_to=PackageListResponse, + ) + + +class PackagesResourceWithRawResponse: + def __init__(self, packages: PackagesResource) -> None: + self._packages = packages + + self.list = to_raw_response_wrapper( + packages.list, + ) + + +class AsyncPackagesResourceWithRawResponse: + def __init__(self, packages: AsyncPackagesResource) -> None: + self._packages = packages + + self.list = async_to_raw_response_wrapper( + packages.list, + ) + + +class PackagesResourceWithStreamingResponse: + def __init__(self, packages: PackagesResource) -> None: + self._packages = packages + + self.list = to_streamed_response_wrapper( + packages.list, + ) + + +class AsyncPackagesResourceWithStreamingResponse: + def __init__(self, packages: AsyncPackagesResource) -> None: + self._packages = packages + + self.list = async_to_streamed_response_wrapper( + packages.list, + ) diff --git a/src/mobilerun/resources/devices/state.py b/src/mobilerun/resources/devices/state.py new file mode 100644 index 0000000..10521ea --- /dev/null +++ b/src/mobilerun/resources/devices/state.py @@ -0,0 +1,385 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.devices import state_ui_params, state_screenshot_params +from ...types.devices.state_ui_response import StateUiResponse + +__all__ = ["StateResource", "AsyncStateResource"] + + +class StateResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StateResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return StateResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StateResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return StateResourceWithStreamingResponse(self) + + def screenshot( + self, + device_id: str, + *, + hide_overlay: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> str: + """ + Take screenshot + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._get( + f"/devices/{device_id}/screenshot", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"hide_overlay": hide_overlay}, state_screenshot_params.StateScreenshotParams), + ), + cast_to=str, + ) + + def time( + self, + device_id: str, + *, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> str: + """ + Device time + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._get( + f"/devices/{device_id}/time", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=str, + ) + + def ui( + self, + device_id: str, + *, + filter: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> StateUiResponse: + """ + UI state + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return self._get( + f"/devices/{device_id}/ui-state", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"filter": filter}, state_ui_params.StateUiParams), + ), + cast_to=StateUiResponse, + ) + + +class AsyncStateResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStateResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncStateResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStateResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AsyncStateResourceWithStreamingResponse(self) + + async def screenshot( + self, + device_id: str, + *, + hide_overlay: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> str: + """ + Take screenshot + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._get( + f"/devices/{device_id}/screenshot", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"hide_overlay": hide_overlay}, state_screenshot_params.StateScreenshotParams + ), + ), + cast_to=str, + ) + + async def time( + self, + device_id: str, + *, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> str: + """ + Device time + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._get( + f"/devices/{device_id}/time", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=str, + ) + + async def ui( + self, + device_id: str, + *, + filter: bool | Omit = omit, + x_device_display_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> StateUiResponse: + """ + UI state + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + extra_headers = { + **strip_not_given( + {"X-Device-Display-ID": str(x_device_display_id) if is_given(x_device_display_id) else not_given} + ), + **(extra_headers or {}), + } + return await self._get( + f"/devices/{device_id}/ui-state", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"filter": filter}, state_ui_params.StateUiParams), + ), + cast_to=StateUiResponse, + ) + + +class StateResourceWithRawResponse: + def __init__(self, state: StateResource) -> None: + self._state = state + + self.screenshot = to_raw_response_wrapper( + state.screenshot, + ) + self.time = to_raw_response_wrapper( + state.time, + ) + self.ui = to_raw_response_wrapper( + state.ui, + ) + + +class AsyncStateResourceWithRawResponse: + def __init__(self, state: AsyncStateResource) -> None: + self._state = state + + self.screenshot = async_to_raw_response_wrapper( + state.screenshot, + ) + self.time = async_to_raw_response_wrapper( + state.time, + ) + self.ui = async_to_raw_response_wrapper( + state.ui, + ) + + +class StateResourceWithStreamingResponse: + def __init__(self, state: StateResource) -> None: + self._state = state + + self.screenshot = to_streamed_response_wrapper( + state.screenshot, + ) + self.time = to_streamed_response_wrapper( + state.time, + ) + self.ui = to_streamed_response_wrapper( + state.ui, + ) + + +class AsyncStateResourceWithStreamingResponse: + def __init__(self, state: AsyncStateResource) -> None: + self._state = state + + self.screenshot = async_to_streamed_response_wrapper( + state.screenshot, + ) + self.time = async_to_streamed_response_wrapper( + state.time, + ) + self.ui = async_to_streamed_response_wrapper( + state.ui, + ) diff --git a/src/mobilerun/resources/devices/tasks.py b/src/mobilerun/resources/devices/tasks.py new file mode 100644 index 0000000..69e27f4 --- /dev/null +++ b/src/mobilerun/resources/devices/tasks.py @@ -0,0 +1,199 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.devices import task_list_params +from ...types.devices.task_list_response import TaskListResponse + +__all__ = ["TasksResource", "AsyncTasksResource"] + + +class TasksResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TasksResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return TasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TasksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return TasksResourceWithStreamingResponse(self) + + def list( + self, + device_id: str, + *, + order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskListResponse: + """ + List tasks for a device + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + return self._get( + f"/devices/{device_id}/tasks", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + }, + task_list_params.TaskListParams, + ), + ), + cast_to=TaskListResponse, + ) + + +class AsyncTasksResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncTasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/droidrun/mobilerun-sdk-python#with_streaming_response + """ + return AsyncTasksResourceWithStreamingResponse(self) + + async def list( + self, + device_id: str, + *, + order_by: Literal["id", "createdAt", "updatedAt", "assignedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskListResponse: + """ + List tasks for a device + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not device_id: + raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") + return await self._get( + f"/devices/{device_id}/tasks", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + }, + task_list_params.TaskListParams, + ), + ), + cast_to=TaskListResponse, + ) + + +class TasksResourceWithRawResponse: + def __init__(self, tasks: TasksResource) -> None: + self._tasks = tasks + + self.list = to_raw_response_wrapper( + tasks.list, + ) + + +class AsyncTasksResourceWithRawResponse: + def __init__(self, tasks: AsyncTasksResource) -> None: + self._tasks = tasks + + self.list = async_to_raw_response_wrapper( + tasks.list, + ) + + +class TasksResourceWithStreamingResponse: + def __init__(self, tasks: TasksResource) -> None: + self._tasks = tasks + + self.list = to_streamed_response_wrapper( + tasks.list, + ) + + +class AsyncTasksResourceWithStreamingResponse: + def __init__(self, tasks: AsyncTasksResource) -> None: + self._tasks = tasks + + self.list = async_to_streamed_response_wrapper( + tasks.list, + ) diff --git a/src/mobilerun/types/__init__.py b/src/mobilerun/types/__init__.py index 48e9ccc..72eddf4 100644 --- a/src/mobilerun/types/__init__.py +++ b/src/mobilerun/types/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .task import Task as Task +from .device import Device as Device from .llm_model import LlmModel as LlmModel from .task_status import TaskStatus as TaskStatus from .app_list_params import AppListParams as AppListParams @@ -11,11 +12,15 @@ from .task_list_params import TaskListParams as TaskListParams from .app_list_response import AppListResponse as AppListResponse from .task_run_response import TaskRunResponse as TaskRunResponse +from .device_list_params import DeviceListParams as DeviceListParams from .hook_list_response import HookListResponse as HookListResponse from .hook_update_params import HookUpdateParams as HookUpdateParams from .task_list_response import TaskListResponse as TaskListResponse from .task_stop_response import TaskStopResponse as TaskStopResponse +from .device_create_params import DeviceCreateParams as DeviceCreateParams +from .device_list_response import DeviceListResponse as DeviceListResponse from .hook_update_response import HookUpdateResponse as HookUpdateResponse +from .device_count_response import DeviceCountResponse as DeviceCountResponse from .hook_perform_response import HookPerformResponse as HookPerformResponse from .hook_subscribe_params import HookSubscribeParams as HookSubscribeParams from .hook_retrieve_response import HookRetrieveResponse as HookRetrieveResponse diff --git a/src/mobilerun/types/device.py b/src/mobilerun/types/device.py new file mode 100644 index 0000000..3d570c1 --- /dev/null +++ b/src/mobilerun/types/device.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["Device"] + + +class Device(BaseModel): + id: str + + apps: Optional[List[str]] = None + + assigned_at: Optional[datetime] = FieldInfo(alias="assignedAt", default=None) + + country: str + + created_at: datetime = FieldInfo(alias="createdAt") + + device_type: str = FieldInfo(alias="deviceType") + + files: Optional[List[str]] = None + + name: str + + provider: str + + state: str + + state_message: str = FieldInfo(alias="stateMessage") + + stream_token: str = FieldInfo(alias="streamToken") + + stream_url: str = FieldInfo(alias="streamUrl") + + task_count: int = FieldInfo(alias="taskCount") + + updated_at: datetime = FieldInfo(alias="updatedAt") + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" + + user_id: Optional[str] = FieldInfo(alias="userId", default=None) diff --git a/src/mobilerun/types/device_count_response.py b/src/mobilerun/types/device_count_response.py new file mode 100644 index 0000000..517cdeb --- /dev/null +++ b/src/mobilerun/types/device_count_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["DeviceCountResponse"] + + +class DeviceCountResponse(BaseModel): + limrun: int + + personal: int + + remote: int + + roidrun: int + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun/types/device_create_params.py b/src/mobilerun/types/device_create_params.py new file mode 100644 index 0000000..4134f5a --- /dev/null +++ b/src/mobilerun/types/device_create_params.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._types import SequenceNotStr +from .._utils import PropertyInfo + +__all__ = ["DeviceCreateParams", "Proxy"] + + +class DeviceCreateParams(TypedDict, total=False): + device_type: Annotated[ + Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"], + PropertyInfo(alias="deviceType"), + ] + + provider: Literal["limrun", "remote", "roidrun"] + + apps: Optional[SequenceNotStr[str]] + + country: str + + files: Optional[SequenceNotStr[str]] + + name: str + + proxy: Proxy + + +class Proxy(TypedDict, total=False): + host: Required[str] + + password: Required[str] + + port: Required[int] + + user: Required[str] diff --git a/src/mobilerun/types/device_list_params.py b/src/mobilerun/types/device_list_params.py new file mode 100644 index 0000000..48b5c7f --- /dev/null +++ b/src/mobilerun/types/device_list_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["DeviceListParams"] + + +class DeviceListParams(TypedDict, total=False): + country: str + + name: str + + order_by: Annotated[Literal["id", "createdAt", "updatedAt", "assignedAt"], PropertyInfo(alias="orderBy")] + + order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] + + page: int + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + provider: Literal["limrun", "personal", "remote", "roidrun"] + + state: Literal["creating", "assigned", "ready", "terminated", "unknown"] + + type: Literal["device_slot", "dedicated_emulated_device", "dedicated_physical_device"] diff --git a/src/mobilerun/types/device_list_response.py b/src/mobilerun/types/device_list_response.py new file mode 100644 index 0000000..cd6cc01 --- /dev/null +++ b/src/mobilerun/types/device_list_response.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .device import Device +from .._models import BaseModel + +__all__ = ["DeviceListResponse", "Pagination"] + + +class Pagination(BaseModel): + has_next: bool = FieldInfo(alias="hasNext") + + has_prev: bool = FieldInfo(alias="hasPrev") + + page: int + + pages: int + + page_size: int = FieldInfo(alias="pageSize") + + total: int + + +class DeviceListResponse(BaseModel): + items: Optional[List[Device]] = None + + pagination: Pagination + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun/types/devices/__init__.py b/src/mobilerun/types/devices/__init__.py index f8ee8b1..6bf3b6f 100644 --- a/src/mobilerun/types/devices/__init__.py +++ b/src/mobilerun/types/devices/__init__.py @@ -1,3 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .app_list_params import AppListParams as AppListParams +from .state_ui_params import StateUiParams as StateUiParams +from .app_start_params import AppStartParams as AppStartParams +from .task_list_params import TaskListParams as TaskListParams +from .action_tap_params import ActionTapParams as ActionTapParams +from .app_list_response import AppListResponse as AppListResponse +from .state_ui_response import StateUiResponse as StateUiResponse +from .app_install_params import AppInstallParams as AppInstallParams +from .task_list_response import TaskListResponse as TaskListResponse +from .action_swipe_params import ActionSwipeParams as ActionSwipeParams +from .keyboard_key_params import KeyboardKeyParams as KeyboardKeyParams +from .package_list_params import PackageListParams as PackageListParams +from .state_time_response import StateTimeResponse as StateTimeResponse +from .action_global_params import ActionGlobalParams as ActionGlobalParams +from .keyboard_write_params import KeyboardWriteParams as KeyboardWriteParams +from .package_list_response import PackageListResponse as PackageListResponse +from .state_screenshot_params import StateScreenshotParams as StateScreenshotParams +from .state_screenshot_response import StateScreenshotResponse as StateScreenshotResponse diff --git a/src/mobilerun/types/devices/action_global_params.py b/src/mobilerun/types/devices/action_global_params.py new file mode 100644 index 0000000..a8fca37 --- /dev/null +++ b/src/mobilerun/types/devices/action_global_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ActionGlobalParams"] + + +class ActionGlobalParams(TypedDict, total=False): + action: Required[int] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/action_swipe_params.py b/src/mobilerun/types/devices/action_swipe_params.py new file mode 100644 index 0000000..2f9df10 --- /dev/null +++ b/src/mobilerun/types/devices/action_swipe_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ActionSwipeParams"] + + +class ActionSwipeParams(TypedDict, total=False): + duration: Required[int] + """Swipe duration in milliseconds""" + + end_x: Required[Annotated[int, PropertyInfo(alias="endX")]] + + end_y: Required[Annotated[int, PropertyInfo(alias="endY")]] + + start_x: Required[Annotated[int, PropertyInfo(alias="startX")]] + + start_y: Required[Annotated[int, PropertyInfo(alias="startY")]] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/action_tap_params.py b/src/mobilerun/types/devices/action_tap_params.py new file mode 100644 index 0000000..006f57d --- /dev/null +++ b/src/mobilerun/types/devices/action_tap_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ActionTapParams"] + + +class ActionTapParams(TypedDict, total=False): + x: Required[int] + + y: Required[int] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/app_install_params.py b/src/mobilerun/types/devices/app_install_params.py new file mode 100644 index 0000000..915231c --- /dev/null +++ b/src/mobilerun/types/devices/app_install_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AppInstallParams"] + + +class AppInstallParams(TypedDict, total=False): + package_name: Required[Annotated[str, PropertyInfo(alias="packageName")]] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/app_list_params.py b/src/mobilerun/types/devices/app_list_params.py new file mode 100644 index 0000000..762be54 --- /dev/null +++ b/src/mobilerun/types/devices/app_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AppListParams"] + + +class AppListParams(TypedDict, total=False): + include_system_apps: Annotated[bool, PropertyInfo(alias="includeSystemApps")] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/app_list_response.py b/src/mobilerun/types/devices/app_list_response.py new file mode 100644 index 0000000..c8f8f4e --- /dev/null +++ b/src/mobilerun/types/devices/app_list_response.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["AppListResponse", "AppListResponseItem"] + + +class AppListResponseItem(BaseModel): + is_system_app: bool = FieldInfo(alias="isSystemApp") + + label: str + + package_name: str = FieldInfo(alias="packageName") + + version_code: int = FieldInfo(alias="versionCode") + + version_name: str = FieldInfo(alias="versionName") + + +AppListResponse: TypeAlias = List[AppListResponseItem] diff --git a/src/mobilerun/types/devices/app_start_params.py b/src/mobilerun/types/devices/app_start_params.py new file mode 100644 index 0000000..f5761f1 --- /dev/null +++ b/src/mobilerun/types/devices/app_start_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AppStartParams"] + + +class AppStartParams(TypedDict, total=False): + device_id: Required[Annotated[str, PropertyInfo(alias="deviceId")]] + + activity: str + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/keyboard_key_params.py b/src/mobilerun/types/devices/keyboard_key_params.py new file mode 100644 index 0000000..85854de --- /dev/null +++ b/src/mobilerun/types/devices/keyboard_key_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["KeyboardKeyParams"] + + +class KeyboardKeyParams(TypedDict, total=False): + key: Required[int] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/keyboard_write_params.py b/src/mobilerun/types/devices/keyboard_write_params.py new file mode 100644 index 0000000..69b8714 --- /dev/null +++ b/src/mobilerun/types/devices/keyboard_write_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["KeyboardWriteParams"] + + +class KeyboardWriteParams(TypedDict, total=False): + clear: Required[bool] + + text: Required[str] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/package_list_params.py b/src/mobilerun/types/devices/package_list_params.py new file mode 100644 index 0000000..450223e --- /dev/null +++ b/src/mobilerun/types/devices/package_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["PackageListParams"] + + +class PackageListParams(TypedDict, total=False): + include_system_packages: Annotated[bool, PropertyInfo(alias="includeSystemPackages")] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/package_list_response.py b/src/mobilerun/types/devices/package_list_response.py new file mode 100644 index 0000000..0ab9e4b --- /dev/null +++ b/src/mobilerun/types/devices/package_list_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +__all__ = ["PackageListResponse"] + +PackageListResponse: TypeAlias = List[str] diff --git a/src/mobilerun/types/devices/state_screenshot_params.py b/src/mobilerun/types/devices/state_screenshot_params.py new file mode 100644 index 0000000..fa4d0bd --- /dev/null +++ b/src/mobilerun/types/devices/state_screenshot_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StateScreenshotParams"] + + +class StateScreenshotParams(TypedDict, total=False): + hide_overlay: Annotated[bool, PropertyInfo(alias="hideOverlay")] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/state_screenshot_response.py b/src/mobilerun/types/devices/state_screenshot_response.py new file mode 100644 index 0000000..aaa4a93 --- /dev/null +++ b/src/mobilerun/types/devices/state_screenshot_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["StateScreenshotResponse"] + +StateScreenshotResponse: TypeAlias = str diff --git a/src/mobilerun/types/devices/state_time_response.py b/src/mobilerun/types/devices/state_time_response.py new file mode 100644 index 0000000..6aed1eb --- /dev/null +++ b/src/mobilerun/types/devices/state_time_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["StateTimeResponse"] + +StateTimeResponse: TypeAlias = str diff --git a/src/mobilerun/types/devices/state_ui_params.py b/src/mobilerun/types/devices/state_ui_params.py new file mode 100644 index 0000000..de012d2 --- /dev/null +++ b/src/mobilerun/types/devices/state_ui_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StateUiParams"] + + +class StateUiParams(TypedDict, total=False): + filter: bool + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun/types/devices/state_ui_response.py b/src/mobilerun/types/devices/state_ui_response.py new file mode 100644 index 0000000..5254229 --- /dev/null +++ b/src/mobilerun/types/devices/state_ui_response.py @@ -0,0 +1,91 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "StateUiResponse", + "DeviceContext", + "DeviceContextDisplayMetrics", + "DeviceContextFilteringParams", + "DeviceContextScreenBounds", + "DeviceContextScreenSize", + "PhoneState", + "PhoneStateFocusedElement", +] + + +class DeviceContextDisplayMetrics(BaseModel): + density: float + + density_dpi: int = FieldInfo(alias="densityDpi") + + height_pixels: int = FieldInfo(alias="heightPixels") + + scaled_density: float = FieldInfo(alias="scaledDensity") + + width_pixels: int = FieldInfo(alias="widthPixels") + + +class DeviceContextFilteringParams(BaseModel): + min_element_size: int + + overlay_offset: int + + +class DeviceContextScreenBounds(BaseModel): + height: int + + width: int + + +class DeviceContextScreenSize(BaseModel): + height: int + + width: int + + +class DeviceContext(BaseModel): + display_metrics: DeviceContextDisplayMetrics + + filtering_params: DeviceContextFilteringParams + + screen_bounds: DeviceContextScreenBounds + + screen_size: DeviceContextScreenSize = FieldInfo(alias="screenSize") + + +class PhoneStateFocusedElement(BaseModel): + class_name: Optional[str] = FieldInfo(alias="className", default=None) + + resource_id: Optional[str] = FieldInfo(alias="resourceId", default=None) + + text: Optional[str] = None + + +class PhoneState(BaseModel): + is_editable: bool = FieldInfo(alias="isEditable") + + keyboard_visible: bool = FieldInfo(alias="keyboardVisible") + + activity_name: Optional[str] = FieldInfo(alias="activityName", default=None) + + current_app: Optional[str] = FieldInfo(alias="currentApp", default=None) + + focused_element: Optional[PhoneStateFocusedElement] = FieldInfo(alias="focusedElement", default=None) + + package_name: Optional[str] = FieldInfo(alias="packageName", default=None) + + +class StateUiResponse(BaseModel): + a11y_tree: object + + device_context: DeviceContext + + phone_state: PhoneState + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun/types/devices/task_list_params.py b/src/mobilerun/types/devices/task_list_params.py new file mode 100644 index 0000000..6c98a67 --- /dev/null +++ b/src/mobilerun/types/devices/task_list_params.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TaskListParams"] + + +class TaskListParams(TypedDict, total=False): + order_by: Annotated[Literal["id", "createdAt", "updatedAt", "assignedAt"], PropertyInfo(alias="orderBy")] + + order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] + + page: int + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] diff --git a/src/mobilerun/types/devices/task_list_response.py b/src/mobilerun/types/devices/task_list_response.py new file mode 100644 index 0000000..a767345 --- /dev/null +++ b/src/mobilerun/types/devices/task_list_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TaskListResponse", "Item", "Pagination"] + + +class Item(BaseModel): + created_at: datetime = FieldInfo(alias="createdAt") + + task_id: str = FieldInfo(alias="taskId") + + updated_at: datetime = FieldInfo(alias="updatedAt") + + +class Pagination(BaseModel): + has_next: bool = FieldInfo(alias="hasNext") + + has_prev: bool = FieldInfo(alias="hasPrev") + + page: int + + pages: int + + page_size: int = FieldInfo(alias="pageSize") + + total: int + + +class TaskListResponse(BaseModel): + items: Optional[List[Item]] = None + + pagination: Pagination + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/tests/api_resources/devices/__init__.py b/tests/api_resources/devices/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/devices/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/devices/test_actions.py b/tests/api_resources/devices/test_actions.py new file mode 100644 index 0000000..dec3120 --- /dev/null +++ b/tests/api_resources/devices/test_actions.py @@ -0,0 +1,408 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from mobilerun import Mobilerun, AsyncMobilerun + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestActions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_global(self, client: Mobilerun) -> None: + action = client.devices.actions.global_( + device_id="deviceId", + action=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_global_with_all_params(self, client: Mobilerun) -> None: + action = client.devices.actions.global_( + device_id="deviceId", + action=0, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_global(self, client: Mobilerun) -> None: + response = client.devices.actions.with_raw_response.global_( + device_id="deviceId", + action=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_global(self, client: Mobilerun) -> None: + with client.devices.actions.with_streaming_response.global_( + device_id="deviceId", + action=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert action is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_global(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.actions.with_raw_response.global_( + device_id="", + action=0, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_swipe(self, client: Mobilerun) -> None: + action = client.devices.actions.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_swipe_with_all_params(self, client: Mobilerun) -> None: + action = client.devices.actions.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_swipe(self, client: Mobilerun) -> None: + response = client.devices.actions.with_raw_response.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_swipe(self, client: Mobilerun) -> None: + with client.devices.actions.with_streaming_response.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert action is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_swipe(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.actions.with_raw_response.swipe( + device_id="", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_tap(self, client: Mobilerun) -> None: + action = client.devices.actions.tap( + device_id="deviceId", + x=0, + y=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_tap_with_all_params(self, client: Mobilerun) -> None: + action = client.devices.actions.tap( + device_id="deviceId", + x=0, + y=0, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_tap(self, client: Mobilerun) -> None: + response = client.devices.actions.with_raw_response.tap( + device_id="deviceId", + x=0, + y=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_tap(self, client: Mobilerun) -> None: + with client.devices.actions.with_streaming_response.tap( + device_id="deviceId", + x=0, + y=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert action is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_tap(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.actions.with_raw_response.tap( + device_id="", + x=0, + y=0, + ) + + +class TestAsyncActions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_global(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.global_( + device_id="deviceId", + action=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_global_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.global_( + device_id="deviceId", + action=0, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_global(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.actions.with_raw_response.global_( + device_id="deviceId", + action=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_global(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.actions.with_streaming_response.global_( + device_id="deviceId", + action=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert action is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_global(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.actions.with_raw_response.global_( + device_id="", + action=0, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_swipe(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_swipe_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_swipe(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.actions.with_raw_response.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_swipe(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.actions.with_streaming_response.swipe( + device_id="deviceId", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert action is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_swipe(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.actions.with_raw_response.swipe( + device_id="", + duration=10, + end_x=0, + end_y=0, + start_x=0, + start_y=0, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_tap(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.tap( + device_id="deviceId", + x=0, + y=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_tap_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.tap( + device_id="deviceId", + x=0, + y=0, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_tap(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.actions.with_raw_response.tap( + device_id="deviceId", + x=0, + y=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert action is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_tap(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.actions.with_streaming_response.tap( + device_id="deviceId", + x=0, + y=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert action is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_tap(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.actions.with_raw_response.tap( + device_id="", + x=0, + y=0, + ) diff --git a/tests/api_resources/devices/test_apps.py b/tests/api_resources/devices/test_apps.py new file mode 100644 index 0000000..6469d82 --- /dev/null +++ b/tests/api_resources/devices/test_apps.py @@ -0,0 +1,490 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from mobilerun import Mobilerun, AsyncMobilerun +from tests.utils import assert_matches_type +from mobilerun.types.devices import AppListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestApps: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + app = client.devices.apps.list( + device_id="deviceId", + ) + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + app = client.devices.apps.list( + device_id="deviceId", + include_system_apps=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.devices.apps.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.devices.apps.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_list(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.apps.with_raw_response.list( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: Mobilerun) -> None: + app = client.devices.apps.delete( + package_name="packageName", + device_id="deviceId", + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete_with_all_params(self, client: Mobilerun) -> None: + app = client.devices.apps.delete( + package_name="packageName", + device_id="deviceId", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Mobilerun) -> None: + response = client.devices.apps.with_raw_response.delete( + package_name="packageName", + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Mobilerun) -> None: + with client.devices.apps.with_streaming_response.delete( + package_name="packageName", + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.apps.with_raw_response.delete( + package_name="packageName", + device_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): + client.devices.apps.with_raw_response.delete( + package_name="", + device_id="deviceId", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_install(self, client: Mobilerun) -> None: + app = client.devices.apps.install( + device_id="deviceId", + package_name="packageName", + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_install_with_all_params(self, client: Mobilerun) -> None: + app = client.devices.apps.install( + device_id="deviceId", + package_name="packageName", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_install(self, client: Mobilerun) -> None: + response = client.devices.apps.with_raw_response.install( + device_id="deviceId", + package_name="packageName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_install(self, client: Mobilerun) -> None: + with client.devices.apps.with_streaming_response.install( + device_id="deviceId", + package_name="packageName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_install(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.apps.with_raw_response.install( + device_id="", + package_name="packageName", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_start(self, client: Mobilerun) -> None: + app = client.devices.apps.start( + package_name="packageName", + device_id="deviceId", + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_start_with_all_params(self, client: Mobilerun) -> None: + app = client.devices.apps.start( + package_name="packageName", + device_id="deviceId", + activity="activity", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_start(self, client: Mobilerun) -> None: + response = client.devices.apps.with_raw_response.start( + package_name="packageName", + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_start(self, client: Mobilerun) -> None: + with client.devices.apps.with_streaming_response.start( + package_name="packageName", + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_start(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.apps.with_raw_response.start( + package_name="packageName", + device_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): + client.devices.apps.with_raw_response.start( + package_name="", + device_id="deviceId", + ) + + +class TestAsyncApps: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.list( + device_id="deviceId", + ) + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.list( + device_id="deviceId", + include_system_apps=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.apps.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.apps.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_list(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.apps.with_raw_response.list( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.delete( + package_name="packageName", + device_id="deviceId", + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.delete( + package_name="packageName", + device_id="deviceId", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.apps.with_raw_response.delete( + package_name="packageName", + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.apps.with_streaming_response.delete( + package_name="packageName", + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.apps.with_raw_response.delete( + package_name="packageName", + device_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): + await async_client.devices.apps.with_raw_response.delete( + package_name="", + device_id="deviceId", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_install(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.install( + device_id="deviceId", + package_name="packageName", + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_install_with_all_params(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.install( + device_id="deviceId", + package_name="packageName", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_install(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.apps.with_raw_response.install( + device_id="deviceId", + package_name="packageName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_install(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.apps.with_streaming_response.install( + device_id="deviceId", + package_name="packageName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_install(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.apps.with_raw_response.install( + device_id="", + package_name="packageName", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_start(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.start( + package_name="packageName", + device_id="deviceId", + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_start_with_all_params(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.start( + package_name="packageName", + device_id="deviceId", + activity="activity", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_start(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.apps.with_raw_response.start( + package_name="packageName", + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert app is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_start(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.apps.with_streaming_response.start( + package_name="packageName", + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_start(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.apps.with_raw_response.start( + package_name="packageName", + device_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `package_name` but received ''"): + await async_client.devices.apps.with_raw_response.start( + package_name="", + device_id="deviceId", + ) diff --git a/tests/api_resources/devices/test_keyboard.py b/tests/api_resources/devices/test_keyboard.py new file mode 100644 index 0000000..0b329c3 --- /dev/null +++ b/tests/api_resources/devices/test_keyboard.py @@ -0,0 +1,358 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from mobilerun import Mobilerun, AsyncMobilerun + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestKeyboard: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_clear(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.clear( + device_id="deviceId", + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_clear_with_all_params(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.clear( + device_id="deviceId", + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_clear(self, client: Mobilerun) -> None: + response = client.devices.keyboard.with_raw_response.clear( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + keyboard = response.parse() + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_clear(self, client: Mobilerun) -> None: + with client.devices.keyboard.with_streaming_response.clear( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + keyboard = response.parse() + assert keyboard is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_clear(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.keyboard.with_raw_response.clear( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_key(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.key( + device_id="deviceId", + key=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_key_with_all_params(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.key( + device_id="deviceId", + key=0, + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_key(self, client: Mobilerun) -> None: + response = client.devices.keyboard.with_raw_response.key( + device_id="deviceId", + key=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + keyboard = response.parse() + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_key(self, client: Mobilerun) -> None: + with client.devices.keyboard.with_streaming_response.key( + device_id="deviceId", + key=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + keyboard = response.parse() + assert keyboard is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_key(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.keyboard.with_raw_response.key( + device_id="", + key=0, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_write(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.write( + device_id="deviceId", + clear=True, + text="text", + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_write_with_all_params(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.write( + device_id="deviceId", + clear=True, + text="text", + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_write(self, client: Mobilerun) -> None: + response = client.devices.keyboard.with_raw_response.write( + device_id="deviceId", + clear=True, + text="text", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + keyboard = response.parse() + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_write(self, client: Mobilerun) -> None: + with client.devices.keyboard.with_streaming_response.write( + device_id="deviceId", + clear=True, + text="text", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + keyboard = response.parse() + assert keyboard is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_write(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.keyboard.with_raw_response.write( + device_id="", + clear=True, + text="text", + ) + + +class TestAsyncKeyboard: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_clear(self, async_client: AsyncMobilerun) -> None: + keyboard = await async_client.devices.keyboard.clear( + device_id="deviceId", + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_clear_with_all_params(self, async_client: AsyncMobilerun) -> None: + keyboard = await async_client.devices.keyboard.clear( + device_id="deviceId", + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_clear(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.keyboard.with_raw_response.clear( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + keyboard = await response.parse() + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_clear(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.keyboard.with_streaming_response.clear( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + keyboard = await response.parse() + assert keyboard is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_clear(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.keyboard.with_raw_response.clear( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_key(self, async_client: AsyncMobilerun) -> None: + keyboard = await async_client.devices.keyboard.key( + device_id="deviceId", + key=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_key_with_all_params(self, async_client: AsyncMobilerun) -> None: + keyboard = await async_client.devices.keyboard.key( + device_id="deviceId", + key=0, + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_key(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.keyboard.with_raw_response.key( + device_id="deviceId", + key=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + keyboard = await response.parse() + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_key(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.keyboard.with_streaming_response.key( + device_id="deviceId", + key=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + keyboard = await response.parse() + assert keyboard is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_key(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.keyboard.with_raw_response.key( + device_id="", + key=0, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_write(self, async_client: AsyncMobilerun) -> None: + keyboard = await async_client.devices.keyboard.write( + device_id="deviceId", + clear=True, + text="text", + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_write_with_all_params(self, async_client: AsyncMobilerun) -> None: + keyboard = await async_client.devices.keyboard.write( + device_id="deviceId", + clear=True, + text="text", + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_write(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.keyboard.with_raw_response.write( + device_id="deviceId", + clear=True, + text="text", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + keyboard = await response.parse() + assert keyboard is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_write(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.keyboard.with_streaming_response.write( + device_id="deviceId", + clear=True, + text="text", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + keyboard = await response.parse() + assert keyboard is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_write(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.keyboard.with_raw_response.write( + device_id="", + clear=True, + text="text", + ) diff --git a/tests/api_resources/devices/test_packages.py b/tests/api_resources/devices/test_packages.py new file mode 100644 index 0000000..1a02296 --- /dev/null +++ b/tests/api_resources/devices/test_packages.py @@ -0,0 +1,128 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from mobilerun import Mobilerun, AsyncMobilerun +from tests.utils import assert_matches_type +from mobilerun.types.devices import PackageListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPackages: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + package = client.devices.packages.list( + device_id="deviceId", + ) + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + package = client.devices.packages.list( + device_id="deviceId", + include_system_packages=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.devices.packages.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + package = response.parse() + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.devices.packages.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + package = response.parse() + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_list(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.packages.with_raw_response.list( + device_id="", + ) + + +class TestAsyncPackages: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + package = await async_client.devices.packages.list( + device_id="deviceId", + ) + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + package = await async_client.devices.packages.list( + device_id="deviceId", + include_system_packages=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.packages.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + package = await response.parse() + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.packages.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + package = await response.parse() + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_list(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.packages.with_raw_response.list( + device_id="", + ) diff --git a/tests/api_resources/devices/test_state.py b/tests/api_resources/devices/test_state.py new file mode 100644 index 0000000..27879b7 --- /dev/null +++ b/tests/api_resources/devices/test_state.py @@ -0,0 +1,336 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from mobilerun import Mobilerun, AsyncMobilerun +from tests.utils import assert_matches_type +from mobilerun.types.devices import ( + StateUiResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestState: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_screenshot(self, client: Mobilerun) -> None: + state = client.devices.state.screenshot( + device_id="deviceId", + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_screenshot_with_all_params(self, client: Mobilerun) -> None: + state = client.devices.state.screenshot( + device_id="deviceId", + hide_overlay=True, + x_device_display_id=0, + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_screenshot(self, client: Mobilerun) -> None: + response = client.devices.state.with_raw_response.screenshot( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = response.parse() + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_screenshot(self, client: Mobilerun) -> None: + with client.devices.state.with_streaming_response.screenshot( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = response.parse() + assert_matches_type(str, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_screenshot(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.state.with_raw_response.screenshot( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_time(self, client: Mobilerun) -> None: + state = client.devices.state.time( + device_id="deviceId", + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_time_with_all_params(self, client: Mobilerun) -> None: + state = client.devices.state.time( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_time(self, client: Mobilerun) -> None: + response = client.devices.state.with_raw_response.time( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = response.parse() + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_time(self, client: Mobilerun) -> None: + with client.devices.state.with_streaming_response.time( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = response.parse() + assert_matches_type(str, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_time(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.state.with_raw_response.time( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_ui(self, client: Mobilerun) -> None: + state = client.devices.state.ui( + device_id="deviceId", + ) + assert_matches_type(StateUiResponse, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_ui_with_all_params(self, client: Mobilerun) -> None: + state = client.devices.state.ui( + device_id="deviceId", + filter=True, + x_device_display_id=0, + ) + assert_matches_type(StateUiResponse, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_ui(self, client: Mobilerun) -> None: + response = client.devices.state.with_raw_response.ui( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = response.parse() + assert_matches_type(StateUiResponse, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_ui(self, client: Mobilerun) -> None: + with client.devices.state.with_streaming_response.ui( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = response.parse() + assert_matches_type(StateUiResponse, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_ui(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.state.with_raw_response.ui( + device_id="", + ) + + +class TestAsyncState: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_screenshot(self, async_client: AsyncMobilerun) -> None: + state = await async_client.devices.state.screenshot( + device_id="deviceId", + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_screenshot_with_all_params(self, async_client: AsyncMobilerun) -> None: + state = await async_client.devices.state.screenshot( + device_id="deviceId", + hide_overlay=True, + x_device_display_id=0, + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_screenshot(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.state.with_raw_response.screenshot( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = await response.parse() + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_screenshot(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.state.with_streaming_response.screenshot( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = await response.parse() + assert_matches_type(str, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_screenshot(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.state.with_raw_response.screenshot( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_time(self, async_client: AsyncMobilerun) -> None: + state = await async_client.devices.state.time( + device_id="deviceId", + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_time_with_all_params(self, async_client: AsyncMobilerun) -> None: + state = await async_client.devices.state.time( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_time(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.state.with_raw_response.time( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = await response.parse() + assert_matches_type(str, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_time(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.state.with_streaming_response.time( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = await response.parse() + assert_matches_type(str, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_time(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.state.with_raw_response.time( + device_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_ui(self, async_client: AsyncMobilerun) -> None: + state = await async_client.devices.state.ui( + device_id="deviceId", + ) + assert_matches_type(StateUiResponse, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_ui_with_all_params(self, async_client: AsyncMobilerun) -> None: + state = await async_client.devices.state.ui( + device_id="deviceId", + filter=True, + x_device_display_id=0, + ) + assert_matches_type(StateUiResponse, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_ui(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.state.with_raw_response.ui( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = await response.parse() + assert_matches_type(StateUiResponse, state, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_ui(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.state.with_streaming_response.ui( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = await response.parse() + assert_matches_type(StateUiResponse, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_ui(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.state.with_raw_response.ui( + device_id="", + ) diff --git a/tests/api_resources/devices/test_tasks.py b/tests/api_resources/devices/test_tasks.py new file mode 100644 index 0000000..0b41b32 --- /dev/null +++ b/tests/api_resources/devices/test_tasks.py @@ -0,0 +1,132 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from mobilerun import Mobilerun, AsyncMobilerun +from tests.utils import assert_matches_type +from mobilerun.types.devices import TaskListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTasks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + task = client.devices.tasks.list( + device_id="deviceId", + ) + assert_matches_type(TaskListResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + task = client.devices.tasks.list( + device_id="deviceId", + order_by="id", + order_by_direction="asc", + page=0, + page_size=0, + ) + assert_matches_type(TaskListResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.devices.tasks.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(TaskListResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.devices.tasks.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(TaskListResponse, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_list(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.tasks.with_raw_response.list( + device_id="", + ) + + +class TestAsyncTasks: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + task = await async_client.devices.tasks.list( + device_id="deviceId", + ) + assert_matches_type(TaskListResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + task = await async_client.devices.tasks.list( + device_id="deviceId", + order_by="id", + order_by_direction="asc", + page=0, + page_size=0, + ) + assert_matches_type(TaskListResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.tasks.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(TaskListResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.tasks.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(TaskListResponse, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_list(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.tasks.with_raw_response.list( + device_id="", + ) diff --git a/tests/api_resources/test_devices.py b/tests/api_resources/test_devices.py new file mode 100644 index 0000000..f762064 --- /dev/null +++ b/tests/api_resources/test_devices.py @@ -0,0 +1,514 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from mobilerun import Mobilerun, AsyncMobilerun +from tests.utils import assert_matches_type +from mobilerun.types import Device, DeviceListResponse, DeviceCountResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDevices: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: Mobilerun) -> None: + device = client.devices.create() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Mobilerun) -> None: + device = client.devices.create( + device_type="device_slot", + provider="limrun", + apps=["string"], + country="country", + files=["string"], + name="name", + proxy={ + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(Device, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + device = client.devices.retrieve( + "deviceId", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.retrieve( + "deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.retrieve( + "deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(Device, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_retrieve(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + device = client.devices.list() + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + device = client.devices.list( + country="country", + name="name", + order_by="id", + order_by_direction="asc", + page=0, + page_size=0, + provider="limrun", + state="creating", + type="device_slot", + ) + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(DeviceListResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_count(self, client: Mobilerun) -> None: + device = client.devices.count() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_count(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.count() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_count(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.count() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_terminate(self, client: Mobilerun) -> None: + device = client.devices.terminate( + "deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_terminate(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.terminate( + "deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert device is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_terminate(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.terminate( + "deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert device is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_terminate(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.with_raw_response.terminate( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_wait_ready(self, client: Mobilerun) -> None: + device = client.devices.wait_ready( + "deviceId", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_wait_ready(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.wait_ready( + "deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_wait_ready(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.wait_ready( + "deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(Device, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_wait_ready(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.with_raw_response.wait_ready( + "", + ) + + +class TestAsyncDevices: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.create() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.create( + device_type="device_slot", + provider="limrun", + apps=["string"], + country="country", + files=["string"], + name="name", + proxy={ + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert_matches_type(Device, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.retrieve( + "deviceId", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.retrieve( + "deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.retrieve( + "deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert_matches_type(Device, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.list() + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.list( + country="country", + name="name", + order_by="id", + order_by_direction="asc", + page=0, + page_size=0, + provider="limrun", + state="creating", + type="device_slot", + ) + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert_matches_type(DeviceListResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_count(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.count() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_count(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.count() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_count(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.count() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert_matches_type(DeviceCountResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_terminate(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.terminate( + "deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_terminate(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.terminate( + "deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert device is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_terminate(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.terminate( + "deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert device is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_terminate(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.with_raw_response.terminate( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_wait_ready(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.wait_ready( + "deviceId", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_wait_ready(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.wait_ready( + "deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_wait_ready(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.wait_ready( + "deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = await response.parse() + assert_matches_type(Device, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_wait_ready(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + await async_client.devices.with_raw_response.wait_ready( + "", + ) From e42aa5309759f931ceab3eee40792e559f21d3a3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:28:50 +0000 Subject: [PATCH 5/9] feat(api): api update --- .stats.yml | 4 ++-- src/mobilerun/types/llm_model.py | 4 +++- tests/api_resources/test_tasks.py | 32 +++++++++++++++---------------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.stats.yml b/.stats.yml index abeefba..b917ab0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-b3dca99ca43851c1e9adbb78ad6a8a5841cf0b559bf66663c947c41e8635901e.yml -openapi_spec_hash: 50964e3f8e40873dcb0a768a7fdf855d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-c7491cf4c81d979b97d7f40aba9ff49675eae88e04d567b0cd93101c00db3492.yml +openapi_spec_hash: a7db36b93ff62b223eb738a6f51f5e09 config_hash: d1f61f26938ee3af50fa5f703318307d diff --git a/src/mobilerun/types/llm_model.py b/src/mobilerun/types/llm_model.py index b42bc72..f0a0dca 100644 --- a/src/mobilerun/types/llm_model.py +++ b/src/mobilerun/types/llm_model.py @@ -5,9 +5,11 @@ __all__ = ["LlmModel"] LlmModel: TypeAlias = Literal[ - "openai/gpt-5", + "openai/gpt-5.1", + "openai/gpt-5.2", "google/gemini-2.5-flash", "google/gemini-2.5-pro", + "google/gemini-3-flash", "google/gemini-3-pro-preview", "anthropic/claude-sonnet-4.5", "minimax/minimax-m2", diff --git a/tests/api_resources/test_tasks.py b/tests/api_resources/test_tasks.py index d14af58..2a19e53 100644 --- a/tests/api_resources/test_tasks.py +++ b/tests/api_resources/test_tasks.py @@ -237,7 +237,7 @@ def test_path_params_get_trajectory(self, client: Mobilerun) -> None: @parametrize def test_method_run(self, client: Mobilerun) -> None: task = client.tasks.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) assert_matches_type(TaskRunResponse, task, path=["response"]) @@ -246,7 +246,7 @@ def test_method_run(self, client: Mobilerun) -> None: @parametrize def test_method_run_with_all_params(self, client: Mobilerun) -> None: task = client.tasks.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", apps=["string"], credentials=[ @@ -272,7 +272,7 @@ def test_method_run_with_all_params(self, client: Mobilerun) -> None: @parametrize def test_raw_response_run(self, client: Mobilerun) -> None: response = client.tasks.with_raw_response.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) @@ -285,7 +285,7 @@ def test_raw_response_run(self, client: Mobilerun) -> None: @parametrize def test_streaming_response_run(self, client: Mobilerun) -> None: with client.tasks.with_streaming_response.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) as response: assert not response.is_closed @@ -300,7 +300,7 @@ def test_streaming_response_run(self, client: Mobilerun) -> None: @parametrize def test_method_run_streamed(self, client: Mobilerun) -> None: task = client.tasks.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) assert task is None @@ -309,7 +309,7 @@ def test_method_run_streamed(self, client: Mobilerun) -> None: @parametrize def test_method_run_streamed_with_all_params(self, client: Mobilerun) -> None: task = client.tasks.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", apps=["string"], credentials=[ @@ -335,7 +335,7 @@ def test_method_run_streamed_with_all_params(self, client: Mobilerun) -> None: @parametrize def test_raw_response_run_streamed(self, client: Mobilerun) -> None: response = client.tasks.with_raw_response.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) @@ -348,7 +348,7 @@ def test_raw_response_run_streamed(self, client: Mobilerun) -> None: @parametrize def test_streaming_response_run_streamed(self, client: Mobilerun) -> None: with client.tasks.with_streaming_response.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) as response: assert not response.is_closed @@ -620,7 +620,7 @@ async def test_path_params_get_trajectory(self, async_client: AsyncMobilerun) -> @parametrize async def test_method_run(self, async_client: AsyncMobilerun) -> None: task = await async_client.tasks.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) assert_matches_type(TaskRunResponse, task, path=["response"]) @@ -629,7 +629,7 @@ async def test_method_run(self, async_client: AsyncMobilerun) -> None: @parametrize async def test_method_run_with_all_params(self, async_client: AsyncMobilerun) -> None: task = await async_client.tasks.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", apps=["string"], credentials=[ @@ -655,7 +655,7 @@ async def test_method_run_with_all_params(self, async_client: AsyncMobilerun) -> @parametrize async def test_raw_response_run(self, async_client: AsyncMobilerun) -> None: response = await async_client.tasks.with_raw_response.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) @@ -668,7 +668,7 @@ async def test_raw_response_run(self, async_client: AsyncMobilerun) -> None: @parametrize async def test_streaming_response_run(self, async_client: AsyncMobilerun) -> None: async with async_client.tasks.with_streaming_response.run( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) as response: assert not response.is_closed @@ -683,7 +683,7 @@ async def test_streaming_response_run(self, async_client: AsyncMobilerun) -> Non @parametrize async def test_method_run_streamed(self, async_client: AsyncMobilerun) -> None: task = await async_client.tasks.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) assert task is None @@ -692,7 +692,7 @@ async def test_method_run_streamed(self, async_client: AsyncMobilerun) -> None: @parametrize async def test_method_run_streamed_with_all_params(self, async_client: AsyncMobilerun) -> None: task = await async_client.tasks.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", apps=["string"], credentials=[ @@ -718,7 +718,7 @@ async def test_method_run_streamed_with_all_params(self, async_client: AsyncMobi @parametrize async def test_raw_response_run_streamed(self, async_client: AsyncMobilerun) -> None: response = await async_client.tasks.with_raw_response.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) @@ -731,7 +731,7 @@ async def test_raw_response_run_streamed(self, async_client: AsyncMobilerun) -> @parametrize async def test_streaming_response_run_streamed(self, async_client: AsyncMobilerun) -> None: async with async_client.tasks.with_streaming_response.run_streamed( - llm_model="openai/gpt-5", + llm_model="openai/gpt-5.1", task="x", ) as response: assert not response.is_closed From 099c2892e8aa33c0f7ec9d7c1d843d3050efb155 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 17:28:54 +0000 Subject: [PATCH 6/9] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b917ab0..4e28a5c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-c7491cf4c81d979b97d7f40aba9ff49675eae88e04d567b0cd93101c00db3492.yml -openapi_spec_hash: a7db36b93ff62b223eb738a6f51f5e09 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-e8819bf716fbe8dea79c4ba0056ac76ab711d1aa647205fb45f39e4c7f90e154.yml +openapi_spec_hash: c9f6063a93c55a53c90775686976ff0e config_hash: d1f61f26938ee3af50fa5f703318307d From 75af377b29fca57b52843186af3e9775bfc78c13 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 Jan 2026 07:31:49 +0000 Subject: [PATCH 7/9] chore(internal): update `actions/checkout` version --- .github/workflows/ci.yml | 6 +++--- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5dc504..9b49e67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/droidrun-cloud-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -44,7 +44,7 @@ jobs: id-token: write runs-on: ${{ github.repository == 'stainless-sdks/droidrun-cloud-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -81,7 +81,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/droidrun-cloud-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 33be2b4..965bfe5 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 66b9372..9f5c3c4 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'droidrun/mobilerun-sdk-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Check release environment run: | From bb822b02b08820aef23154468945101df3b9b3a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 Jan 2026 09:42:11 +0000 Subject: [PATCH 8/9] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4e28a5c..dfa5d3a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 50 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun%2Fdroidrun-cloud-e8819bf716fbe8dea79c4ba0056ac76ab711d1aa647205fb45f39e4c7f90e154.yml openapi_spec_hash: c9f6063a93c55a53c90775686976ff0e -config_hash: d1f61f26938ee3af50fa5f703318307d +config_hash: e86cf4289cfec730125313d2222d09e8 From 69fec946379aefd8e464355e0fb0d948d8537a00 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 Jan 2026 09:42:28 +0000 Subject: [PATCH 9/9] release: 2.1.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 17 +++++++++++++++++ pyproject.toml | 2 +- src/mobilerun/_version.py | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 65f558e..656a2ef 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.0" + ".": "2.1.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa3740..b710ef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 2.1.0 (2026-01-17) + +Full Changelog: [v2.0.0...v2.1.0](https://github.com/droidrun/mobilerun-sdk-python/compare/v2.0.0...v2.1.0) + +### Features + +* **api:** api update ([e42aa53](https://github.com/droidrun/mobilerun-sdk-python/commit/e42aa5309759f931ceab3eee40792e559f21d3a3)) +* **api:** api update ([866c20e](https://github.com/droidrun/mobilerun-sdk-python/commit/866c20ec6ebd177c861777fee900259186347ef0)) +* **api:** api update ([416142e](https://github.com/droidrun/mobilerun-sdk-python/commit/416142eb345a07aefea8404a97231ed0acd74678)) +* **api:** expose device count endpoint ([ab1191d](https://github.com/droidrun/mobilerun-sdk-python/commit/ab1191d28943441844e81c6c1189aebc34f54980)) +* **client:** add support for binary request streaming ([c6668af](https://github.com/droidrun/mobilerun-sdk-python/commit/c6668af5dbd83d7ab1dd1fe4f68253422e055e73)) + + +### Chores + +* **internal:** update `actions/checkout` version ([75af377](https://github.com/droidrun/mobilerun-sdk-python/commit/75af377b29fca57b52843186af3e9775bfc78c13)) + ## 2.0.0 (2026-01-12) Full Changelog: [v0.1.0...v2.0.0](https://github.com/droidrun/mobilerun-sdk-python/compare/v0.1.0...v2.0.0) diff --git a/pyproject.toml b/pyproject.toml index 4874197..2ca5b27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mobilerun-sdk" -version = "2.0.0" +version = "2.1.0" description = "The official Python library for the mobilerun API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/mobilerun/_version.py b/src/mobilerun/_version.py index ed7458a..f24f62b 100644 --- a/src/mobilerun/_version.py +++ b/src/mobilerun/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "mobilerun" -__version__ = "2.0.0" # x-release-please-version +__version__ = "2.1.0" # x-release-please-version