From 4e2a5f02ec63f7f2b106042041efa96e1265668f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 14:14:21 +0000 Subject: [PATCH 01/10] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9e5c2f5..6288087 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 160 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-d45f6eec4623ab6146f79fd62b69435949b99b7cdd0c89379363d2be3ed1ac7c.yml -openapi_spec_hash: 1f5262ae5849178b5dfd766537910ec5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-866c055fa1341310ae4293cb69ed3d22b62b3b5dbcaa87458f656dbb97cea800.yml +openapi_spec_hash: 13718cfca0c03631854de2cb236e5f3e config_hash: 0636636df2adbdea4b2e982ab5c858d4 From ee37ca601d0b87118e80f4fe38fd1e8660ed3543 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 18:14:27 +0000 Subject: [PATCH 02/10] feat(api): api update --- .stats.yml | 6 +- api.md | 47 +- src/mobilerun_sdk/_client.py | 38 - src/mobilerun_sdk/resources/__init__.py | 14 - src/mobilerun_sdk/resources/devices/apps.py | 10 +- src/mobilerun_sdk/resources/hooks.py | 797 ------------------ .../workflows/{events => }/events.py | 58 +- .../resources/workflows/events/__init__.py | 33 - .../resources/workflows/events/catalog.py | 267 ------ .../resources/workflows/workflows.py | 16 +- src/mobilerun_sdk/types/__init__.py | 13 - src/mobilerun_sdk/types/devices/__init__.py | 1 + .../types/devices/app_stop_params.py | 18 + .../types/hook_get_sample_data_response.py | 35 - src/mobilerun_sdk/types/hook_list_params.py | 20 - src/mobilerun_sdk/types/hook_list_response.py | 39 - .../types/hook_perform_params.py | 12 - .../types/hook_perform_response.py | 8 - .../types/hook_retrieve_response.py | 30 - .../types/hook_subscribe_params.py | 25 - .../types/hook_subscribe_response.py | 26 - src/mobilerun_sdk/types/hook_test_params.py | 13 - src/mobilerun_sdk/types/hook_test_response.py | 25 - .../types/hook_unsubscribe_response.py | 15 - src/mobilerun_sdk/types/hook_update_params.py | 18 - .../types/hook_update_response.py | 26 - .../types/webhook_event_types_response.py | 3 +- .../types/workflows/event_dry_run_params.py | 2 + .../types/workflows/event_ingest_params.py | 2 + .../types/workflows/events/__init__.py | 5 - .../workflows/events/catalog_list_params.py | 17 - .../workflows/events/catalog_list_response.py | 32 - .../events/catalog_register_params.py | 26 - .../events/catalog_register_response.py | 9 - tests/api_resources/devices/test_apps.py | 6 +- tests/api_resources/test_hooks.py | 697 --------------- tests/api_resources/test_webhooks.py | 4 +- .../workflows/events/__init__.py | 1 - .../workflows/events/test_catalog.py | 201 ----- tests/api_resources/workflows/test_events.py | 4 + 40 files changed, 76 insertions(+), 2543 deletions(-) delete mode 100644 src/mobilerun_sdk/resources/hooks.py rename src/mobilerun_sdk/resources/workflows/{events => }/events.py (85%) delete mode 100644 src/mobilerun_sdk/resources/workflows/events/__init__.py delete mode 100644 src/mobilerun_sdk/resources/workflows/events/catalog.py create mode 100644 src/mobilerun_sdk/types/devices/app_stop_params.py delete mode 100644 src/mobilerun_sdk/types/hook_get_sample_data_response.py delete mode 100644 src/mobilerun_sdk/types/hook_list_params.py delete mode 100644 src/mobilerun_sdk/types/hook_list_response.py delete mode 100644 src/mobilerun_sdk/types/hook_perform_params.py delete mode 100644 src/mobilerun_sdk/types/hook_perform_response.py delete mode 100644 src/mobilerun_sdk/types/hook_retrieve_response.py delete mode 100644 src/mobilerun_sdk/types/hook_subscribe_params.py delete mode 100644 src/mobilerun_sdk/types/hook_subscribe_response.py delete mode 100644 src/mobilerun_sdk/types/hook_test_params.py delete mode 100644 src/mobilerun_sdk/types/hook_test_response.py delete mode 100644 src/mobilerun_sdk/types/hook_unsubscribe_response.py delete mode 100644 src/mobilerun_sdk/types/hook_update_params.py delete mode 100644 src/mobilerun_sdk/types/hook_update_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/events/catalog_list_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/events/catalog_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/events/catalog_register_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/events/catalog_register_response.py delete mode 100644 tests/api_resources/test_hooks.py delete mode 100644 tests/api_resources/workflows/events/__init__.py delete mode 100644 tests/api_resources/workflows/events/test_catalog.py diff --git a/.stats.yml b/.stats.yml index 6288087..18785ef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 160 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-866c055fa1341310ae4293cb69ed3d22b62b3b5dbcaa87458f656dbb97cea800.yml -openapi_spec_hash: 13718cfca0c03631854de2cb236e5f3e +configured_endpoints: 150 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-521a4a2c8ab8dd16173d533d8c851a057b04ff6d144bfa35a062103fbe417aef.yml +openapi_spec_hash: f3077f6c61aff5d5c4468a7968777041 config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/api.md b/api.md index 1c524a7..1a26682 100644 --- a/api.md +++ b/api.md @@ -182,7 +182,7 @@ Methods: - 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 -- client.devices.apps.stop(package_name, \*, device_id) -> None +- client.devices.apps.stop(package_name, \*, device_id, \*\*params) -> None ## Esim @@ -319,34 +319,6 @@ Methods: - client.devices.language.get(device_id) -> LanguageGetResponse - client.devices.language.set(device_id, \*\*params) -> None -# Hooks - -Types: - -```python -from mobilerun_sdk.types import ( - HookRetrieveResponse, - HookUpdateResponse, - HookListResponse, - HookGetSampleDataResponse, - HookPerformResponse, - HookSubscribeResponse, - HookTestResponse, - HookUnsubscribeResponse, -) -``` - -Methods: - -- client.hooks.retrieve(hook_id) -> HookRetrieveResponse -- client.hooks.update(hook_id, \*\*params) -> HookUpdateResponse -- client.hooks.list(\*\*params) -> HookListResponse -- client.hooks.get_sample_data() -> HookGetSampleDataResponse -- client.hooks.perform(\*\*params) -> HookPerformResponse -- client.hooks.subscribe(\*\*params) -> HookSubscribeResponse -- client.hooks.test(hook_id, \*\*params) -> HookTestResponse -- client.hooks.unsubscribe(hook_id) -> HookUnsubscribeResponse - # Models Types: @@ -662,21 +634,8 @@ from mobilerun_sdk.types.workflows import EventDryRunResponse, EventIngestRespon Methods: -- client.workflows.events.dry_run(\*\*params) -> EventDryRunResponse -- client.workflows.events.ingest(\*\*params) -> EventIngestResponse - -### Catalog - -Types: - -```python -from mobilerun_sdk.types.workflows.events import CatalogListResponse, CatalogRegisterResponse -``` - -Methods: - -- client.workflows.events.catalog.list(\*\*params) -> CatalogListResponse -- client.workflows.events.catalog.register(\*\*params) -> CatalogRegisterResponse +- client.workflows.events.dry_run(\*\*params) -> EventDryRunResponse +- client.workflows.events.ingest(\*\*params) -> EventIngestResponse ## Executions diff --git a/src/mobilerun_sdk/_client.py b/src/mobilerun_sdk/_client.py index f43b8dd..4f5c67e 100644 --- a/src/mobilerun_sdk/_client.py +++ b/src/mobilerun_sdk/_client.py @@ -38,7 +38,6 @@ if TYPE_CHECKING: from .resources import ( apps, - hooks, tasks, models, connect, @@ -51,7 +50,6 @@ credentials, ) from .resources.apps import AppsResource, AsyncAppsResource - from .resources.hooks import HooksResource, AsyncHooksResource from .resources.models import ModelsResource, AsyncModelsResource from .resources.proxies import ProxiesResource, AsyncProxiesResource from .resources.carriers import CarriersResource, AsyncCarriersResource @@ -162,12 +160,6 @@ def devices(self) -> DevicesResource: return DevicesResource(self) - @cached_property - def hooks(self) -> HooksResource: - from .resources.hooks import HooksResource - - return HooksResource(self) - @cached_property def models(self) -> ModelsResource: """LLM Models""" @@ -424,12 +416,6 @@ def devices(self) -> AsyncDevicesResource: return AsyncDevicesResource(self) - @cached_property - def hooks(self) -> AsyncHooksResource: - from .resources.hooks import AsyncHooksResource - - return AsyncHooksResource(self) - @cached_property def models(self) -> AsyncModelsResource: """LLM Models""" @@ -632,12 +618,6 @@ def devices(self) -> devices.DevicesResourceWithRawResponse: return DevicesResourceWithRawResponse(self._client.devices) - @cached_property - def hooks(self) -> hooks.HooksResourceWithRawResponse: - from .resources.hooks import HooksResourceWithRawResponse - - return HooksResourceWithRawResponse(self._client.hooks) - @cached_property def models(self) -> models.ModelsResourceWithRawResponse: """LLM Models""" @@ -717,12 +697,6 @@ def devices(self) -> devices.AsyncDevicesResourceWithRawResponse: return AsyncDevicesResourceWithRawResponse(self._client.devices) - @cached_property - def hooks(self) -> hooks.AsyncHooksResourceWithRawResponse: - from .resources.hooks import AsyncHooksResourceWithRawResponse - - return AsyncHooksResourceWithRawResponse(self._client.hooks) - @cached_property def models(self) -> models.AsyncModelsResourceWithRawResponse: """LLM Models""" @@ -802,12 +776,6 @@ def devices(self) -> devices.DevicesResourceWithStreamingResponse: return DevicesResourceWithStreamingResponse(self._client.devices) - @cached_property - def hooks(self) -> hooks.HooksResourceWithStreamingResponse: - from .resources.hooks import HooksResourceWithStreamingResponse - - return HooksResourceWithStreamingResponse(self._client.hooks) - @cached_property def models(self) -> models.ModelsResourceWithStreamingResponse: """LLM Models""" @@ -887,12 +855,6 @@ def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse: return AsyncDevicesResourceWithStreamingResponse(self._client.devices) - @cached_property - def hooks(self) -> hooks.AsyncHooksResourceWithStreamingResponse: - from .resources.hooks import AsyncHooksResourceWithStreamingResponse - - return AsyncHooksResourceWithStreamingResponse(self._client.hooks) - @cached_property def models(self) -> models.AsyncModelsResourceWithStreamingResponse: """LLM Models""" diff --git a/src/mobilerun_sdk/resources/__init__.py b/src/mobilerun_sdk/resources/__init__.py index a0e7538..be9be40 100644 --- a/src/mobilerun_sdk/resources/__init__.py +++ b/src/mobilerun_sdk/resources/__init__.py @@ -8,14 +8,6 @@ AppsResourceWithStreamingResponse, AsyncAppsResourceWithStreamingResponse, ) -from .hooks import ( - HooksResource, - AsyncHooksResource, - HooksResourceWithRawResponse, - AsyncHooksResourceWithRawResponse, - HooksResourceWithStreamingResponse, - AsyncHooksResourceWithStreamingResponse, -) from .tasks import ( TasksResource, AsyncTasksResource, @@ -122,12 +114,6 @@ "AsyncDevicesResourceWithRawResponse", "DevicesResourceWithStreamingResponse", "AsyncDevicesResourceWithStreamingResponse", - "HooksResource", - "AsyncHooksResource", - "HooksResourceWithRawResponse", - "AsyncHooksResourceWithRawResponse", - "HooksResourceWithStreamingResponse", - "AsyncHooksResourceWithStreamingResponse", "ModelsResource", "AsyncModelsResource", "ModelsResourceWithRawResponse", diff --git a/src/mobilerun_sdk/resources/devices/apps.py b/src/mobilerun_sdk/resources/devices/apps.py index dbd6985..8798aeb 100644 --- a/src/mobilerun_sdk/resources/devices/apps.py +++ b/src/mobilerun_sdk/resources/devices/apps.py @@ -18,7 +18,7 @@ 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 import app_list_params, app_stop_params, app_start_params, app_install_params from ...types.devices.app_list_response import AppListResponse __all__ = ["AppsResource", "AsyncAppsResource"] @@ -298,6 +298,7 @@ def stop( package_name: str, *, device_id: str, + clear_data: 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. @@ -310,6 +311,8 @@ def stop( Stop app Args: + clear_data: If true, clears all app data (pm clear) in addition to stopping the app. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -331,6 +334,7 @@ def stop( } return self._patch( path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), + body=maybe_transform({"clear_data": clear_data}, app_stop_params.AppStopParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -612,6 +616,7 @@ async def stop( package_name: str, *, device_id: str, + clear_data: 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. @@ -624,6 +629,8 @@ async def stop( Stop app Args: + clear_data: If true, clears all app data (pm clear) in addition to stopping the app. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -645,6 +652,7 @@ async def stop( } return await self._patch( path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), + body=await async_maybe_transform({"clear_data": clear_data}, app_stop_params.AppStopParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/mobilerun_sdk/resources/hooks.py b/src/mobilerun_sdk/resources/hooks.py deleted file mode 100644 index 6f3c43b..0000000 --- a/src/mobilerun_sdk/resources/hooks.py +++ /dev/null @@ -1,797 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Literal - -import httpx - -from ..types import hook_list_params, hook_test_params, hook_update_params, hook_perform_params, hook_subscribe_params -from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from .._utils import path_template, 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.hook_list_response import HookListResponse -from ..types.hook_test_response import HookTestResponse -from ..types.hook_update_response import HookUpdateResponse -from ..types.hook_perform_response import HookPerformResponse -from ..types.hook_retrieve_response import HookRetrieveResponse -from ..types.hook_subscribe_response import HookSubscribeResponse -from ..types.hook_unsubscribe_response import HookUnsubscribeResponse -from ..types.hook_get_sample_data_response import HookGetSampleDataResponse - -__all__ = ["HooksResource", "AsyncHooksResource"] - - -class HooksResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> HooksResourceWithRawResponse: - """ - 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 HooksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> HooksResourceWithStreamingResponse: - """ - 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 HooksResourceWithStreamingResponse(self) - - def retrieve( - self, - hook_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, - ) -> HookRetrieveResponse: - """ - Get a hook subscription by id. - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return self._get( - path_template("/hooks/{hook_id}", hook_id=hook_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookRetrieveResponse, - ) - - def update( - self, - hook_id: str, - *, - events: Optional[SequenceNotStr[str]] | Omit = omit, - state: Optional[str] | 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, - ) -> HookUpdateResponse: - """ - Edit a hook subscription (events or state). - - Allows updating the events filter and/or the state of a hook. - - Args: - events: Updated list of events to subscribe to - - state: Updated hook state (active, disabled, deleted) - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return self._post( - path_template("/hooks/{hook_id}/edit", hook_id=hook_id), - body=maybe_transform( - { - "events": events, - "state": state, - }, - hook_update_params.HookUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookUpdateResponse, - ) - - def list( - self, - *, - order_by: Optional[str] | 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, - ) -> HookListResponse: - """ - List hooks belonging to the requesting user (paginated). - - 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( - "/hooks", - 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, - }, - hook_list_params.HookListParams, - ), - ), - cast_to=HookListResponse, - ) - - def get_sample_data( - 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, - ) -> HookGetSampleDataResponse: - """Get sample hook data for Zapier Perform List (testing/field mapping).""" - return self._get( - "/hooks/sample", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookGetSampleDataResponse, - ) - - def perform( - self, - *, - body: Dict[str, object], - # 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, - ) -> HookPerformResponse: - """ - Zapier Perform endpoint - processes webhook payloads. - - 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( - "/hooks/perform", - body=maybe_transform(body, hook_perform_params.HookPerformParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookPerformResponse, - ) - - def subscribe( - self, - *, - target_url: str, - events: Optional[SequenceNotStr[str]] | Omit = omit, - service: Optional[str] | 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, - ) -> HookSubscribeResponse: - """Subscribe the current user to a webhook URL. - - Returns subscription id. - - Args: - target_url: The webhook URL to send notifications to - - events: List of task events to subscribe to (created, running, completed, failed, - cancelled, paused) - - service: Service that receives the webhook - - 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( - "/hooks/subscribe", - body=maybe_transform( - { - "target_url": target_url, - "events": events, - "service": service, - }, - hook_subscribe_params.HookSubscribeParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookSubscribeResponse, - ) - - def test( - self, - hook_id: str, - *, - event: Optional[str] | 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, - ) -> HookTestResponse: - """ - Send a test event to a webhook endpoint. - - Delivers a sample payload to the hook's URL with a single attempt (no retries) - for fast feedback. - - Args: - event: Event type to simulate (default: completed) - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return self._post( - path_template("/hooks/{hook_id}/test", hook_id=hook_id), - body=maybe_transform({"event": event}, hook_test_params.HookTestParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookTestResponse, - ) - - def unsubscribe( - self, - hook_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, - ) -> HookUnsubscribeResponse: - """ - Unsubscribe a previously created subscription by id. - - Permanently deletes the subscription if it belongs to the user. - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return self._post( - path_template("/hooks/{hook_id}/unsubscribe", hook_id=hook_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookUnsubscribeResponse, - ) - - -class AsyncHooksResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncHooksResourceWithRawResponse: - """ - 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 AsyncHooksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncHooksResourceWithStreamingResponse: - """ - 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 AsyncHooksResourceWithStreamingResponse(self) - - async def retrieve( - self, - hook_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, - ) -> HookRetrieveResponse: - """ - Get a hook subscription by id. - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return await self._get( - path_template("/hooks/{hook_id}", hook_id=hook_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookRetrieveResponse, - ) - - async def update( - self, - hook_id: str, - *, - events: Optional[SequenceNotStr[str]] | Omit = omit, - state: Optional[str] | 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, - ) -> HookUpdateResponse: - """ - Edit a hook subscription (events or state). - - Allows updating the events filter and/or the state of a hook. - - Args: - events: Updated list of events to subscribe to - - state: Updated hook state (active, disabled, deleted) - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return await self._post( - path_template("/hooks/{hook_id}/edit", hook_id=hook_id), - body=await async_maybe_transform( - { - "events": events, - "state": state, - }, - hook_update_params.HookUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookUpdateResponse, - ) - - async def list( - self, - *, - order_by: Optional[str] | 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, - ) -> HookListResponse: - """ - List hooks belonging to the requesting user (paginated). - - 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( - "/hooks", - 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, - }, - hook_list_params.HookListParams, - ), - ), - cast_to=HookListResponse, - ) - - async def get_sample_data( - 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, - ) -> HookGetSampleDataResponse: - """Get sample hook data for Zapier Perform List (testing/field mapping).""" - return await self._get( - "/hooks/sample", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookGetSampleDataResponse, - ) - - async def perform( - self, - *, - body: Dict[str, object], - # 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, - ) -> HookPerformResponse: - """ - Zapier Perform endpoint - processes webhook payloads. - - 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( - "/hooks/perform", - body=await async_maybe_transform(body, hook_perform_params.HookPerformParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookPerformResponse, - ) - - async def subscribe( - self, - *, - target_url: str, - events: Optional[SequenceNotStr[str]] | Omit = omit, - service: Optional[str] | 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, - ) -> HookSubscribeResponse: - """Subscribe the current user to a webhook URL. - - Returns subscription id. - - Args: - target_url: The webhook URL to send notifications to - - events: List of task events to subscribe to (created, running, completed, failed, - cancelled, paused) - - service: Service that receives the webhook - - 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( - "/hooks/subscribe", - body=await async_maybe_transform( - { - "target_url": target_url, - "events": events, - "service": service, - }, - hook_subscribe_params.HookSubscribeParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookSubscribeResponse, - ) - - async def test( - self, - hook_id: str, - *, - event: Optional[str] | 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, - ) -> HookTestResponse: - """ - Send a test event to a webhook endpoint. - - Delivers a sample payload to the hook's URL with a single attempt (no retries) - for fast feedback. - - Args: - event: Event type to simulate (default: completed) - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return await self._post( - path_template("/hooks/{hook_id}/test", hook_id=hook_id), - body=await async_maybe_transform({"event": event}, hook_test_params.HookTestParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookTestResponse, - ) - - async def unsubscribe( - self, - hook_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, - ) -> HookUnsubscribeResponse: - """ - Unsubscribe a previously created subscription by id. - - Permanently deletes the subscription if it belongs to the user. - - 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 hook_id: - raise ValueError(f"Expected a non-empty value for `hook_id` but received {hook_id!r}") - return await self._post( - path_template("/hooks/{hook_id}/unsubscribe", hook_id=hook_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=HookUnsubscribeResponse, - ) - - -class HooksResourceWithRawResponse: - def __init__(self, hooks: HooksResource) -> None: - self._hooks = hooks - - self.retrieve = to_raw_response_wrapper( - hooks.retrieve, - ) - self.update = to_raw_response_wrapper( - hooks.update, - ) - self.list = to_raw_response_wrapper( - hooks.list, - ) - self.get_sample_data = to_raw_response_wrapper( - hooks.get_sample_data, - ) - self.perform = to_raw_response_wrapper( - hooks.perform, - ) - self.subscribe = to_raw_response_wrapper( - hooks.subscribe, - ) - self.test = to_raw_response_wrapper( - hooks.test, - ) - self.unsubscribe = to_raw_response_wrapper( - hooks.unsubscribe, - ) - - -class AsyncHooksResourceWithRawResponse: - def __init__(self, hooks: AsyncHooksResource) -> None: - self._hooks = hooks - - self.retrieve = async_to_raw_response_wrapper( - hooks.retrieve, - ) - self.update = async_to_raw_response_wrapper( - hooks.update, - ) - self.list = async_to_raw_response_wrapper( - hooks.list, - ) - self.get_sample_data = async_to_raw_response_wrapper( - hooks.get_sample_data, - ) - self.perform = async_to_raw_response_wrapper( - hooks.perform, - ) - self.subscribe = async_to_raw_response_wrapper( - hooks.subscribe, - ) - self.test = async_to_raw_response_wrapper( - hooks.test, - ) - self.unsubscribe = async_to_raw_response_wrapper( - hooks.unsubscribe, - ) - - -class HooksResourceWithStreamingResponse: - def __init__(self, hooks: HooksResource) -> None: - self._hooks = hooks - - self.retrieve = to_streamed_response_wrapper( - hooks.retrieve, - ) - self.update = to_streamed_response_wrapper( - hooks.update, - ) - self.list = to_streamed_response_wrapper( - hooks.list, - ) - self.get_sample_data = to_streamed_response_wrapper( - hooks.get_sample_data, - ) - self.perform = to_streamed_response_wrapper( - hooks.perform, - ) - self.subscribe = to_streamed_response_wrapper( - hooks.subscribe, - ) - self.test = to_streamed_response_wrapper( - hooks.test, - ) - self.unsubscribe = to_streamed_response_wrapper( - hooks.unsubscribe, - ) - - -class AsyncHooksResourceWithStreamingResponse: - def __init__(self, hooks: AsyncHooksResource) -> None: - self._hooks = hooks - - self.retrieve = async_to_streamed_response_wrapper( - hooks.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - hooks.update, - ) - self.list = async_to_streamed_response_wrapper( - hooks.list, - ) - self.get_sample_data = async_to_streamed_response_wrapper( - hooks.get_sample_data, - ) - self.perform = async_to_streamed_response_wrapper( - hooks.perform, - ) - self.subscribe = async_to_streamed_response_wrapper( - hooks.subscribe, - ) - self.test = async_to_streamed_response_wrapper( - hooks.test, - ) - self.unsubscribe = async_to_streamed_response_wrapper( - hooks.unsubscribe, - ) diff --git a/src/mobilerun_sdk/resources/workflows/events/events.py b/src/mobilerun_sdk/resources/workflows/events.py similarity index 85% rename from src/mobilerun_sdk/resources/workflows/events/events.py rename to src/mobilerun_sdk/resources/workflows/events.py index 450f4bb..34c5350 100644 --- a/src/mobilerun_sdk/resources/workflows/events/events.py +++ b/src/mobilerun_sdk/resources/workflows/events.py @@ -6,37 +6,25 @@ import httpx -from .catalog import ( - CatalogResource, - AsyncCatalogResource, - CatalogResourceWithRawResponse, - AsyncCatalogResourceWithRawResponse, - CatalogResourceWithStreamingResponse, - AsyncCatalogResourceWithStreamingResponse, -) -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 ( +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.workflows import event_ingest_params, event_dry_run_params -from ....types.workflows.event_ingest_response import EventIngestResponse -from ....types.workflows.event_dry_run_response import EventDryRunResponse +from ..._base_client import make_request_options +from ...types.workflows import event_ingest_params, event_dry_run_params +from ...types.workflows.event_ingest_response import EventIngestResponse +from ...types.workflows.event_dry_run_response import EventDryRunResponse __all__ = ["EventsResource", "AsyncEventsResource"] class EventsResource(SyncAPIResource): - @cached_property - def catalog(self) -> CatalogResource: - return CatalogResource(self._client) - @cached_property def with_raw_response(self) -> EventsResourceWithRawResponse: """ @@ -60,6 +48,7 @@ def dry_run( self, *, event_type: str, + device_id: str | Omit = omit, payload: Dict[str, Optional[object]] | 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. @@ -87,6 +76,7 @@ def dry_run( body=maybe_transform( { "event_type": event_type, + "device_id": device_id, "payload": payload, }, event_dry_run_params.EventDryRunParams, @@ -101,6 +91,7 @@ def ingest( self, *, event_type: str, + device_id: str | Omit = omit, payload: Dict[str, Optional[object]] | 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. @@ -127,6 +118,7 @@ def ingest( body=maybe_transform( { "event_type": event_type, + "device_id": device_id, "payload": payload, }, event_ingest_params.EventIngestParams, @@ -139,10 +131,6 @@ def ingest( class AsyncEventsResource(AsyncAPIResource): - @cached_property - def catalog(self) -> AsyncCatalogResource: - return AsyncCatalogResource(self._client) - @cached_property def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: """ @@ -166,6 +154,7 @@ async def dry_run( self, *, event_type: str, + device_id: str | Omit = omit, payload: Dict[str, Optional[object]] | 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. @@ -193,6 +182,7 @@ async def dry_run( body=await async_maybe_transform( { "event_type": event_type, + "device_id": device_id, "payload": payload, }, event_dry_run_params.EventDryRunParams, @@ -207,6 +197,7 @@ async def ingest( self, *, event_type: str, + device_id: str | Omit = omit, payload: Dict[str, Optional[object]] | 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. @@ -233,6 +224,7 @@ async def ingest( body=await async_maybe_transform( { "event_type": event_type, + "device_id": device_id, "payload": payload, }, event_ingest_params.EventIngestParams, @@ -255,10 +247,6 @@ def __init__(self, events: EventsResource) -> None: events.ingest, ) - @cached_property - def catalog(self) -> CatalogResourceWithRawResponse: - return CatalogResourceWithRawResponse(self._events.catalog) - class AsyncEventsResourceWithRawResponse: def __init__(self, events: AsyncEventsResource) -> None: @@ -271,10 +259,6 @@ def __init__(self, events: AsyncEventsResource) -> None: events.ingest, ) - @cached_property - def catalog(self) -> AsyncCatalogResourceWithRawResponse: - return AsyncCatalogResourceWithRawResponse(self._events.catalog) - class EventsResourceWithStreamingResponse: def __init__(self, events: EventsResource) -> None: @@ -287,10 +271,6 @@ def __init__(self, events: EventsResource) -> None: events.ingest, ) - @cached_property - def catalog(self) -> CatalogResourceWithStreamingResponse: - return CatalogResourceWithStreamingResponse(self._events.catalog) - class AsyncEventsResourceWithStreamingResponse: def __init__(self, events: AsyncEventsResource) -> None: @@ -302,7 +282,3 @@ def __init__(self, events: AsyncEventsResource) -> None: self.ingest = async_to_streamed_response_wrapper( events.ingest, ) - - @cached_property - def catalog(self) -> AsyncCatalogResourceWithStreamingResponse: - return AsyncCatalogResourceWithStreamingResponse(self._events.catalog) diff --git a/src/mobilerun_sdk/resources/workflows/events/__init__.py b/src/mobilerun_sdk/resources/workflows/events/__init__.py deleted file mode 100644 index 2c1e382..0000000 --- a/src/mobilerun_sdk/resources/workflows/events/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from .catalog import ( - CatalogResource, - AsyncCatalogResource, - CatalogResourceWithRawResponse, - AsyncCatalogResourceWithRawResponse, - CatalogResourceWithStreamingResponse, - AsyncCatalogResourceWithStreamingResponse, -) - -__all__ = [ - "CatalogResource", - "AsyncCatalogResource", - "CatalogResourceWithRawResponse", - "AsyncCatalogResourceWithRawResponse", - "CatalogResourceWithStreamingResponse", - "AsyncCatalogResourceWithStreamingResponse", - "EventsResource", - "AsyncEventsResource", - "EventsResourceWithRawResponse", - "AsyncEventsResourceWithRawResponse", - "EventsResourceWithStreamingResponse", - "AsyncEventsResourceWithStreamingResponse", -] diff --git a/src/mobilerun_sdk/resources/workflows/events/catalog.py b/src/mobilerun_sdk/resources/workflows/events/catalog.py deleted file mode 100644 index 73c22cc..0000000 --- a/src/mobilerun_sdk/resources/workflows/events/catalog.py +++ /dev/null @@ -1,267 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -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.workflows.events import catalog_list_params, catalog_register_params -from ....types.workflows.events.catalog_list_response import CatalogListResponse -from ....types.workflows.events.catalog_register_response import CatalogRegisterResponse - -__all__ = ["CatalogResource", "AsyncCatalogResource"] - - -class CatalogResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CatalogResourceWithRawResponse: - """ - 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 CatalogResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CatalogResourceWithStreamingResponse: - """ - 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 CatalogResourceWithStreamingResponse(self) - - def list( - self, - *, - page: int | Omit = omit, - page_size: int | Omit = omit, - source: Literal["device", "system", "webhook"] | 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, - ) -> CatalogListResponse: - """ - List event catalog - - 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( - "/events/catalog", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "page": page, - "page_size": page_size, - "source": source, - }, - catalog_list_params.CatalogListParams, - ), - ), - cast_to=CatalogListResponse, - ) - - def register( - self, - *, - events: Iterable[catalog_register_params.Event], - # 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, - ) -> CatalogRegisterResponse: - """ - Register event types in the catalog - - 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( - "/events/catalog/register", - body=maybe_transform({"events": events}, catalog_register_params.CatalogRegisterParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CatalogRegisterResponse, - ) - - -class AsyncCatalogResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCatalogResourceWithRawResponse: - """ - 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 AsyncCatalogResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCatalogResourceWithStreamingResponse: - """ - 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 AsyncCatalogResourceWithStreamingResponse(self) - - async def list( - self, - *, - page: int | Omit = omit, - page_size: int | Omit = omit, - source: Literal["device", "system", "webhook"] | 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, - ) -> CatalogListResponse: - """ - List event catalog - - 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( - "/events/catalog", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "page": page, - "page_size": page_size, - "source": source, - }, - catalog_list_params.CatalogListParams, - ), - ), - cast_to=CatalogListResponse, - ) - - async def register( - self, - *, - events: Iterable[catalog_register_params.Event], - # 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, - ) -> CatalogRegisterResponse: - """ - Register event types in the catalog - - 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( - "/events/catalog/register", - body=await async_maybe_transform({"events": events}, catalog_register_params.CatalogRegisterParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CatalogRegisterResponse, - ) - - -class CatalogResourceWithRawResponse: - def __init__(self, catalog: CatalogResource) -> None: - self._catalog = catalog - - self.list = to_raw_response_wrapper( - catalog.list, - ) - self.register = to_raw_response_wrapper( - catalog.register, - ) - - -class AsyncCatalogResourceWithRawResponse: - def __init__(self, catalog: AsyncCatalogResource) -> None: - self._catalog = catalog - - self.list = async_to_raw_response_wrapper( - catalog.list, - ) - self.register = async_to_raw_response_wrapper( - catalog.register, - ) - - -class CatalogResourceWithStreamingResponse: - def __init__(self, catalog: CatalogResource) -> None: - self._catalog = catalog - - self.list = to_streamed_response_wrapper( - catalog.list, - ) - self.register = to_streamed_response_wrapper( - catalog.register, - ) - - -class AsyncCatalogResourceWithStreamingResponse: - def __init__(self, catalog: AsyncCatalogResource) -> None: - self._catalog = catalog - - self.list = async_to_streamed_response_wrapper( - catalog.list, - ) - self.register = async_to_streamed_response_wrapper( - catalog.register, - ) diff --git a/src/mobilerun_sdk/resources/workflows/workflows.py b/src/mobilerun_sdk/resources/workflows/workflows.py index 99d44df..000d4bf 100644 --- a/src/mobilerun_sdk/resources/workflows/workflows.py +++ b/src/mobilerun_sdk/resources/workflows/workflows.py @@ -2,6 +2,14 @@ from __future__ import annotations +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) from .triggers import ( TriggersResource, AsyncTriggersResource, @@ -36,14 +44,6 @@ FlowsResourceWithStreamingResponse, AsyncFlowsResourceWithStreamingResponse, ) -from .events.events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) from .action_catalog import ( ActionCatalogResource, AsyncActionCatalogResource, diff --git a/src/mobilerun_sdk/types/__init__.py b/src/mobilerun_sdk/types/__init__.py index 47250ab..ecf96d9 100644 --- a/src/mobilerun_sdk/types/__init__.py +++ b/src/mobilerun_sdk/types/__init__.py @@ -24,21 +24,15 @@ from .usage_result import UsageResult as UsageResult from .app_list_params import AppListParams as AppListParams from .task_run_params import TaskRunParams as TaskRunParams -from .hook_list_params import HookListParams as HookListParams -from .hook_test_params import HookTestParams as HookTestParams from .task_list_params import TaskListParams as TaskListParams from .app_list_response import AppListResponse as AppListResponse from .proxy_list_params import ProxyListParams as ProxyListParams 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_test_response import HookTestResponse as HookTestResponse -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 .app_delete_response import AppDeleteResponse as AppDeleteResponse from .carrier_list_params import CarrierListParams as CarrierListParams -from .hook_perform_params import HookPerformParams as HookPerformParams from .model_list_response import ModelListResponse as ModelListResponse from .package_credentials import PackageCredentials as PackageCredentials from .profile_list_params import ProfileListParams as ProfileListParams @@ -49,15 +43,12 @@ from .webhook_list_params import WebhookListParams as WebhookListParams 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 .app_retrieve_response import AppRetrieveResponse as AppRetrieveResponse from .carrier_create_params import CarrierCreateParams as CarrierCreateParams from .carrier_list_response import CarrierListResponse as CarrierListResponse from .carrier_lookup_params import CarrierLookupParams as CarrierLookupParams from .carrier_update_params import CarrierUpdateParams as CarrierUpdateParams 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 .profile_create_params import ProfileCreateParams as ProfileCreateParams from .profile_list_response import ProfileListResponse as ProfileListResponse from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams @@ -70,14 +61,12 @@ from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams from .credential_list_params import CredentialListParams as CredentialListParams from .device_set_name_params import DeviceSetNameParams as DeviceSetNameParams -from .hook_retrieve_response import HookRetrieveResponse as HookRetrieveResponse from .task_retrieve_response import TaskRetrieveResponse as TaskRetrieveResponse from .carrier_create_response import CarrierCreateResponse as CarrierCreateResponse from .carrier_delete_response import CarrierDeleteResponse as CarrierDeleteResponse from .carrier_lookup_response import CarrierLookupResponse as CarrierLookupResponse from .carrier_update_response import CarrierUpdateResponse as CarrierUpdateResponse from .device_terminate_params import DeviceTerminateParams as DeviceTerminateParams -from .hook_subscribe_response import HookSubscribeResponse as HookSubscribeResponse from .profile_delete_response import ProfileDeleteResponse as ProfileDeleteResponse from .proxy_retrieve_response import ProxyRetrieveResponse as ProxyRetrieveResponse from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse @@ -88,7 +77,6 @@ from .task_run_streamed_params import TaskRunStreamedParams as TaskRunStreamedParams from .task_send_message_params import TaskSendMessageParams as TaskSendMessageParams from .carrier_retrieve_response import CarrierRetrieveResponse as CarrierRetrieveResponse -from .hook_unsubscribe_response import HookUnsubscribeResponse as HookUnsubscribeResponse from .package_credentials_param import PackageCredentialsParam as PackageCredentialsParam from .webhook_retrieve_response import WebhookRetrieveResponse as WebhookRetrieveResponse from .app_list_versions_response import AppListVersionsResponse as AppListVersionsResponse @@ -97,7 +85,6 @@ from .device_fingerprint_response import DeviceFingerprintResponse as DeviceFingerprintResponse from .task_get_trajectory_response import TaskGetTrajectoryResponse as TaskGetTrajectoryResponse from .webhook_event_types_response import WebhookEventTypesResponse as WebhookEventTypesResponse -from .hook_get_sample_data_response import HookGetSampleDataResponse as HookGetSampleDataResponse from .webhook_rotate_secret_response import WebhookRotateSecretResponse as WebhookRotateSecretResponse from .webhook_test_delivery_response import WebhookTestDeliveryResponse as WebhookTestDeliveryResponse from .app_create_signed_upload_url_params import AppCreateSignedUploadURLParams as AppCreateSignedUploadURLParams diff --git a/src/mobilerun_sdk/types/devices/__init__.py b/src/mobilerun_sdk/types/devices/__init__.py index ab80387..dcd2cfa 100644 --- a/src/mobilerun_sdk/types/devices/__init__.py +++ b/src/mobilerun_sdk/types/devices/__init__.py @@ -6,6 +6,7 @@ from .file_info import FileInfo as FileInfo from .a11_y_node import A11YNode as A11YNode from .app_list_params import AppListParams as AppListParams +from .app_stop_params import AppStopParams as AppStopParams from .state_ui_params import StateUiParams as StateUiParams from .app_start_params import AppStartParams as AppStartParams from .file_list_params import FileListParams as FileListParams diff --git a/src/mobilerun_sdk/types/devices/app_stop_params.py b/src/mobilerun_sdk/types/devices/app_stop_params.py new file mode 100644 index 0000000..08dcece --- /dev/null +++ b/src/mobilerun_sdk/types/devices/app_stop_params.py @@ -0,0 +1,18 @@ +# 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__ = ["AppStopParams"] + + +class AppStopParams(TypedDict, total=False): + device_id: Required[Annotated[str, PropertyInfo(alias="deviceId")]] + + clear_data: Annotated[bool, PropertyInfo(alias="clearData")] + """If true, clears all app data (pm clear) in addition to stopping the app.""" + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/hook_get_sample_data_response.py b/src/mobilerun_sdk/types/hook_get_sample_data_response.py deleted file mode 100644 index ba0a5a2..0000000 --- a/src/mobilerun_sdk/types/hook_get_sample_data_response.py +++ /dev/null @@ -1,35 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import TypeAlias - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["HookGetSampleDataResponse", "HookGetSampleDataResponseItem"] - - -class HookGetSampleDataResponseItem(BaseModel): - """Sample webhook event data for testing/mapping in Zapier.""" - - id: str - """The subscription ID""" - - created_at: str = FieldInfo(alias="createdAt") - """ISO timestamp of when the subscription was created""" - - events: List[str] - """List of subscribed events""" - - state: str - """The hook state""" - - url: str - """The webhook URL""" - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - """ISO timestamp of the last update""" - - -HookGetSampleDataResponse: TypeAlias = List[HookGetSampleDataResponseItem] diff --git a/src/mobilerun_sdk/types/hook_list_params.py b/src/mobilerun_sdk/types/hook_list_params.py deleted file mode 100644 index 5d3fe14..0000000 --- a/src/mobilerun_sdk/types/hook_list_params.py +++ /dev/null @@ -1,20 +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, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["HookListParams"] - - -class HookListParams(TypedDict, total=False): - order_by: Annotated[Optional[str], 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_sdk/types/hook_list_response.py b/src/mobilerun_sdk/types/hook_list_response.py deleted file mode 100644 index 7ac5695..0000000 --- a/src/mobilerun_sdk/types/hook_list_response.py +++ /dev/null @@ -1,39 +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 typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .._models import BaseModel -from .task_status import TaskStatus -from .shared.pagination_meta import PaginationMeta - -__all__ = ["HookListResponse", "Item"] - - -class Item(BaseModel): - service: Literal["zapier", "n8n", "make", "internal", "other"] - - url: str - - user_id: str = FieldInfo(alias="userId") - - id: Optional[str] = None - - created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - - events: Optional[List[TaskStatus]] = None - - state: Optional[Literal["active", "disabled", "deleted"]] = None - - updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) - - -class HookListResponse(BaseModel): - items: List[Item] - """The paginated items""" - - pagination: PaginationMeta - """Pagination metadata""" diff --git a/src/mobilerun_sdk/types/hook_perform_params.py b/src/mobilerun_sdk/types/hook_perform_params.py deleted file mode 100644 index c1e0ed4..0000000 --- a/src/mobilerun_sdk/types/hook_perform_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict -from typing_extensions import Required, TypedDict - -__all__ = ["HookPerformParams"] - - -class HookPerformParams(TypedDict, total=False): - body: Required[Dict[str, object]] diff --git a/src/mobilerun_sdk/types/hook_perform_response.py b/src/mobilerun_sdk/types/hook_perform_response.py deleted file mode 100644 index fb77ef5..0000000 --- a/src/mobilerun_sdk/types/hook_perform_response.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List -from typing_extensions import TypeAlias - -__all__ = ["HookPerformResponse"] - -HookPerformResponse: TypeAlias = List[Dict[str, object]] diff --git a/src/mobilerun_sdk/types/hook_retrieve_response.py b/src/mobilerun_sdk/types/hook_retrieve_response.py deleted file mode 100644 index d09beb2..0000000 --- a/src/mobilerun_sdk/types/hook_retrieve_response.py +++ /dev/null @@ -1,30 +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 typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .._models import BaseModel -from .task_status import TaskStatus - -__all__ = ["HookRetrieveResponse"] - - -class HookRetrieveResponse(BaseModel): - service: Literal["zapier", "n8n", "make", "internal", "other"] - - url: str - - user_id: str = FieldInfo(alias="userId") - - id: Optional[str] = None - - created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - - events: Optional[List[TaskStatus]] = None - - state: Optional[Literal["active", "disabled", "deleted"]] = None - - updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) diff --git a/src/mobilerun_sdk/types/hook_subscribe_params.py b/src/mobilerun_sdk/types/hook_subscribe_params.py deleted file mode 100644 index 08412c9..0000000 --- a/src/mobilerun_sdk/types/hook_subscribe_params.py +++ /dev/null @@ -1,25 +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 Required, Annotated, TypedDict - -from .._types import SequenceNotStr -from .._utils import PropertyInfo - -__all__ = ["HookSubscribeParams"] - - -class HookSubscribeParams(TypedDict, total=False): - target_url: Required[Annotated[str, PropertyInfo(alias="targetUrl")]] - """The webhook URL to send notifications to""" - - events: Optional[SequenceNotStr[str]] - """ - List of task events to subscribe to (created, running, completed, failed, - cancelled, paused) - """ - - service: Optional[str] - """Service that receives the webhook""" diff --git a/src/mobilerun_sdk/types/hook_subscribe_response.py b/src/mobilerun_sdk/types/hook_subscribe_response.py deleted file mode 100644 index 0a830d4..0000000 --- a/src/mobilerun_sdk/types/hook_subscribe_response.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .._models import BaseModel - -__all__ = ["HookSubscribeResponse"] - - -class HookSubscribeResponse(BaseModel): - """Response model after successful subscription.""" - - id: str - """The subscription ID""" - - subscribed: bool - """Whether subscription was successful""" - - url: str - """The webhook URL""" - - events: Optional[List[str]] = None - """List of subscribed events""" - - service: Optional[str] = None - """Service that receives the webhook""" diff --git a/src/mobilerun_sdk/types/hook_test_params.py b/src/mobilerun_sdk/types/hook_test_params.py deleted file mode 100644 index af5edff..0000000 --- a/src/mobilerun_sdk/types/hook_test_params.py +++ /dev/null @@ -1,13 +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 TypedDict - -__all__ = ["HookTestParams"] - - -class HookTestParams(TypedDict, total=False): - event: Optional[str] - """Event type to simulate (default: completed)""" diff --git a/src/mobilerun_sdk/types/hook_test_response.py b/src/mobilerun_sdk/types/hook_test_response.py deleted file mode 100644 index 8d22bab..0000000 --- a/src/mobilerun_sdk/types/hook_test_response.py +++ /dev/null @@ -1,25 +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__ = ["HookTestResponse"] - - -class HookTestResponse(BaseModel): - """Response after attempting test delivery.""" - - id: str - """The hook ID""" - - success: bool - """Whether delivery succeeded (2xx)""" - - error: Optional[str] = None - """Error message if delivery failed""" - - status_code: Optional[int] = FieldInfo(alias="statusCode", default=None) - """HTTP status from target""" diff --git a/src/mobilerun_sdk/types/hook_unsubscribe_response.py b/src/mobilerun_sdk/types/hook_unsubscribe_response.py deleted file mode 100644 index 384d2fa..0000000 --- a/src/mobilerun_sdk/types/hook_unsubscribe_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .._models import BaseModel - -__all__ = ["HookUnsubscribeResponse"] - - -class HookUnsubscribeResponse(BaseModel): - """Response model after successful unsubscription.""" - - id: str - """The subscription ID""" - - unsubscribed: bool - """Whether unsubscription was successful""" diff --git a/src/mobilerun_sdk/types/hook_update_params.py b/src/mobilerun_sdk/types/hook_update_params.py deleted file mode 100644 index 024f44d..0000000 --- a/src/mobilerun_sdk/types/hook_update_params.py +++ /dev/null @@ -1,18 +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 TypedDict - -from .._types import SequenceNotStr - -__all__ = ["HookUpdateParams"] - - -class HookUpdateParams(TypedDict, total=False): - events: Optional[SequenceNotStr[str]] - """Updated list of events to subscribe to""" - - state: Optional[str] - """Updated hook state (active, disabled, deleted)""" diff --git a/src/mobilerun_sdk/types/hook_update_response.py b/src/mobilerun_sdk/types/hook_update_response.py deleted file mode 100644 index e362514..0000000 --- a/src/mobilerun_sdk/types/hook_update_response.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .._models import BaseModel - -__all__ = ["HookUpdateResponse"] - - -class HookUpdateResponse(BaseModel): - """Response model after successfully editing a hook.""" - - id: str - """The subscription ID""" - - state: str - """The hook state""" - - updated: bool - """Whether the hook was updated""" - - url: str - """The webhook URL""" - - events: Optional[List[str]] = None - """List of subscribed events""" diff --git a/src/mobilerun_sdk/types/webhook_event_types_response.py b/src/mobilerun_sdk/types/webhook_event_types_response.py index 2bc0051..11afece 100644 --- a/src/mobilerun_sdk/types/webhook_event_types_response.py +++ b/src/mobilerun_sdk/types/webhook_event_types_response.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List +from typing_extensions import Literal from pydantic import Field as FieldInfo @@ -22,7 +23,7 @@ class DataSource(BaseModel): class Data(BaseModel): - schema_version: float = FieldInfo(alias="schemaVersion") + schema_version: Literal[1] = FieldInfo(alias="schemaVersion") sources: List[DataSource] diff --git a/src/mobilerun_sdk/types/workflows/event_dry_run_params.py b/src/mobilerun_sdk/types/workflows/event_dry_run_params.py index 42cacb5..c55498e 100644 --- a/src/mobilerun_sdk/types/workflows/event_dry_run_params.py +++ b/src/mobilerun_sdk/types/workflows/event_dry_run_params.py @@ -13,4 +13,6 @@ class EventDryRunParams(TypedDict, total=False): event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] + device_id: Annotated[str, PropertyInfo(alias="deviceId")] + payload: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/event_ingest_params.py b/src/mobilerun_sdk/types/workflows/event_ingest_params.py index 345113f..d8edf19 100644 --- a/src/mobilerun_sdk/types/workflows/event_ingest_params.py +++ b/src/mobilerun_sdk/types/workflows/event_ingest_params.py @@ -13,4 +13,6 @@ class EventIngestParams(TypedDict, total=False): event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] + device_id: Annotated[str, PropertyInfo(alias="deviceId")] + payload: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/events/__init__.py b/src/mobilerun_sdk/types/workflows/events/__init__.py index 32807f2..f8ee8b1 100644 --- a/src/mobilerun_sdk/types/workflows/events/__init__.py +++ b/src/mobilerun_sdk/types/workflows/events/__init__.py @@ -1,8 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .catalog_list_params import CatalogListParams as CatalogListParams -from .catalog_list_response import CatalogListResponse as CatalogListResponse -from .catalog_register_params import CatalogRegisterParams as CatalogRegisterParams -from .catalog_register_response import CatalogRegisterResponse as CatalogRegisterResponse diff --git a/src/mobilerun_sdk/types/workflows/events/catalog_list_params.py b/src/mobilerun_sdk/types/workflows/events/catalog_list_params.py deleted file mode 100644 index ca0def1..0000000 --- a/src/mobilerun_sdk/types/workflows/events/catalog_list_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 Literal, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["CatalogListParams"] - - -class CatalogListParams(TypedDict, total=False): - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - - source: Literal["device", "system", "webhook"] diff --git a/src/mobilerun_sdk/types/workflows/events/catalog_list_response.py b/src/mobilerun_sdk/types/workflows/events/catalog_list_response.py deleted file mode 100644 index 86c96b2..0000000 --- a/src/mobilerun_sdk/types/workflows/events/catalog_list_response.py +++ /dev/null @@ -1,32 +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 ...._models import BaseModel -from ...shared.pagination import Pagination - -__all__ = ["CatalogListResponse", "Item"] - - -class Item(BaseModel): - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - description: Optional[str] = None - - event_type: str = FieldInfo(alias="eventType") - - label: str - - source: Optional[str] = None - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - payload_schema: Optional[object] = FieldInfo(alias="payloadSchema", default=None) - - -class CatalogListResponse(BaseModel): - items: List[Item] - - pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/events/catalog_register_params.py b/src/mobilerun_sdk/types/workflows/events/catalog_register_params.py deleted file mode 100644 index da648c3..0000000 --- a/src/mobilerun_sdk/types/workflows/events/catalog_register_params.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["CatalogRegisterParams", "Event"] - - -class CatalogRegisterParams(TypedDict, total=False): - events: Required[Iterable[Event]] - - -class Event(TypedDict, total=False): - event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] - - label: Required[str] - - description: str - - payload_schema: Annotated[Dict[str, Optional[object]], PropertyInfo(alias="payloadSchema")] - - source: Literal["device", "system", "webhook"] diff --git a/src/mobilerun_sdk/types/workflows/events/catalog_register_response.py b/src/mobilerun_sdk/types/workflows/events/catalog_register_response.py deleted file mode 100644 index 116b6cc..0000000 --- a/src/mobilerun_sdk/types/workflows/events/catalog_register_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel - -__all__ = ["CatalogRegisterResponse"] - - -class CatalogRegisterResponse(BaseModel): - message: str diff --git a/tests/api_resources/devices/test_apps.py b/tests/api_resources/devices/test_apps.py index 5f86d32..1826542 100644 --- a/tests/api_resources/devices/test_apps.py +++ b/tests/api_resources/devices/test_apps.py @@ -9,7 +9,9 @@ from tests.utils import assert_matches_type from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.devices import AppListResponse +from mobilerun_sdk.types.devices import ( + AppListResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -324,6 +326,7 @@ def test_method_stop_with_all_params(self, client: Mobilerun) -> None: app = client.devices.apps.stop( package_name="packageName", device_id="deviceId", + clear_data=True, x_device_display_id=0, ) assert app is None @@ -684,6 +687,7 @@ async def test_method_stop_with_all_params(self, async_client: AsyncMobilerun) - app = await async_client.devices.apps.stop( package_name="packageName", device_id="deviceId", + clear_data=True, x_device_display_id=0, ) assert app is None diff --git a/tests/api_resources/test_hooks.py b/tests/api_resources/test_hooks.py deleted file mode 100644 index 21548ab..0000000 --- a/tests/api_resources/test_hooks.py +++ /dev/null @@ -1,697 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types import ( - HookListResponse, - HookTestResponse, - HookUpdateResponse, - HookPerformResponse, - HookRetrieveResponse, - HookSubscribeResponse, - HookUnsubscribeResponse, - HookGetSampleDataResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestHooks: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - hook = client.hooks.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookRetrieveResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookRetrieveResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookRetrieveResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `hook_id` but received ''"): - client.hooks.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update(self, client: Mobilerun) -> None: - hook = client.hooks.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update_with_all_params(self, client: Mobilerun) -> None: - hook = client.hooks.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - events=["string"], - state="state", - ) - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_update(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_update(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_update(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `hook_id` but received ''"): - client.hooks.with_raw_response.update( - hook_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - hook = client.hooks.list() - assert_matches_type(HookListResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - hook = client.hooks.list( - order_by="orderBy", - order_by_direction="asc", - page=1, - page_size=1, - ) - assert_matches_type(HookListResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookListResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookListResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_sample_data(self, client: Mobilerun) -> None: - hook = client.hooks.get_sample_data() - assert_matches_type(HookGetSampleDataResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_get_sample_data(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.get_sample_data() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookGetSampleDataResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_get_sample_data(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.get_sample_data() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookGetSampleDataResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_perform(self, client: Mobilerun) -> None: - hook = client.hooks.perform( - body={"foo": "bar"}, - ) - assert_matches_type(HookPerformResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_perform(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.perform( - body={"foo": "bar"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookPerformResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_perform(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.perform( - body={"foo": "bar"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookPerformResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_subscribe(self, client: Mobilerun) -> None: - hook = client.hooks.subscribe( - target_url="https://example.com", - ) - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_subscribe_with_all_params(self, client: Mobilerun) -> None: - hook = client.hooks.subscribe( - target_url="https://example.com", - events=["string"], - service="service", - ) - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_subscribe(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.subscribe( - target_url="https://example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_subscribe(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.subscribe( - target_url="https://example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_test(self, client: Mobilerun) -> None: - hook = client.hooks.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookTestResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_test_with_all_params(self, client: Mobilerun) -> None: - hook = client.hooks.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - event="event", - ) - assert_matches_type(HookTestResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_test(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookTestResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_test(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookTestResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_test(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `hook_id` but received ''"): - client.hooks.with_raw_response.test( - hook_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_unsubscribe(self, client: Mobilerun) -> None: - hook = client.hooks.unsubscribe( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookUnsubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_unsubscribe(self, client: Mobilerun) -> None: - response = client.hooks.with_raw_response.unsubscribe( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = response.parse() - assert_matches_type(HookUnsubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_unsubscribe(self, client: Mobilerun) -> None: - with client.hooks.with_streaming_response.unsubscribe( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = response.parse() - assert_matches_type(HookUnsubscribeResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_unsubscribe(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `hook_id` but received ''"): - client.hooks.with_raw_response.unsubscribe( - "", - ) - - -class TestAsyncHooks: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookRetrieveResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookRetrieveResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookRetrieveResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `hook_id` but received ''"): - await async_client.hooks.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - events=["string"], - state="state", - ) - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.update( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookUpdateResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `hook_id` but received ''"): - await async_client.hooks.with_raw_response.update( - hook_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.list() - assert_matches_type(HookListResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.list( - order_by="orderBy", - order_by_direction="asc", - page=1, - page_size=1, - ) - assert_matches_type(HookListResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookListResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookListResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_sample_data(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.get_sample_data() - assert_matches_type(HookGetSampleDataResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_get_sample_data(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.get_sample_data() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookGetSampleDataResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_get_sample_data(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.get_sample_data() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookGetSampleDataResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_perform(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.perform( - body={"foo": "bar"}, - ) - assert_matches_type(HookPerformResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_perform(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.perform( - body={"foo": "bar"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookPerformResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_perform(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.perform( - body={"foo": "bar"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookPerformResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_subscribe(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.subscribe( - target_url="https://example.com", - ) - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_subscribe_with_all_params(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.subscribe( - target_url="https://example.com", - events=["string"], - service="service", - ) - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_subscribe(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.subscribe( - target_url="https://example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_subscribe(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.subscribe( - target_url="https://example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookSubscribeResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_test(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookTestResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_test_with_all_params(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - event="event", - ) - assert_matches_type(HookTestResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_test(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookTestResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_test(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.test( - hook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookTestResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_test(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `hook_id` but received ''"): - await async_client.hooks.with_raw_response.test( - hook_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_unsubscribe(self, async_client: AsyncMobilerun) -> None: - hook = await async_client.hooks.unsubscribe( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(HookUnsubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_unsubscribe(self, async_client: AsyncMobilerun) -> None: - response = await async_client.hooks.with_raw_response.unsubscribe( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hook = await response.parse() - assert_matches_type(HookUnsubscribeResponse, hook, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_unsubscribe(self, async_client: AsyncMobilerun) -> None: - async with async_client.hooks.with_streaming_response.unsubscribe( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hook = await response.parse() - assert_matches_type(HookUnsubscribeResponse, hook, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_unsubscribe(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `hook_id` but received ''"): - await async_client.hooks.with_raw_response.unsubscribe( - "", - ) diff --git a/tests/api_resources/test_webhooks.py b/tests/api_resources/test_webhooks.py index 8626698..e3747d0 100644 --- a/tests/api_resources/test_webhooks.py +++ b/tests/api_resources/test_webhooks.py @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: Mobilerun) -> None: webhook = client.webhooks.create( url="https://example.com/webhooks/droidrun", description="description", - event_types=["task.completed", "task.failed"], + event_types=["task.run.completed", "task.run.failed"], ) assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) @@ -376,7 +376,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) webhook = await async_client.webhooks.create( url="https://example.com/webhooks/droidrun", description="description", - event_types=["task.completed", "task.failed"], + event_types=["task.run.completed", "task.run.failed"], ) assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) diff --git a/tests/api_resources/workflows/events/__init__.py b/tests/api_resources/workflows/events/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/workflows/events/__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/workflows/events/test_catalog.py b/tests/api_resources/workflows/events/test_catalog.py deleted file mode 100644 index df97792..0000000 --- a/tests/api_resources/workflows/events/test_catalog.py +++ /dev/null @@ -1,201 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows.events import ( - CatalogListResponse, - CatalogRegisterResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCatalog: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - catalog = client.workflows.events.catalog.list() - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - catalog = client.workflows.events.catalog.list( - page=1, - page_size=1, - source="device", - ) - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.events.catalog.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - catalog = response.parse() - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.events.catalog.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - catalog = response.parse() - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_register(self, client: Mobilerun) -> None: - catalog = client.workflows.events.catalog.register( - events=[ - { - "event_type": "x", - "label": "x", - } - ], - ) - assert_matches_type(CatalogRegisterResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_register(self, client: Mobilerun) -> None: - response = client.workflows.events.catalog.with_raw_response.register( - events=[ - { - "event_type": "x", - "label": "x", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - catalog = response.parse() - assert_matches_type(CatalogRegisterResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_register(self, client: Mobilerun) -> None: - with client.workflows.events.catalog.with_streaming_response.register( - events=[ - { - "event_type": "x", - "label": "x", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - catalog = response.parse() - assert_matches_type(CatalogRegisterResponse, catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncCatalog: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - catalog = await async_client.workflows.events.catalog.list() - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - catalog = await async_client.workflows.events.catalog.list( - page=1, - page_size=1, - source="device", - ) - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.events.catalog.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - catalog = await response.parse() - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.events.catalog.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - catalog = await response.parse() - assert_matches_type(CatalogListResponse, catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_register(self, async_client: AsyncMobilerun) -> None: - catalog = await async_client.workflows.events.catalog.register( - events=[ - { - "event_type": "x", - "label": "x", - } - ], - ) - assert_matches_type(CatalogRegisterResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_register(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.events.catalog.with_raw_response.register( - events=[ - { - "event_type": "x", - "label": "x", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - catalog = await response.parse() - assert_matches_type(CatalogRegisterResponse, catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_register(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.events.catalog.with_streaming_response.register( - events=[ - { - "event_type": "x", - "label": "x", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - catalog = await response.parse() - assert_matches_type(CatalogRegisterResponse, catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_events.py b/tests/api_resources/workflows/test_events.py index 687e21b..8ca70fa 100644 --- a/tests/api_resources/workflows/test_events.py +++ b/tests/api_resources/workflows/test_events.py @@ -33,6 +33,7 @@ def test_method_dry_run(self, client: Mobilerun) -> None: def test_method_dry_run_with_all_params(self, client: Mobilerun) -> None: event = client.workflows.events.dry_run( event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", payload={"foo": "bar"}, ) assert_matches_type(EventDryRunResponse, event, path=["response"]) @@ -76,6 +77,7 @@ def test_method_ingest(self, client: Mobilerun) -> None: def test_method_ingest_with_all_params(self, client: Mobilerun) -> None: event = client.workflows.events.ingest( event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", payload={"foo": "bar"}, ) assert_matches_type(EventIngestResponse, event, path=["response"]) @@ -125,6 +127,7 @@ async def test_method_dry_run(self, async_client: AsyncMobilerun) -> None: async def test_method_dry_run_with_all_params(self, async_client: AsyncMobilerun) -> None: event = await async_client.workflows.events.dry_run( event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", payload={"foo": "bar"}, ) assert_matches_type(EventDryRunResponse, event, path=["response"]) @@ -168,6 +171,7 @@ async def test_method_ingest(self, async_client: AsyncMobilerun) -> None: async def test_method_ingest_with_all_params(self, async_client: AsyncMobilerun) -> None: event = await async_client.workflows.events.ingest( event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", payload={"foo": "bar"}, ) assert_matches_type(EventIngestResponse, event, path=["response"]) From be4ca60c393e2a0a62a38ad3b60949e3301ad144 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2026 23:14:20 +0000 Subject: [PATCH 03/10] feat(api): api update --- .stats.yml | 6 +- api.md | 178 ---- src/mobilerun_sdk/_client.py | 51 +- src/mobilerun_sdk/resources/__init__.py | 14 - .../resources/workflows/__init__.py | 117 --- .../resources/workflows/action_catalog.py | 268 ------ .../resources/workflows/actions/__init__.py | 33 - .../resources/workflows/actions/actions.py | 592 ------------- .../resources/workflows/actions/services.py | 215 ----- .../resources/workflows/events.py | 284 ------ .../resources/workflows/executions.py | 402 --------- .../resources/workflows/flows/__init__.py | 33 - .../resources/workflows/flows/actions.py | 454 ---------- .../resources/workflows/flows/flows.py | 836 ------------------ .../resources/workflows/timezones.py | 135 --- .../resources/workflows/triggers.py | 731 --------------- .../resources/workflows/workflows.py | 294 ------ src/mobilerun_sdk/types/__init__.py | 1 - src/mobilerun_sdk/types/flow.py | 54 -- src/mobilerun_sdk/types/workflows/__init__.py | 48 - src/mobilerun_sdk/types/workflows/action.py | 34 - .../types/workflows/action_catalog_entry.py | 28 - .../workflows/action_catalog_list_params.py | 17 - .../workflows/action_catalog_list_response.py | 15 - .../action_catalog_retrieve_response.py | 10 - .../types/workflows/action_create_params.py | 20 - .../types/workflows/action_create_response.py | 10 - .../types/workflows/action_delete_response.py | 9 - .../types/workflows/action_list_params.py | 23 - .../types/workflows/action_list_response.py | 15 - .../workflows/action_retrieve_response.py | 10 - .../types/workflows/action_update_params.py | 16 - .../types/workflows/action_update_response.py | 10 - .../types/workflows/actions/__init__.py | 3 - .../actions/service_list_methods_response.py | 32 - .../actions/service_list_response.py | 11 - .../types/workflows/event_dry_run_params.py | 18 - .../types/workflows/event_dry_run_response.py | 126 --- .../types/workflows/event_ingest_params.py | 18 - .../types/workflows/event_ingest_response.py | 11 - .../workflows/execution_get_metrics_params.py | 20 - .../execution_get_metrics_response.py | 39 - .../types/workflows/execution_list_params.py | 32 - .../workflows/execution_list_response.py | 15 - .../workflows/execution_retrieve_response.py | 10 - .../workflows/flow_action_overrides_param.py | 12 - .../flow_child_action_input_param.py | 23 - .../types/workflows/flow_clone_params.py | 16 - .../types/workflows/flow_clone_response.py | 10 - .../types/workflows/flow_create_params.py | 51 -- .../types/workflows/flow_create_response.py | 10 - .../types/workflows/flow_delete_response.py | 9 - .../types/workflows/flow_execution.py | 36 - .../types/workflows/flow_list_params.py | 28 - .../types/workflows/flow_list_response.py | 15 - .../types/workflows/flow_retrieve_response.py | 10 - .../types/workflows/flow_unblock_response.py | 10 - .../types/workflows/flow_update_params.py | 33 - .../types/workflows/flow_update_response.py | 10 - .../types/workflows/flows/__init__.py | 8 - .../workflows/flows/action_add_params.py | 28 - .../workflows/flows/action_add_response.py | 10 - .../workflows/flows/action_list_response.py | 12 - .../workflows/flows/action_remove_response.py | 9 - .../workflows/flows/action_replace_params.py | 30 - .../flows/action_replace_response.py | 12 - .../types/workflows/flows/flow_action.py | 33 - .../types/workflows/timezone_list_response.py | 11 - .../types/workflows/trigger_create_params.py | 48 - .../workflows/trigger_create_response.py | 55 -- .../workflows/trigger_delete_response.py | 9 - .../types/workflows/trigger_fire_params.py | 17 - .../types/workflows/trigger_fire_response.py | 22 - .../types/workflows/trigger_list_params.py | 25 - .../types/workflows/trigger_list_response.py | 58 -- .../workflows/trigger_retrieve_response.py | 55 -- .../types/workflows/trigger_update_params.py | 48 - .../workflows/trigger_update_response.py | 55 -- tests/api_resources/workflows/__init__.py | 1 - .../workflows/actions/__init__.py | 1 - .../workflows/actions/test_services.py | 164 ---- .../api_resources/workflows/flows/__init__.py | 1 - .../workflows/flows/test_actions.py | 495 ----------- .../workflows/test_action_catalog.py | 187 ---- tests/api_resources/workflows/test_actions.py | 482 ---------- tests/api_resources/workflows/test_events.py | 203 ----- .../workflows/test_executions.py | 280 ------ tests/api_resources/workflows/test_flows.py | 774 ---------------- .../api_resources/workflows/test_timezones.py | 80 -- .../api_resources/workflows/test_triggers.py | 627 ------------- 90 files changed, 4 insertions(+), 9407 deletions(-) delete mode 100644 src/mobilerun_sdk/resources/workflows/__init__.py delete mode 100644 src/mobilerun_sdk/resources/workflows/action_catalog.py delete mode 100644 src/mobilerun_sdk/resources/workflows/actions/__init__.py delete mode 100644 src/mobilerun_sdk/resources/workflows/actions/actions.py delete mode 100644 src/mobilerun_sdk/resources/workflows/actions/services.py delete mode 100644 src/mobilerun_sdk/resources/workflows/events.py delete mode 100644 src/mobilerun_sdk/resources/workflows/executions.py delete mode 100644 src/mobilerun_sdk/resources/workflows/flows/__init__.py delete mode 100644 src/mobilerun_sdk/resources/workflows/flows/actions.py delete mode 100644 src/mobilerun_sdk/resources/workflows/flows/flows.py delete mode 100644 src/mobilerun_sdk/resources/workflows/timezones.py delete mode 100644 src/mobilerun_sdk/resources/workflows/triggers.py delete mode 100644 src/mobilerun_sdk/resources/workflows/workflows.py delete mode 100644 src/mobilerun_sdk/types/flow.py delete mode 100644 src/mobilerun_sdk/types/workflows/action.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_entry.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_list_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_create_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_create_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_delete_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_list_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_retrieve_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_update_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/action_update_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/actions/service_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/event_dry_run_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/event_dry_run_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/event_ingest_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/event_ingest_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/execution_list_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/execution_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/execution_retrieve_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_clone_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_clone_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_create_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_create_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_delete_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_execution.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_list_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_retrieve_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_unblock_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_update_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/flow_update_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flows/action_add_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/flows/action_add_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flows/action_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flows/action_remove_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flows/action_replace_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/flows/action_replace_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/flows/flow_action.py delete mode 100644 src/mobilerun_sdk/types/workflows/timezone_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_create_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_create_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_delete_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_fire_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_fire_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_list_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_list_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_update_params.py delete mode 100644 src/mobilerun_sdk/types/workflows/trigger_update_response.py delete mode 100644 tests/api_resources/workflows/__init__.py delete mode 100644 tests/api_resources/workflows/actions/__init__.py delete mode 100644 tests/api_resources/workflows/actions/test_services.py delete mode 100644 tests/api_resources/workflows/flows/__init__.py delete mode 100644 tests/api_resources/workflows/flows/test_actions.py delete mode 100644 tests/api_resources/workflows/test_action_catalog.py delete mode 100644 tests/api_resources/workflows/test_actions.py delete mode 100644 tests/api_resources/workflows/test_events.py delete mode 100644 tests/api_resources/workflows/test_executions.py delete mode 100644 tests/api_resources/workflows/test_flows.py delete mode 100644 tests/api_resources/workflows/test_timezones.py delete mode 100644 tests/api_resources/workflows/test_triggers.py diff --git a/.stats.yml b/.stats.yml index 18785ef..90ec418 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 150 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-521a4a2c8ab8dd16173d533d8c851a057b04ff6d144bfa35a062103fbe417aef.yml -openapi_spec_hash: f3077f6c61aff5d5c4468a7968777041 +configured_endpoints: 118 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-ba11696b1ce362ff0ca1de1db5753b839bb976e2c0d6f46b1a6ca682da4b75d2.yml +openapi_spec_hash: 7126ef9674cfcbfed175e48aa1fe3cd6 config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/api.md b/api.md index 1a26682..a922cdb 100644 --- a/api.md +++ b/api.md @@ -490,184 +490,6 @@ Methods: - client.tasks.ui_states.retrieve(index, \*, task_id) -> MediaResponse - client.tasks.ui_states.list(task_id) -> UiStateListResponse -# Workflows - -Types: - -```python -from mobilerun_sdk.types import Flow -``` - -## Triggers - -Types: - -```python -from mobilerun_sdk.types.workflows import ( - TriggerCreateResponse, - TriggerRetrieveResponse, - TriggerUpdateResponse, - TriggerListResponse, - TriggerDeleteResponse, - TriggerFireResponse, -) -``` - -Methods: - -- client.workflows.triggers.create(\*\*params) -> TriggerCreateResponse -- client.workflows.triggers.retrieve(trigger_id) -> TriggerRetrieveResponse -- client.workflows.triggers.update(trigger_id, \*\*params) -> TriggerUpdateResponse -- client.workflows.triggers.list(\*\*params) -> TriggerListResponse -- client.workflows.triggers.delete(trigger_id) -> TriggerDeleteResponse -- client.workflows.triggers.fire(trigger_id, \*\*params) -> TriggerFireResponse - -## ActionCatalog - -Types: - -```python -from mobilerun_sdk.types.workflows import ( - ActionCatalogEntry, - ActionCatalogRetrieveResponse, - ActionCatalogListResponse, -) -``` - -Methods: - -- client.workflows.action_catalog.retrieve(catalog_entry_id) -> ActionCatalogRetrieveResponse -- client.workflows.action_catalog.list(\*\*params) -> ActionCatalogListResponse - -## Actions - -Types: - -```python -from mobilerun_sdk.types.workflows import ( - Action, - ActionCreateResponse, - ActionRetrieveResponse, - ActionUpdateResponse, - ActionListResponse, - ActionDeleteResponse, -) -``` - -Methods: - -- client.workflows.actions.create(\*\*params) -> ActionCreateResponse -- client.workflows.actions.retrieve(action_id) -> ActionRetrieveResponse -- client.workflows.actions.update(action_id, \*\*params) -> ActionUpdateResponse -- client.workflows.actions.list(\*\*params) -> ActionListResponse -- client.workflows.actions.delete(action_id) -> ActionDeleteResponse - -### Services - -Types: - -```python -from mobilerun_sdk.types.workflows.actions import ServiceListResponse, ServiceListMethodsResponse -``` - -Methods: - -- client.workflows.actions.services.list() -> ServiceListResponse -- client.workflows.actions.services.list_methods(service) -> ServiceListMethodsResponse - -## Flows - -Types: - -```python -from mobilerun_sdk.types.workflows import ( - FlowActionOverrides, - FlowChildActionInput, - FlowCreateResponse, - FlowRetrieveResponse, - FlowUpdateResponse, - FlowListResponse, - FlowDeleteResponse, - FlowCloneResponse, - FlowUnblockResponse, -) -``` - -Methods: - -- client.workflows.flows.create(\*\*params) -> FlowCreateResponse -- client.workflows.flows.retrieve(flow_id) -> FlowRetrieveResponse -- client.workflows.flows.update(flow_id, \*\*params) -> FlowUpdateResponse -- client.workflows.flows.list(\*\*params) -> FlowListResponse -- client.workflows.flows.delete(flow_id) -> FlowDeleteResponse -- client.workflows.flows.clone(flow_id, \*\*params) -> FlowCloneResponse -- client.workflows.flows.unblock(flow_id) -> FlowUnblockResponse - -### Actions - -Types: - -```python -from mobilerun_sdk.types.workflows.flows import ( - FlowAction, - ActionListResponse, - ActionAddResponse, - ActionRemoveResponse, - ActionReplaceResponse, -) -``` - -Methods: - -- client.workflows.flows.actions.list(flow_id) -> ActionListResponse -- client.workflows.flows.actions.add(flow_id, \*\*params) -> ActionAddResponse -- client.workflows.flows.actions.remove(flow_action_id, \*, flow_id) -> ActionRemoveResponse -- client.workflows.flows.actions.replace(flow_id, \*\*params) -> ActionReplaceResponse - -## Events - -Types: - -```python -from mobilerun_sdk.types.workflows import EventDryRunResponse, EventIngestResponse -``` - -Methods: - -- client.workflows.events.dry_run(\*\*params) -> EventDryRunResponse -- client.workflows.events.ingest(\*\*params) -> EventIngestResponse - -## Executions - -Types: - -```python -from mobilerun_sdk.types.workflows import ( - FlowExecution, - ExecutionRetrieveResponse, - ExecutionListResponse, - ExecutionGetMetricsResponse, -) -``` - -Methods: - -- client.workflows.executions.retrieve(execution_id) -> ExecutionRetrieveResponse -- client.workflows.executions.list(\*\*params) -> ExecutionListResponse -- client.workflows.executions.get_metrics(\*\*params) -> ExecutionGetMetricsResponse - -## Timezones - -Types: - -```python -from mobilerun_sdk.types.workflows import TimezoneListResponse -``` - -Methods: - -- client.workflows.timezones.list() -> TimezoneListResponse - # Webhooks Types: diff --git a/src/mobilerun_sdk/_client.py b/src/mobilerun_sdk/_client.py index 4f5c67e..0ed2e4e 100644 --- a/src/mobilerun_sdk/_client.py +++ b/src/mobilerun_sdk/_client.py @@ -36,19 +36,7 @@ ) if TYPE_CHECKING: - from .resources import ( - apps, - tasks, - models, - connect, - devices, - proxies, - carriers, - profiles, - webhooks, - workflows, - credentials, - ) + from .resources import apps, tasks, models, connect, devices, proxies, carriers, profiles, webhooks, credentials from .resources.apps import AppsResource, AsyncAppsResource from .resources.models import ModelsResource, AsyncModelsResource from .resources.proxies import ProxiesResource, AsyncProxiesResource @@ -58,7 +46,6 @@ from .resources.connect.connect import ConnectResource, AsyncConnectResource from .resources.devices.devices import DevicesResource, AsyncDevicesResource from .resources.webhooks.webhooks import WebhooksResource, AsyncWebhooksResource - from .resources.workflows.workflows import WorkflowsResource, AsyncWorkflowsResource from .resources.credentials.credentials import CredentialsResource, AsyncCredentialsResource __all__ = [ @@ -193,12 +180,6 @@ def tasks(self) -> TasksResource: return TasksResource(self) - @cached_property - def workflows(self) -> WorkflowsResource: - from .resources.workflows import WorkflowsResource - - return WorkflowsResource(self) - @cached_property def webhooks(self) -> WebhooksResource: from .resources.webhooks import WebhooksResource @@ -449,12 +430,6 @@ def tasks(self) -> AsyncTasksResource: return AsyncTasksResource(self) - @cached_property - def workflows(self) -> AsyncWorkflowsResource: - from .resources.workflows import AsyncWorkflowsResource - - return AsyncWorkflowsResource(self) - @cached_property def webhooks(self) -> AsyncWebhooksResource: from .resources.webhooks import AsyncWebhooksResource @@ -651,12 +626,6 @@ def tasks(self) -> tasks.TasksResourceWithRawResponse: return TasksResourceWithRawResponse(self._client.tasks) - @cached_property - def workflows(self) -> workflows.WorkflowsResourceWithRawResponse: - from .resources.workflows import WorkflowsResourceWithRawResponse - - return WorkflowsResourceWithRawResponse(self._client.workflows) - @cached_property def webhooks(self) -> webhooks.WebhooksResourceWithRawResponse: from .resources.webhooks import WebhooksResourceWithRawResponse @@ -730,12 +699,6 @@ def tasks(self) -> tasks.AsyncTasksResourceWithRawResponse: return AsyncTasksResourceWithRawResponse(self._client.tasks) - @cached_property - def workflows(self) -> workflows.AsyncWorkflowsResourceWithRawResponse: - from .resources.workflows import AsyncWorkflowsResourceWithRawResponse - - return AsyncWorkflowsResourceWithRawResponse(self._client.workflows) - @cached_property def webhooks(self) -> webhooks.AsyncWebhooksResourceWithRawResponse: from .resources.webhooks import AsyncWebhooksResourceWithRawResponse @@ -809,12 +772,6 @@ def tasks(self) -> tasks.TasksResourceWithStreamingResponse: return TasksResourceWithStreamingResponse(self._client.tasks) - @cached_property - def workflows(self) -> workflows.WorkflowsResourceWithStreamingResponse: - from .resources.workflows import WorkflowsResourceWithStreamingResponse - - return WorkflowsResourceWithStreamingResponse(self._client.workflows) - @cached_property def webhooks(self) -> webhooks.WebhooksResourceWithStreamingResponse: from .resources.webhooks import WebhooksResourceWithStreamingResponse @@ -888,12 +845,6 @@ def tasks(self) -> tasks.AsyncTasksResourceWithStreamingResponse: return AsyncTasksResourceWithStreamingResponse(self._client.tasks) - @cached_property - def workflows(self) -> workflows.AsyncWorkflowsResourceWithStreamingResponse: - from .resources.workflows import AsyncWorkflowsResourceWithStreamingResponse - - return AsyncWorkflowsResourceWithStreamingResponse(self._client.workflows) - @cached_property def webhooks(self) -> webhooks.AsyncWebhooksResourceWithStreamingResponse: from .resources.webhooks import AsyncWebhooksResourceWithStreamingResponse diff --git a/src/mobilerun_sdk/resources/__init__.py b/src/mobilerun_sdk/resources/__init__.py index be9be40..3f3887c 100644 --- a/src/mobilerun_sdk/resources/__init__.py +++ b/src/mobilerun_sdk/resources/__init__.py @@ -72,14 +72,6 @@ WebhooksResourceWithStreamingResponse, AsyncWebhooksResourceWithStreamingResponse, ) -from .workflows import ( - WorkflowsResource, - AsyncWorkflowsResource, - WorkflowsResourceWithRawResponse, - AsyncWorkflowsResourceWithRawResponse, - WorkflowsResourceWithStreamingResponse, - AsyncWorkflowsResourceWithStreamingResponse, -) from .credentials import ( CredentialsResource, AsyncCredentialsResource, @@ -144,12 +136,6 @@ "AsyncTasksResourceWithRawResponse", "TasksResourceWithStreamingResponse", "AsyncTasksResourceWithStreamingResponse", - "WorkflowsResource", - "AsyncWorkflowsResource", - "WorkflowsResourceWithRawResponse", - "AsyncWorkflowsResourceWithRawResponse", - "WorkflowsResourceWithStreamingResponse", - "AsyncWorkflowsResourceWithStreamingResponse", "WebhooksResource", "AsyncWebhooksResource", "WebhooksResourceWithRawResponse", diff --git a/src/mobilerun_sdk/resources/workflows/__init__.py b/src/mobilerun_sdk/resources/workflows/__init__.py deleted file mode 100644 index 2b80e07..0000000 --- a/src/mobilerun_sdk/resources/workflows/__init__.py +++ /dev/null @@ -1,117 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .flows import ( - FlowsResource, - AsyncFlowsResource, - FlowsResourceWithRawResponse, - AsyncFlowsResourceWithRawResponse, - FlowsResourceWithStreamingResponse, - AsyncFlowsResourceWithStreamingResponse, -) -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from .actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) -from .triggers import ( - TriggersResource, - AsyncTriggersResource, - TriggersResourceWithRawResponse, - AsyncTriggersResourceWithRawResponse, - TriggersResourceWithStreamingResponse, - AsyncTriggersResourceWithStreamingResponse, -) -from .timezones import ( - TimezonesResource, - AsyncTimezonesResource, - TimezonesResourceWithRawResponse, - AsyncTimezonesResourceWithRawResponse, - TimezonesResourceWithStreamingResponse, - AsyncTimezonesResourceWithStreamingResponse, -) -from .workflows import ( - WorkflowsResource, - AsyncWorkflowsResource, - WorkflowsResourceWithRawResponse, - AsyncWorkflowsResourceWithRawResponse, - WorkflowsResourceWithStreamingResponse, - AsyncWorkflowsResourceWithStreamingResponse, -) -from .executions import ( - ExecutionsResource, - AsyncExecutionsResource, - ExecutionsResourceWithRawResponse, - AsyncExecutionsResourceWithRawResponse, - ExecutionsResourceWithStreamingResponse, - AsyncExecutionsResourceWithStreamingResponse, -) -from .action_catalog import ( - ActionCatalogResource, - AsyncActionCatalogResource, - ActionCatalogResourceWithRawResponse, - AsyncActionCatalogResourceWithRawResponse, - ActionCatalogResourceWithStreamingResponse, - AsyncActionCatalogResourceWithStreamingResponse, -) - -__all__ = [ - "TriggersResource", - "AsyncTriggersResource", - "TriggersResourceWithRawResponse", - "AsyncTriggersResourceWithRawResponse", - "TriggersResourceWithStreamingResponse", - "AsyncTriggersResourceWithStreamingResponse", - "ActionCatalogResource", - "AsyncActionCatalogResource", - "ActionCatalogResourceWithRawResponse", - "AsyncActionCatalogResourceWithRawResponse", - "ActionCatalogResourceWithStreamingResponse", - "AsyncActionCatalogResourceWithStreamingResponse", - "ActionsResource", - "AsyncActionsResource", - "ActionsResourceWithRawResponse", - "AsyncActionsResourceWithRawResponse", - "ActionsResourceWithStreamingResponse", - "AsyncActionsResourceWithStreamingResponse", - "FlowsResource", - "AsyncFlowsResource", - "FlowsResourceWithRawResponse", - "AsyncFlowsResourceWithRawResponse", - "FlowsResourceWithStreamingResponse", - "AsyncFlowsResourceWithStreamingResponse", - "EventsResource", - "AsyncEventsResource", - "EventsResourceWithRawResponse", - "AsyncEventsResourceWithRawResponse", - "EventsResourceWithStreamingResponse", - "AsyncEventsResourceWithStreamingResponse", - "ExecutionsResource", - "AsyncExecutionsResource", - "ExecutionsResourceWithRawResponse", - "AsyncExecutionsResourceWithRawResponse", - "ExecutionsResourceWithStreamingResponse", - "AsyncExecutionsResourceWithStreamingResponse", - "TimezonesResource", - "AsyncTimezonesResource", - "TimezonesResourceWithRawResponse", - "AsyncTimezonesResourceWithRawResponse", - "TimezonesResourceWithStreamingResponse", - "AsyncTimezonesResourceWithStreamingResponse", - "WorkflowsResource", - "AsyncWorkflowsResource", - "WorkflowsResourceWithRawResponse", - "AsyncWorkflowsResourceWithRawResponse", - "WorkflowsResourceWithStreamingResponse", - "AsyncWorkflowsResourceWithStreamingResponse", -] diff --git a/src/mobilerun_sdk/resources/workflows/action_catalog.py b/src/mobilerun_sdk/resources/workflows/action_catalog.py deleted file mode 100644 index b637dd4..0000000 --- a/src/mobilerun_sdk/resources/workflows/action_catalog.py +++ /dev/null @@ -1,268 +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 path_template, 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.workflows import action_catalog_list_params -from ...types.workflows.action_catalog_list_response import ActionCatalogListResponse -from ...types.workflows.action_catalog_retrieve_response import ActionCatalogRetrieveResponse - -__all__ = ["ActionCatalogResource", "AsyncActionCatalogResource"] - - -class ActionCatalogResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ActionCatalogResourceWithRawResponse: - """ - 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 ActionCatalogResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ActionCatalogResourceWithStreamingResponse: - """ - 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 ActionCatalogResourceWithStreamingResponse(self) - - def retrieve( - self, - catalog_entry_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, - ) -> ActionCatalogRetrieveResponse: - """ - Get a catalog entry - - 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 catalog_entry_id: - raise ValueError(f"Expected a non-empty value for `catalog_entry_id` but received {catalog_entry_id!r}") - return self._get( - path_template("/action-catalog/{catalog_entry_id}", catalog_entry_id=catalog_entry_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionCatalogRetrieveResponse, - ) - - def list( - self, - *, - page: int | Omit = omit, - page_size: int | Omit = omit, - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, - ) -> ActionCatalogListResponse: - """ - List action catalog entries - - 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( - "/action-catalog", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "page": page, - "page_size": page_size, - "service": service, - }, - action_catalog_list_params.ActionCatalogListParams, - ), - ), - cast_to=ActionCatalogListResponse, - ) - - -class AsyncActionCatalogResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncActionCatalogResourceWithRawResponse: - """ - 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 AsyncActionCatalogResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncActionCatalogResourceWithStreamingResponse: - """ - 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 AsyncActionCatalogResourceWithStreamingResponse(self) - - async def retrieve( - self, - catalog_entry_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, - ) -> ActionCatalogRetrieveResponse: - """ - Get a catalog entry - - 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 catalog_entry_id: - raise ValueError(f"Expected a non-empty value for `catalog_entry_id` but received {catalog_entry_id!r}") - return await self._get( - path_template("/action-catalog/{catalog_entry_id}", catalog_entry_id=catalog_entry_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionCatalogRetrieveResponse, - ) - - async def list( - self, - *, - page: int | Omit = omit, - page_size: int | Omit = omit, - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, - ) -> ActionCatalogListResponse: - """ - List action catalog entries - - 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( - "/action-catalog", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "page": page, - "page_size": page_size, - "service": service, - }, - action_catalog_list_params.ActionCatalogListParams, - ), - ), - cast_to=ActionCatalogListResponse, - ) - - -class ActionCatalogResourceWithRawResponse: - def __init__(self, action_catalog: ActionCatalogResource) -> None: - self._action_catalog = action_catalog - - self.retrieve = to_raw_response_wrapper( - action_catalog.retrieve, - ) - self.list = to_raw_response_wrapper( - action_catalog.list, - ) - - -class AsyncActionCatalogResourceWithRawResponse: - def __init__(self, action_catalog: AsyncActionCatalogResource) -> None: - self._action_catalog = action_catalog - - self.retrieve = async_to_raw_response_wrapper( - action_catalog.retrieve, - ) - self.list = async_to_raw_response_wrapper( - action_catalog.list, - ) - - -class ActionCatalogResourceWithStreamingResponse: - def __init__(self, action_catalog: ActionCatalogResource) -> None: - self._action_catalog = action_catalog - - self.retrieve = to_streamed_response_wrapper( - action_catalog.retrieve, - ) - self.list = to_streamed_response_wrapper( - action_catalog.list, - ) - - -class AsyncActionCatalogResourceWithStreamingResponse: - def __init__(self, action_catalog: AsyncActionCatalogResource) -> None: - self._action_catalog = action_catalog - - self.retrieve = async_to_streamed_response_wrapper( - action_catalog.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - action_catalog.list, - ) diff --git a/src/mobilerun_sdk/resources/workflows/actions/__init__.py b/src/mobilerun_sdk/resources/workflows/actions/__init__.py deleted file mode 100644 index f4307e4..0000000 --- a/src/mobilerun_sdk/resources/workflows/actions/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) -from .services import ( - ServicesResource, - AsyncServicesResource, - ServicesResourceWithRawResponse, - AsyncServicesResourceWithRawResponse, - ServicesResourceWithStreamingResponse, - AsyncServicesResourceWithStreamingResponse, -) - -__all__ = [ - "ServicesResource", - "AsyncServicesResource", - "ServicesResourceWithRawResponse", - "AsyncServicesResourceWithRawResponse", - "ServicesResourceWithStreamingResponse", - "AsyncServicesResourceWithStreamingResponse", - "ActionsResource", - "AsyncActionsResource", - "ActionsResourceWithRawResponse", - "AsyncActionsResourceWithRawResponse", - "ActionsResourceWithStreamingResponse", - "AsyncActionsResourceWithStreamingResponse", -] diff --git a/src/mobilerun_sdk/resources/workflows/actions/actions.py b/src/mobilerun_sdk/resources/workflows/actions/actions.py deleted file mode 100644 index 2b4723a..0000000 --- a/src/mobilerun_sdk/resources/workflows/actions/actions.py +++ /dev/null @@ -1,592 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Literal - -import httpx - -from .services import ( - ServicesResource, - AsyncServicesResource, - ServicesResourceWithRawResponse, - AsyncServicesResourceWithRawResponse, - ServicesResourceWithStreamingResponse, - AsyncServicesResourceWithStreamingResponse, -) -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import path_template, 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.workflows import action_list_params, action_create_params, action_update_params -from ....types.workflows.action_list_response import ActionListResponse -from ....types.workflows.action_create_response import ActionCreateResponse -from ....types.workflows.action_delete_response import ActionDeleteResponse -from ....types.workflows.action_update_response import ActionUpdateResponse -from ....types.workflows.action_retrieve_response import ActionRetrieveResponse - -__all__ = ["ActionsResource", "AsyncActionsResource"] - - -class ActionsResource(SyncAPIResource): - @cached_property - def services(self) -> ServicesResource: - return ServicesResource(self._client) - - @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 create( - self, - *, - catalog_entry_id: str, - name: str, - description: str | Omit = omit, - params: Dict[str, Optional[object]] | 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, - ) -> ActionCreateResponse: - """ - Create an 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 - """ - return self._post( - "/actions", - body=maybe_transform( - { - "catalog_entry_id": catalog_entry_id, - "name": name, - "description": description, - "params": params, - }, - action_create_params.ActionCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionCreateResponse, - ) - - def retrieve( - self, - action_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, - ) -> ActionRetrieveResponse: - """ - Get an 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 action_id: - raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") - return self._get( - path_template("/actions/{action_id}", action_id=action_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionRetrieveResponse, - ) - - def update( - self, - action_id: str, - *, - description: str | Omit = omit, - name: str | Omit = omit, - params: Dict[str, Optional[object]] | 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, - ) -> ActionUpdateResponse: - """ - Update an 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 action_id: - raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") - return self._patch( - path_template("/actions/{action_id}", action_id=action_id), - body=maybe_transform( - { - "description": description, - "name": name, - "params": params, - }, - action_update_params.ActionUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionUpdateResponse, - ) - - def list( - self, - *, - order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | Omit = omit, - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, - ) -> ActionListResponse: - """ - List actions - - 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( - "/actions", - 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, - "search": search, - "service": service, - }, - action_list_params.ActionListParams, - ), - ), - cast_to=ActionListResponse, - ) - - def delete( - self, - action_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, - ) -> ActionDeleteResponse: - """ - Delete an 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 action_id: - raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") - return self._delete( - path_template("/actions/{action_id}", action_id=action_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionDeleteResponse, - ) - - -class AsyncActionsResource(AsyncAPIResource): - @cached_property - def services(self) -> AsyncServicesResource: - return AsyncServicesResource(self._client) - - @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 create( - self, - *, - catalog_entry_id: str, - name: str, - description: str | Omit = omit, - params: Dict[str, Optional[object]] | 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, - ) -> ActionCreateResponse: - """ - Create an 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 - """ - return await self._post( - "/actions", - body=await async_maybe_transform( - { - "catalog_entry_id": catalog_entry_id, - "name": name, - "description": description, - "params": params, - }, - action_create_params.ActionCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionCreateResponse, - ) - - async def retrieve( - self, - action_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, - ) -> ActionRetrieveResponse: - """ - Get an 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 action_id: - raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") - return await self._get( - path_template("/actions/{action_id}", action_id=action_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionRetrieveResponse, - ) - - async def update( - self, - action_id: str, - *, - description: str | Omit = omit, - name: str | Omit = omit, - params: Dict[str, Optional[object]] | 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, - ) -> ActionUpdateResponse: - """ - Update an 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 action_id: - raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") - return await self._patch( - path_template("/actions/{action_id}", action_id=action_id), - body=await async_maybe_transform( - { - "description": description, - "name": name, - "params": params, - }, - action_update_params.ActionUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionUpdateResponse, - ) - - async def list( - self, - *, - order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | Omit = omit, - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, - ) -> ActionListResponse: - """ - List actions - - 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( - "/actions", - 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, - "search": search, - "service": service, - }, - action_list_params.ActionListParams, - ), - ), - cast_to=ActionListResponse, - ) - - async def delete( - self, - action_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, - ) -> ActionDeleteResponse: - """ - Delete an 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 action_id: - raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") - return await self._delete( - path_template("/actions/{action_id}", action_id=action_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionDeleteResponse, - ) - - -class ActionsResourceWithRawResponse: - def __init__(self, actions: ActionsResource) -> None: - self._actions = actions - - self.create = to_raw_response_wrapper( - actions.create, - ) - self.retrieve = to_raw_response_wrapper( - actions.retrieve, - ) - self.update = to_raw_response_wrapper( - actions.update, - ) - self.list = to_raw_response_wrapper( - actions.list, - ) - self.delete = to_raw_response_wrapper( - actions.delete, - ) - - @cached_property - def services(self) -> ServicesResourceWithRawResponse: - return ServicesResourceWithRawResponse(self._actions.services) - - -class AsyncActionsResourceWithRawResponse: - def __init__(self, actions: AsyncActionsResource) -> None: - self._actions = actions - - self.create = async_to_raw_response_wrapper( - actions.create, - ) - self.retrieve = async_to_raw_response_wrapper( - actions.retrieve, - ) - self.update = async_to_raw_response_wrapper( - actions.update, - ) - self.list = async_to_raw_response_wrapper( - actions.list, - ) - self.delete = async_to_raw_response_wrapper( - actions.delete, - ) - - @cached_property - def services(self) -> AsyncServicesResourceWithRawResponse: - return AsyncServicesResourceWithRawResponse(self._actions.services) - - -class ActionsResourceWithStreamingResponse: - def __init__(self, actions: ActionsResource) -> None: - self._actions = actions - - self.create = to_streamed_response_wrapper( - actions.create, - ) - self.retrieve = to_streamed_response_wrapper( - actions.retrieve, - ) - self.update = to_streamed_response_wrapper( - actions.update, - ) - self.list = to_streamed_response_wrapper( - actions.list, - ) - self.delete = to_streamed_response_wrapper( - actions.delete, - ) - - @cached_property - def services(self) -> ServicesResourceWithStreamingResponse: - return ServicesResourceWithStreamingResponse(self._actions.services) - - -class AsyncActionsResourceWithStreamingResponse: - def __init__(self, actions: AsyncActionsResource) -> None: - self._actions = actions - - self.create = async_to_streamed_response_wrapper( - actions.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - actions.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - actions.update, - ) - self.list = async_to_streamed_response_wrapper( - actions.list, - ) - self.delete = async_to_streamed_response_wrapper( - actions.delete, - ) - - @cached_property - def services(self) -> AsyncServicesResourceWithStreamingResponse: - return AsyncServicesResourceWithStreamingResponse(self._actions.services) diff --git a/src/mobilerun_sdk/resources/workflows/actions/services.py b/src/mobilerun_sdk/resources/workflows/actions/services.py deleted file mode 100644 index fd46c48..0000000 --- a/src/mobilerun_sdk/resources/workflows/actions/services.py +++ /dev/null @@ -1,215 +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, Query, Headers, NotGiven, not_given -from ...._utils import path_template -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.workflows.actions.service_list_response import ServiceListResponse -from ....types.workflows.actions.service_list_methods_response import ServiceListMethodsResponse - -__all__ = ["ServicesResource", "AsyncServicesResource"] - - -class ServicesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ServicesResourceWithRawResponse: - """ - 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 ServicesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ServicesResourceWithStreamingResponse: - """ - 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 ServicesResourceWithStreamingResponse(self) - - def list( - 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, - ) -> ServiceListResponse: - """List available services""" - return self._get( - "/actions/services", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceListResponse, - ) - - def list_methods( - self, - service: 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, - ) -> ServiceListMethodsResponse: - """ - List allowed methods for a service - - 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 service: - raise ValueError(f"Expected a non-empty value for `service` but received {service!r}") - return self._get( - path_template("/actions/services/{service}/methods", service=service), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceListMethodsResponse, - ) - - -class AsyncServicesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncServicesResourceWithRawResponse: - """ - 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 AsyncServicesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncServicesResourceWithStreamingResponse: - """ - 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 AsyncServicesResourceWithStreamingResponse(self) - - async def list( - 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, - ) -> ServiceListResponse: - """List available services""" - return await self._get( - "/actions/services", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceListResponse, - ) - - async def list_methods( - self, - service: 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, - ) -> ServiceListMethodsResponse: - """ - List allowed methods for a service - - 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 service: - raise ValueError(f"Expected a non-empty value for `service` but received {service!r}") - return await self._get( - path_template("/actions/services/{service}/methods", service=service), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceListMethodsResponse, - ) - - -class ServicesResourceWithRawResponse: - def __init__(self, services: ServicesResource) -> None: - self._services = services - - self.list = to_raw_response_wrapper( - services.list, - ) - self.list_methods = to_raw_response_wrapper( - services.list_methods, - ) - - -class AsyncServicesResourceWithRawResponse: - def __init__(self, services: AsyncServicesResource) -> None: - self._services = services - - self.list = async_to_raw_response_wrapper( - services.list, - ) - self.list_methods = async_to_raw_response_wrapper( - services.list_methods, - ) - - -class ServicesResourceWithStreamingResponse: - def __init__(self, services: ServicesResource) -> None: - self._services = services - - self.list = to_streamed_response_wrapper( - services.list, - ) - self.list_methods = to_streamed_response_wrapper( - services.list_methods, - ) - - -class AsyncServicesResourceWithStreamingResponse: - def __init__(self, services: AsyncServicesResource) -> None: - self._services = services - - self.list = async_to_streamed_response_wrapper( - services.list, - ) - self.list_methods = async_to_streamed_response_wrapper( - services.list_methods, - ) diff --git a/src/mobilerun_sdk/resources/workflows/events.py b/src/mobilerun_sdk/resources/workflows/events.py deleted file mode 100644 index 34c5350..0000000 --- a/src/mobilerun_sdk/resources/workflows/events.py +++ /dev/null @@ -1,284 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional - -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.workflows import event_ingest_params, event_dry_run_params -from ...types.workflows.event_ingest_response import EventIngestResponse -from ...types.workflows.event_dry_run_response import EventDryRunResponse - -__all__ = ["EventsResource", "AsyncEventsResource"] - - -class EventsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EventsResourceWithRawResponse: - """ - 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 EventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EventsResourceWithStreamingResponse: - """ - 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 EventsResourceWithStreamingResponse(self) - - def dry_run( - self, - *, - event_type: str, - device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | 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, - ) -> EventDryRunResponse: - """Simulate an event against all configured flows. - - Returns which flows would match - and what actions would run, without storing the event or enqueuing jobs. - - 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( - "/events/dry-run", - body=maybe_transform( - { - "event_type": event_type, - "device_id": device_id, - "payload": payload, - }, - event_dry_run_params.EventDryRunParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EventDryRunResponse, - ) - - def ingest( - self, - *, - event_type: str, - device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | 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, - ) -> EventIngestResponse: - """Ingest an event for trigger evaluation. - - Returns immediately with 202 Accepted. - - 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( - "/events/ingest", - body=maybe_transform( - { - "event_type": event_type, - "device_id": device_id, - "payload": payload, - }, - event_ingest_params.EventIngestParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EventIngestResponse, - ) - - -class AsyncEventsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: - """ - 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 AsyncEventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: - """ - 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 AsyncEventsResourceWithStreamingResponse(self) - - async def dry_run( - self, - *, - event_type: str, - device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | 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, - ) -> EventDryRunResponse: - """Simulate an event against all configured flows. - - Returns which flows would match - and what actions would run, without storing the event or enqueuing jobs. - - 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( - "/events/dry-run", - body=await async_maybe_transform( - { - "event_type": event_type, - "device_id": device_id, - "payload": payload, - }, - event_dry_run_params.EventDryRunParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EventDryRunResponse, - ) - - async def ingest( - self, - *, - event_type: str, - device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | 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, - ) -> EventIngestResponse: - """Ingest an event for trigger evaluation. - - Returns immediately with 202 Accepted. - - 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( - "/events/ingest", - body=await async_maybe_transform( - { - "event_type": event_type, - "device_id": device_id, - "payload": payload, - }, - event_ingest_params.EventIngestParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EventIngestResponse, - ) - - -class EventsResourceWithRawResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.dry_run = to_raw_response_wrapper( - events.dry_run, - ) - self.ingest = to_raw_response_wrapper( - events.ingest, - ) - - -class AsyncEventsResourceWithRawResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.dry_run = async_to_raw_response_wrapper( - events.dry_run, - ) - self.ingest = async_to_raw_response_wrapper( - events.ingest, - ) - - -class EventsResourceWithStreamingResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.dry_run = to_streamed_response_wrapper( - events.dry_run, - ) - self.ingest = to_streamed_response_wrapper( - events.ingest, - ) - - -class AsyncEventsResourceWithStreamingResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.dry_run = async_to_streamed_response_wrapper( - events.dry_run, - ) - self.ingest = async_to_streamed_response_wrapper( - events.ingest, - ) diff --git a/src/mobilerun_sdk/resources/workflows/executions.py b/src/mobilerun_sdk/resources/workflows/executions.py deleted file mode 100644 index 4d12f2d..0000000 --- a/src/mobilerun_sdk/resources/workflows/executions.py +++ /dev/null @@ -1,402 +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 ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import path_template, 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.workflows import execution_list_params, execution_get_metrics_params -from ...types.workflows.execution_list_response import ExecutionListResponse -from ...types.workflows.execution_retrieve_response import ExecutionRetrieveResponse -from ...types.workflows.execution_get_metrics_response import ExecutionGetMetricsResponse - -__all__ = ["ExecutionsResource", "AsyncExecutionsResource"] - - -class ExecutionsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ExecutionsResourceWithRawResponse: - """ - 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 ExecutionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ExecutionsResourceWithStreamingResponse: - """ - 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 ExecutionsResourceWithStreamingResponse(self) - - def retrieve( - self, - execution_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, - ) -> ExecutionRetrieveResponse: - """ - Get execution details - - 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 execution_id: - raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") - return self._get( - path_template("/executions/{execution_id}", execution_id=execution_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExecutionRetrieveResponse, - ) - - def list( - self, - *, - flow_id: str | Omit = omit, - from_: Optional[str] | Omit = omit, - order_by: Literal["startedAt", "finishedAt", "status"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | Omit = omit, - status: Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"] | Omit = omit, - to: Optional[str] | Omit = omit, - trigger_id: str | 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, - ) -> ExecutionListResponse: - """ - List flow executions - - 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( - "/executions", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "flow_id": flow_id, - "from_": from_, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "search": search, - "status": status, - "to": to, - "trigger_id": trigger_id, - }, - execution_list_params.ExecutionListParams, - ), - ), - cast_to=ExecutionListResponse, - ) - - def get_metrics( - self, - *, - flow_id: str | Omit = omit, - from_: Optional[str] | Omit = omit, - to: Optional[str] | Omit = omit, - trigger_id: str | 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, - ) -> ExecutionGetMetricsResponse: - """ - Get execution metrics - - 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( - "/executions/metrics", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "flow_id": flow_id, - "from_": from_, - "to": to, - "trigger_id": trigger_id, - }, - execution_get_metrics_params.ExecutionGetMetricsParams, - ), - ), - cast_to=ExecutionGetMetricsResponse, - ) - - -class AsyncExecutionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncExecutionsResourceWithRawResponse: - """ - 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 AsyncExecutionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncExecutionsResourceWithStreamingResponse: - """ - 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 AsyncExecutionsResourceWithStreamingResponse(self) - - async def retrieve( - self, - execution_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, - ) -> ExecutionRetrieveResponse: - """ - Get execution details - - 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 execution_id: - raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") - return await self._get( - path_template("/executions/{execution_id}", execution_id=execution_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExecutionRetrieveResponse, - ) - - async def list( - self, - *, - flow_id: str | Omit = omit, - from_: Optional[str] | Omit = omit, - order_by: Literal["startedAt", "finishedAt", "status"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | Omit = omit, - status: Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"] | Omit = omit, - to: Optional[str] | Omit = omit, - trigger_id: str | 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, - ) -> ExecutionListResponse: - """ - List flow executions - - 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( - "/executions", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "flow_id": flow_id, - "from_": from_, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "search": search, - "status": status, - "to": to, - "trigger_id": trigger_id, - }, - execution_list_params.ExecutionListParams, - ), - ), - cast_to=ExecutionListResponse, - ) - - async def get_metrics( - self, - *, - flow_id: str | Omit = omit, - from_: Optional[str] | Omit = omit, - to: Optional[str] | Omit = omit, - trigger_id: str | 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, - ) -> ExecutionGetMetricsResponse: - """ - Get execution metrics - - 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( - "/executions/metrics", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "flow_id": flow_id, - "from_": from_, - "to": to, - "trigger_id": trigger_id, - }, - execution_get_metrics_params.ExecutionGetMetricsParams, - ), - ), - cast_to=ExecutionGetMetricsResponse, - ) - - -class ExecutionsResourceWithRawResponse: - def __init__(self, executions: ExecutionsResource) -> None: - self._executions = executions - - self.retrieve = to_raw_response_wrapper( - executions.retrieve, - ) - self.list = to_raw_response_wrapper( - executions.list, - ) - self.get_metrics = to_raw_response_wrapper( - executions.get_metrics, - ) - - -class AsyncExecutionsResourceWithRawResponse: - def __init__(self, executions: AsyncExecutionsResource) -> None: - self._executions = executions - - self.retrieve = async_to_raw_response_wrapper( - executions.retrieve, - ) - self.list = async_to_raw_response_wrapper( - executions.list, - ) - self.get_metrics = async_to_raw_response_wrapper( - executions.get_metrics, - ) - - -class ExecutionsResourceWithStreamingResponse: - def __init__(self, executions: ExecutionsResource) -> None: - self._executions = executions - - self.retrieve = to_streamed_response_wrapper( - executions.retrieve, - ) - self.list = to_streamed_response_wrapper( - executions.list, - ) - self.get_metrics = to_streamed_response_wrapper( - executions.get_metrics, - ) - - -class AsyncExecutionsResourceWithStreamingResponse: - def __init__(self, executions: AsyncExecutionsResource) -> None: - self._executions = executions - - self.retrieve = async_to_streamed_response_wrapper( - executions.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - executions.list, - ) - self.get_metrics = async_to_streamed_response_wrapper( - executions.get_metrics, - ) diff --git a/src/mobilerun_sdk/resources/workflows/flows/__init__.py b/src/mobilerun_sdk/resources/workflows/flows/__init__.py deleted file mode 100644 index bfeb155..0000000 --- a/src/mobilerun_sdk/resources/workflows/flows/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .flows import ( - FlowsResource, - AsyncFlowsResource, - FlowsResourceWithRawResponse, - AsyncFlowsResourceWithRawResponse, - FlowsResourceWithStreamingResponse, - AsyncFlowsResourceWithStreamingResponse, -) -from .actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) - -__all__ = [ - "ActionsResource", - "AsyncActionsResource", - "ActionsResourceWithRawResponse", - "AsyncActionsResourceWithRawResponse", - "ActionsResourceWithStreamingResponse", - "AsyncActionsResourceWithStreamingResponse", - "FlowsResource", - "AsyncFlowsResource", - "FlowsResourceWithRawResponse", - "AsyncFlowsResourceWithRawResponse", - "FlowsResourceWithStreamingResponse", - "AsyncFlowsResourceWithStreamingResponse", -] diff --git a/src/mobilerun_sdk/resources/workflows/flows/actions.py b/src/mobilerun_sdk/resources/workflows/flows/actions.py deleted file mode 100644 index 06e3278..0000000 --- a/src/mobilerun_sdk/resources/workflows/flows/actions.py +++ /dev/null @@ -1,454 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import path_template, 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.workflows.flows import action_add_params, action_replace_params -from ....types.workflows.flows.action_add_response import ActionAddResponse -from ....types.workflows.flows.action_list_response import ActionListResponse -from ....types.workflows.flow_action_overrides_param import FlowActionOverridesParam -from ....types.workflows.flows.action_remove_response import ActionRemoveResponse -from ....types.workflows.flow_child_action_input_param import FlowChildActionInputParam -from ....types.workflows.flows.action_replace_response import ActionReplaceResponse - -__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 list( - self, - flow_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, - ) -> ActionListResponse: - """ - List actions for a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._get( - path_template("/flows/{flow_id}/actions", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionListResponse, - ) - - def add( - self, - flow_id: str, - *, - action_id: str, - position: int, - children: Iterable[FlowChildActionInputParam] | Omit = omit, - continue_on_error: bool | Omit = omit, - name_override: str | Omit = omit, - overrides: Optional[FlowActionOverridesParam] | Omit = omit, - parent_flow_action_id: Optional[str] | 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, - ) -> ActionAddResponse: - """ - Add an action to a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._post( - path_template("/flows/{flow_id}/actions", flow_id=flow_id), - body=maybe_transform( - { - "action_id": action_id, - "position": position, - "children": children, - "continue_on_error": continue_on_error, - "name_override": name_override, - "overrides": overrides, - "parent_flow_action_id": parent_flow_action_id, - }, - action_add_params.ActionAddParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionAddResponse, - ) - - def remove( - self, - flow_action_id: str, - *, - flow_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, - ) -> ActionRemoveResponse: - """ - Remove an action from a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - if not flow_action_id: - raise ValueError(f"Expected a non-empty value for `flow_action_id` but received {flow_action_id!r}") - return self._delete( - path_template("/flows/{flow_id}/actions/{flow_action_id}", flow_id=flow_id, flow_action_id=flow_action_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionRemoveResponse, - ) - - def replace( - self, - flow_id: str, - *, - actions: Iterable[action_replace_params.Action], - # 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, - ) -> ActionReplaceResponse: - """ - Replace all actions for a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._put( - path_template("/flows/{flow_id}/actions", flow_id=flow_id), - body=maybe_transform({"actions": actions}, action_replace_params.ActionReplaceParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionReplaceResponse, - ) - - -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 list( - self, - flow_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, - ) -> ActionListResponse: - """ - List actions for a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._get( - path_template("/flows/{flow_id}/actions", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionListResponse, - ) - - async def add( - self, - flow_id: str, - *, - action_id: str, - position: int, - children: Iterable[FlowChildActionInputParam] | Omit = omit, - continue_on_error: bool | Omit = omit, - name_override: str | Omit = omit, - overrides: Optional[FlowActionOverridesParam] | Omit = omit, - parent_flow_action_id: Optional[str] | 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, - ) -> ActionAddResponse: - """ - Add an action to a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._post( - path_template("/flows/{flow_id}/actions", flow_id=flow_id), - body=await async_maybe_transform( - { - "action_id": action_id, - "position": position, - "children": children, - "continue_on_error": continue_on_error, - "name_override": name_override, - "overrides": overrides, - "parent_flow_action_id": parent_flow_action_id, - }, - action_add_params.ActionAddParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionAddResponse, - ) - - async def remove( - self, - flow_action_id: str, - *, - flow_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, - ) -> ActionRemoveResponse: - """ - Remove an action from a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - if not flow_action_id: - raise ValueError(f"Expected a non-empty value for `flow_action_id` but received {flow_action_id!r}") - return await self._delete( - path_template("/flows/{flow_id}/actions/{flow_action_id}", flow_id=flow_id, flow_action_id=flow_action_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionRemoveResponse, - ) - - async def replace( - self, - flow_id: str, - *, - actions: Iterable[action_replace_params.Action], - # 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, - ) -> ActionReplaceResponse: - """ - Replace all actions for a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._put( - path_template("/flows/{flow_id}/actions", flow_id=flow_id), - body=await async_maybe_transform({"actions": actions}, action_replace_params.ActionReplaceParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionReplaceResponse, - ) - - -class ActionsResourceWithRawResponse: - def __init__(self, actions: ActionsResource) -> None: - self._actions = actions - - self.list = to_raw_response_wrapper( - actions.list, - ) - self.add = to_raw_response_wrapper( - actions.add, - ) - self.remove = to_raw_response_wrapper( - actions.remove, - ) - self.replace = to_raw_response_wrapper( - actions.replace, - ) - - -class AsyncActionsResourceWithRawResponse: - def __init__(self, actions: AsyncActionsResource) -> None: - self._actions = actions - - self.list = async_to_raw_response_wrapper( - actions.list, - ) - self.add = async_to_raw_response_wrapper( - actions.add, - ) - self.remove = async_to_raw_response_wrapper( - actions.remove, - ) - self.replace = async_to_raw_response_wrapper( - actions.replace, - ) - - -class ActionsResourceWithStreamingResponse: - def __init__(self, actions: ActionsResource) -> None: - self._actions = actions - - self.list = to_streamed_response_wrapper( - actions.list, - ) - self.add = to_streamed_response_wrapper( - actions.add, - ) - self.remove = to_streamed_response_wrapper( - actions.remove, - ) - self.replace = to_streamed_response_wrapper( - actions.replace, - ) - - -class AsyncActionsResourceWithStreamingResponse: - def __init__(self, actions: AsyncActionsResource) -> None: - self._actions = actions - - self.list = async_to_streamed_response_wrapper( - actions.list, - ) - self.add = async_to_streamed_response_wrapper( - actions.add, - ) - self.remove = async_to_streamed_response_wrapper( - actions.remove, - ) - self.replace = async_to_streamed_response_wrapper( - actions.replace, - ) diff --git a/src/mobilerun_sdk/resources/workflows/flows/flows.py b/src/mobilerun_sdk/resources/workflows/flows/flows.py deleted file mode 100644 index c1acea9..0000000 --- a/src/mobilerun_sdk/resources/workflows/flows/flows.py +++ /dev/null @@ -1,836 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Iterable, Optional -from typing_extensions import Literal - -import httpx - -from .actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import path_template, 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.workflows import flow_list_params, flow_clone_params, flow_create_params, flow_update_params -from ....types.workflows.flow_list_response import FlowListResponse -from ....types.workflows.flow_clone_response import FlowCloneResponse -from ....types.workflows.flow_create_response import FlowCreateResponse -from ....types.workflows.flow_delete_response import FlowDeleteResponse -from ....types.workflows.flow_update_response import FlowUpdateResponse -from ....types.workflows.flow_unblock_response import FlowUnblockResponse -from ....types.workflows.flow_retrieve_response import FlowRetrieveResponse - -__all__ = ["FlowsResource", "AsyncFlowsResource"] - - -class FlowsResource(SyncAPIResource): - @cached_property - def actions(self) -> ActionsResource: - return ActionsResource(self._client) - - @cached_property - def with_raw_response(self) -> FlowsResourceWithRawResponse: - """ - 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 FlowsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FlowsResourceWithStreamingResponse: - """ - 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 FlowsResourceWithStreamingResponse(self) - - def create( - self, - *, - actions: Iterable[flow_create_params.Action], - name: str, - trigger_id: str, - cooldown_scope: Literal["flow", "device"] | Omit = omit, - cooldown_seconds: Optional[int] | Omit = omit, - description: str | Omit = omit, - device_ids: SequenceNotStr[str] | Omit = omit, - enabled: bool | Omit = omit, - notify_on_failure: bool | Omit = omit, - notify_on_success: bool | Omit = omit, - notify_webhook_id: Optional[str] | 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, - ) -> FlowCreateResponse: - """ - Create a flow - - 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( - "/flows", - body=maybe_transform( - { - "actions": actions, - "name": name, - "trigger_id": trigger_id, - "cooldown_scope": cooldown_scope, - "cooldown_seconds": cooldown_seconds, - "description": description, - "device_ids": device_ids, - "enabled": enabled, - "notify_on_failure": notify_on_failure, - "notify_on_success": notify_on_success, - "notify_webhook_id": notify_webhook_id, - }, - flow_create_params.FlowCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowCreateResponse, - ) - - def retrieve( - self, - flow_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, - ) -> FlowRetrieveResponse: - """ - Get a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._get( - path_template("/flows/{flow_id}", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowRetrieveResponse, - ) - - def update( - self, - flow_id: str, - *, - cooldown_scope: Literal["flow", "device"] | Omit = omit, - cooldown_seconds: Optional[int] | Omit = omit, - description: str | Omit = omit, - device_ids: SequenceNotStr[str] | Omit = omit, - enabled: bool | Omit = omit, - name: str | Omit = omit, - notify_on_failure: bool | Omit = omit, - notify_on_success: bool | Omit = omit, - notify_webhook_id: Optional[str] | Omit = omit, - trigger_id: str | 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, - ) -> FlowUpdateResponse: - """ - Update a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._patch( - path_template("/flows/{flow_id}", flow_id=flow_id), - body=maybe_transform( - { - "cooldown_scope": cooldown_scope, - "cooldown_seconds": cooldown_seconds, - "description": description, - "device_ids": device_ids, - "enabled": enabled, - "name": name, - "notify_on_failure": notify_on_failure, - "notify_on_success": notify_on_success, - "notify_webhook_id": notify_webhook_id, - "trigger_id": trigger_id, - }, - flow_update_params.FlowUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowUpdateResponse, - ) - - def list( - self, - *, - enabled: Optional[bool] | Omit = omit, - order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | Omit = omit, - status: List[Literal["healthy", "failing", "blocked"]] | Omit = omit, - trigger_id: str | 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, - ) -> FlowListResponse: - """ - List flows - - 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( - "/flows", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "enabled": enabled, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "search": search, - "status": status, - "trigger_id": trigger_id, - }, - flow_list_params.FlowListParams, - ), - ), - cast_to=FlowListResponse, - ) - - def delete( - self, - flow_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, - ) -> FlowDeleteResponse: - """ - Delete a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._delete( - path_template("/flows/{flow_id}", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowDeleteResponse, - ) - - def clone( - self, - flow_id: str, - *, - device_ids: SequenceNotStr[str] | Omit = omit, - name: str | 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, - ) -> FlowCloneResponse: - """ - Clone a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._post( - path_template("/flows/{flow_id}/clone", flow_id=flow_id), - body=maybe_transform( - { - "device_ids": device_ids, - "name": name, - }, - flow_clone_params.FlowCloneParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowCloneResponse, - ) - - def unblock( - self, - flow_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, - ) -> FlowUnblockResponse: - """Clear a flow's blocked status after fixing the underlying issue. - - Idempotent — - safe to call on already-healthy flows. - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return self._post( - path_template("/flows/{flow_id}/unblock", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowUnblockResponse, - ) - - -class AsyncFlowsResource(AsyncAPIResource): - @cached_property - def actions(self) -> AsyncActionsResource: - return AsyncActionsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncFlowsResourceWithRawResponse: - """ - 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 AsyncFlowsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFlowsResourceWithStreamingResponse: - """ - 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 AsyncFlowsResourceWithStreamingResponse(self) - - async def create( - self, - *, - actions: Iterable[flow_create_params.Action], - name: str, - trigger_id: str, - cooldown_scope: Literal["flow", "device"] | Omit = omit, - cooldown_seconds: Optional[int] | Omit = omit, - description: str | Omit = omit, - device_ids: SequenceNotStr[str] | Omit = omit, - enabled: bool | Omit = omit, - notify_on_failure: bool | Omit = omit, - notify_on_success: bool | Omit = omit, - notify_webhook_id: Optional[str] | 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, - ) -> FlowCreateResponse: - """ - Create a flow - - 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( - "/flows", - body=await async_maybe_transform( - { - "actions": actions, - "name": name, - "trigger_id": trigger_id, - "cooldown_scope": cooldown_scope, - "cooldown_seconds": cooldown_seconds, - "description": description, - "device_ids": device_ids, - "enabled": enabled, - "notify_on_failure": notify_on_failure, - "notify_on_success": notify_on_success, - "notify_webhook_id": notify_webhook_id, - }, - flow_create_params.FlowCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowCreateResponse, - ) - - async def retrieve( - self, - flow_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, - ) -> FlowRetrieveResponse: - """ - Get a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._get( - path_template("/flows/{flow_id}", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowRetrieveResponse, - ) - - async def update( - self, - flow_id: str, - *, - cooldown_scope: Literal["flow", "device"] | Omit = omit, - cooldown_seconds: Optional[int] | Omit = omit, - description: str | Omit = omit, - device_ids: SequenceNotStr[str] | Omit = omit, - enabled: bool | Omit = omit, - name: str | Omit = omit, - notify_on_failure: bool | Omit = omit, - notify_on_success: bool | Omit = omit, - notify_webhook_id: Optional[str] | Omit = omit, - trigger_id: str | 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, - ) -> FlowUpdateResponse: - """ - Update a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._patch( - path_template("/flows/{flow_id}", flow_id=flow_id), - body=await async_maybe_transform( - { - "cooldown_scope": cooldown_scope, - "cooldown_seconds": cooldown_seconds, - "description": description, - "device_ids": device_ids, - "enabled": enabled, - "name": name, - "notify_on_failure": notify_on_failure, - "notify_on_success": notify_on_success, - "notify_webhook_id": notify_webhook_id, - "trigger_id": trigger_id, - }, - flow_update_params.FlowUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowUpdateResponse, - ) - - async def list( - self, - *, - enabled: Optional[bool] | Omit = omit, - order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | Omit = omit, - status: List[Literal["healthy", "failing", "blocked"]] | Omit = omit, - trigger_id: str | 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, - ) -> FlowListResponse: - """ - List flows - - 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( - "/flows", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "enabled": enabled, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "search": search, - "status": status, - "trigger_id": trigger_id, - }, - flow_list_params.FlowListParams, - ), - ), - cast_to=FlowListResponse, - ) - - async def delete( - self, - flow_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, - ) -> FlowDeleteResponse: - """ - Delete a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._delete( - path_template("/flows/{flow_id}", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowDeleteResponse, - ) - - async def clone( - self, - flow_id: str, - *, - device_ids: SequenceNotStr[str] | Omit = omit, - name: str | 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, - ) -> FlowCloneResponse: - """ - Clone a flow - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._post( - path_template("/flows/{flow_id}/clone", flow_id=flow_id), - body=await async_maybe_transform( - { - "device_ids": device_ids, - "name": name, - }, - flow_clone_params.FlowCloneParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowCloneResponse, - ) - - async def unblock( - self, - flow_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, - ) -> FlowUnblockResponse: - """Clear a flow's blocked status after fixing the underlying issue. - - Idempotent — - safe to call on already-healthy flows. - - 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 flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return await self._post( - path_template("/flows/{flow_id}/unblock", flow_id=flow_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FlowUnblockResponse, - ) - - -class FlowsResourceWithRawResponse: - def __init__(self, flows: FlowsResource) -> None: - self._flows = flows - - self.create = to_raw_response_wrapper( - flows.create, - ) - self.retrieve = to_raw_response_wrapper( - flows.retrieve, - ) - self.update = to_raw_response_wrapper( - flows.update, - ) - self.list = to_raw_response_wrapper( - flows.list, - ) - self.delete = to_raw_response_wrapper( - flows.delete, - ) - self.clone = to_raw_response_wrapper( - flows.clone, - ) - self.unblock = to_raw_response_wrapper( - flows.unblock, - ) - - @cached_property - def actions(self) -> ActionsResourceWithRawResponse: - return ActionsResourceWithRawResponse(self._flows.actions) - - -class AsyncFlowsResourceWithRawResponse: - def __init__(self, flows: AsyncFlowsResource) -> None: - self._flows = flows - - self.create = async_to_raw_response_wrapper( - flows.create, - ) - self.retrieve = async_to_raw_response_wrapper( - flows.retrieve, - ) - self.update = async_to_raw_response_wrapper( - flows.update, - ) - self.list = async_to_raw_response_wrapper( - flows.list, - ) - self.delete = async_to_raw_response_wrapper( - flows.delete, - ) - self.clone = async_to_raw_response_wrapper( - flows.clone, - ) - self.unblock = async_to_raw_response_wrapper( - flows.unblock, - ) - - @cached_property - def actions(self) -> AsyncActionsResourceWithRawResponse: - return AsyncActionsResourceWithRawResponse(self._flows.actions) - - -class FlowsResourceWithStreamingResponse: - def __init__(self, flows: FlowsResource) -> None: - self._flows = flows - - self.create = to_streamed_response_wrapper( - flows.create, - ) - self.retrieve = to_streamed_response_wrapper( - flows.retrieve, - ) - self.update = to_streamed_response_wrapper( - flows.update, - ) - self.list = to_streamed_response_wrapper( - flows.list, - ) - self.delete = to_streamed_response_wrapper( - flows.delete, - ) - self.clone = to_streamed_response_wrapper( - flows.clone, - ) - self.unblock = to_streamed_response_wrapper( - flows.unblock, - ) - - @cached_property - def actions(self) -> ActionsResourceWithStreamingResponse: - return ActionsResourceWithStreamingResponse(self._flows.actions) - - -class AsyncFlowsResourceWithStreamingResponse: - def __init__(self, flows: AsyncFlowsResource) -> None: - self._flows = flows - - self.create = async_to_streamed_response_wrapper( - flows.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - flows.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - flows.update, - ) - self.list = async_to_streamed_response_wrapper( - flows.list, - ) - self.delete = async_to_streamed_response_wrapper( - flows.delete, - ) - self.clone = async_to_streamed_response_wrapper( - flows.clone, - ) - self.unblock = async_to_streamed_response_wrapper( - flows.unblock, - ) - - @cached_property - def actions(self) -> AsyncActionsResourceWithStreamingResponse: - return AsyncActionsResourceWithStreamingResponse(self._flows.actions) diff --git a/src/mobilerun_sdk/resources/workflows/timezones.py b/src/mobilerun_sdk/resources/workflows/timezones.py deleted file mode 100644 index 5b7e797..0000000 --- a/src/mobilerun_sdk/resources/workflows/timezones.py +++ /dev/null @@ -1,135 +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, Query, Headers, NotGiven, not_given -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.workflows.timezone_list_response import TimezoneListResponse - -__all__ = ["TimezonesResource", "AsyncTimezonesResource"] - - -class TimezonesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TimezonesResourceWithRawResponse: - """ - 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 TimezonesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TimezonesResourceWithStreamingResponse: - """ - 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 TimezonesResourceWithStreamingResponse(self) - - def list( - 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, - ) -> TimezoneListResponse: - """List supported IANA timezones""" - return self._get( - "/timezones", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TimezoneListResponse, - ) - - -class AsyncTimezonesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTimezonesResourceWithRawResponse: - """ - 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 AsyncTimezonesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTimezonesResourceWithStreamingResponse: - """ - 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 AsyncTimezonesResourceWithStreamingResponse(self) - - async def list( - 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, - ) -> TimezoneListResponse: - """List supported IANA timezones""" - return await self._get( - "/timezones", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TimezoneListResponse, - ) - - -class TimezonesResourceWithRawResponse: - def __init__(self, timezones: TimezonesResource) -> None: - self._timezones = timezones - - self.list = to_raw_response_wrapper( - timezones.list, - ) - - -class AsyncTimezonesResourceWithRawResponse: - def __init__(self, timezones: AsyncTimezonesResource) -> None: - self._timezones = timezones - - self.list = async_to_raw_response_wrapper( - timezones.list, - ) - - -class TimezonesResourceWithStreamingResponse: - def __init__(self, timezones: TimezonesResource) -> None: - self._timezones = timezones - - self.list = to_streamed_response_wrapper( - timezones.list, - ) - - -class AsyncTimezonesResourceWithStreamingResponse: - def __init__(self, timezones: AsyncTimezonesResource) -> None: - self._timezones = timezones - - self.list = async_to_streamed_response_wrapper( - timezones.list, - ) diff --git a/src/mobilerun_sdk/resources/workflows/triggers.py b/src/mobilerun_sdk/resources/workflows/triggers.py deleted file mode 100644 index b6a1b4c..0000000 --- a/src/mobilerun_sdk/resources/workflows/triggers.py +++ /dev/null @@ -1,731 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Literal - -import httpx - -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import path_template, 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.workflows import trigger_fire_params, trigger_list_params, trigger_create_params, trigger_update_params -from ...types.workflows.trigger_fire_response import TriggerFireResponse -from ...types.workflows.trigger_list_response import TriggerListResponse -from ...types.workflows.trigger_create_response import TriggerCreateResponse -from ...types.workflows.trigger_delete_response import TriggerDeleteResponse -from ...types.workflows.trigger_update_response import TriggerUpdateResponse -from ...types.workflows.trigger_retrieve_response import TriggerRetrieveResponse - -__all__ = ["TriggersResource", "AsyncTriggersResource"] - - -class TriggersResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TriggersResourceWithRawResponse: - """ - 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 TriggersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TriggersResourceWithStreamingResponse: - """ - 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 TriggersResourceWithStreamingResponse(self) - - def create( - self, - *, - activation: Literal["event", "schedule", "custom"], - name: str, - conditions: trigger_create_params.Conditions | Omit = omit, - custom_payload_schema: Dict[str, object] | Omit = omit, - description: str | Omit = omit, - event_type: str | Omit = omit, - schedule_rule: trigger_create_params.ScheduleRule | Omit = omit, - timezone: str | 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, - ) -> TriggerCreateResponse: - """ - Create a trigger - - Args: - custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger - - 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( - "/triggers", - body=maybe_transform( - { - "activation": activation, - "name": name, - "conditions": conditions, - "custom_payload_schema": custom_payload_schema, - "description": description, - "event_type": event_type, - "schedule_rule": schedule_rule, - "timezone": timezone, - }, - trigger_create_params.TriggerCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerCreateResponse, - ) - - def retrieve( - self, - trigger_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, - ) -> TriggerRetrieveResponse: - """ - Get a trigger - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return self._get( - path_template("/triggers/{trigger_id}", trigger_id=trigger_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerRetrieveResponse, - ) - - def update( - self, - trigger_id: str, - *, - activation: Literal["event", "schedule", "custom"] | Omit = omit, - conditions: trigger_update_params.Conditions | Omit = omit, - custom_payload_schema: Optional[Dict[str, object]] | Omit = omit, - description: str | Omit = omit, - event_type: str | Omit = omit, - name: str | Omit = omit, - schedule_rule: trigger_update_params.ScheduleRule | Omit = omit, - timezone: Optional[str] | 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, - ) -> TriggerUpdateResponse: - """ - Update a trigger - - Args: - custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return self._patch( - path_template("/triggers/{trigger_id}", trigger_id=trigger_id), - body=maybe_transform( - { - "activation": activation, - "conditions": conditions, - "custom_payload_schema": custom_payload_schema, - "description": description, - "event_type": event_type, - "name": name, - "schedule_rule": schedule_rule, - "timezone": timezone, - }, - trigger_update_params.TriggerUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerUpdateResponse, - ) - - def list( - self, - *, - activation: Literal["event", "schedule", "custom"] | Omit = omit, - event_type: str | Omit = omit, - order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | 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, - ) -> TriggerListResponse: - """ - List triggers - - 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( - "/triggers", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "activation": activation, - "event_type": event_type, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "search": search, - }, - trigger_list_params.TriggerListParams, - ), - ), - cast_to=TriggerListResponse, - ) - - def delete( - self, - trigger_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, - ) -> TriggerDeleteResponse: - """ - Delete a trigger - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return self._delete( - path_template("/triggers/{trigger_id}", trigger_id=trigger_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerDeleteResponse, - ) - - def fire( - self, - trigger_id: str, - *, - payload: Dict[str, object], - # 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, - ) -> TriggerFireResponse: - """ - Invoke a custom trigger directly with an arbitrary JSON payload. - - Fan-out: a trigger may be referenced by multiple flows (workflows). Firing it - enqueues one execution per enabled, non-deleted flow attached to this trigger, - each receiving the same payload. The `enqueuedCount` in the response reports how - many were enqueued (0 if no flows are attached, or if all matching flows are - gated by a cooldown). - - Payload validation: - - - If the trigger has a `customPayloadSchema`, the payload is validated against - it (JSON Schema via AJV). - - If no schema is configured, the payload only needs to be a JSON object — any - keys and values are accepted. - - Only triggers with `activation = "custom"` can be fired through this endpoint; - event and schedule triggers return 409. - - Args: - payload: Arbitrary JSON object forwarded to every flow attached to this trigger. - Validated against the trigger's customPayloadSchema when one is configured; - otherwise only "must be a JSON object" is enforced. - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return self._post( - path_template("/triggers/{trigger_id}/fire", trigger_id=trigger_id), - body=maybe_transform({"payload": payload}, trigger_fire_params.TriggerFireParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerFireResponse, - ) - - -class AsyncTriggersResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTriggersResourceWithRawResponse: - """ - 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 AsyncTriggersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTriggersResourceWithStreamingResponse: - """ - 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 AsyncTriggersResourceWithStreamingResponse(self) - - async def create( - self, - *, - activation: Literal["event", "schedule", "custom"], - name: str, - conditions: trigger_create_params.Conditions | Omit = omit, - custom_payload_schema: Dict[str, object] | Omit = omit, - description: str | Omit = omit, - event_type: str | Omit = omit, - schedule_rule: trigger_create_params.ScheduleRule | Omit = omit, - timezone: str | 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, - ) -> TriggerCreateResponse: - """ - Create a trigger - - Args: - custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger - - 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( - "/triggers", - body=await async_maybe_transform( - { - "activation": activation, - "name": name, - "conditions": conditions, - "custom_payload_schema": custom_payload_schema, - "description": description, - "event_type": event_type, - "schedule_rule": schedule_rule, - "timezone": timezone, - }, - trigger_create_params.TriggerCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerCreateResponse, - ) - - async def retrieve( - self, - trigger_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, - ) -> TriggerRetrieveResponse: - """ - Get a trigger - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return await self._get( - path_template("/triggers/{trigger_id}", trigger_id=trigger_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerRetrieveResponse, - ) - - async def update( - self, - trigger_id: str, - *, - activation: Literal["event", "schedule", "custom"] | Omit = omit, - conditions: trigger_update_params.Conditions | Omit = omit, - custom_payload_schema: Optional[Dict[str, object]] | Omit = omit, - description: str | Omit = omit, - event_type: str | Omit = omit, - name: str | Omit = omit, - schedule_rule: trigger_update_params.ScheduleRule | Omit = omit, - timezone: Optional[str] | 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, - ) -> TriggerUpdateResponse: - """ - Update a trigger - - Args: - custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return await self._patch( - path_template("/triggers/{trigger_id}", trigger_id=trigger_id), - body=await async_maybe_transform( - { - "activation": activation, - "conditions": conditions, - "custom_payload_schema": custom_payload_schema, - "description": description, - "event_type": event_type, - "name": name, - "schedule_rule": schedule_rule, - "timezone": timezone, - }, - trigger_update_params.TriggerUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerUpdateResponse, - ) - - async def list( - self, - *, - activation: Literal["event", "schedule", "custom"] | Omit = omit, - event_type: str | Omit = omit, - order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, - order_by_direction: Literal["asc", "desc"] | Omit = omit, - page: int | Omit = omit, - page_size: int | Omit = omit, - search: str | 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, - ) -> TriggerListResponse: - """ - List triggers - - 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( - "/triggers", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "activation": activation, - "event_type": event_type, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - "search": search, - }, - trigger_list_params.TriggerListParams, - ), - ), - cast_to=TriggerListResponse, - ) - - async def delete( - self, - trigger_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, - ) -> TriggerDeleteResponse: - """ - Delete a trigger - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return await self._delete( - path_template("/triggers/{trigger_id}", trigger_id=trigger_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerDeleteResponse, - ) - - async def fire( - self, - trigger_id: str, - *, - payload: Dict[str, object], - # 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, - ) -> TriggerFireResponse: - """ - Invoke a custom trigger directly with an arbitrary JSON payload. - - Fan-out: a trigger may be referenced by multiple flows (workflows). Firing it - enqueues one execution per enabled, non-deleted flow attached to this trigger, - each receiving the same payload. The `enqueuedCount` in the response reports how - many were enqueued (0 if no flows are attached, or if all matching flows are - gated by a cooldown). - - Payload validation: - - - If the trigger has a `customPayloadSchema`, the payload is validated against - it (JSON Schema via AJV). - - If no schema is configured, the payload only needs to be a JSON object — any - keys and values are accepted. - - Only triggers with `activation = "custom"` can be fired through this endpoint; - event and schedule triggers return 409. - - Args: - payload: Arbitrary JSON object forwarded to every flow attached to this trigger. - Validated against the trigger's customPayloadSchema when one is configured; - otherwise only "must be a JSON object" is enforced. - - 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 trigger_id: - raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") - return await self._post( - path_template("/triggers/{trigger_id}/fire", trigger_id=trigger_id), - body=await async_maybe_transform({"payload": payload}, trigger_fire_params.TriggerFireParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TriggerFireResponse, - ) - - -class TriggersResourceWithRawResponse: - def __init__(self, triggers: TriggersResource) -> None: - self._triggers = triggers - - self.create = to_raw_response_wrapper( - triggers.create, - ) - self.retrieve = to_raw_response_wrapper( - triggers.retrieve, - ) - self.update = to_raw_response_wrapper( - triggers.update, - ) - self.list = to_raw_response_wrapper( - triggers.list, - ) - self.delete = to_raw_response_wrapper( - triggers.delete, - ) - self.fire = to_raw_response_wrapper( - triggers.fire, - ) - - -class AsyncTriggersResourceWithRawResponse: - def __init__(self, triggers: AsyncTriggersResource) -> None: - self._triggers = triggers - - self.create = async_to_raw_response_wrapper( - triggers.create, - ) - self.retrieve = async_to_raw_response_wrapper( - triggers.retrieve, - ) - self.update = async_to_raw_response_wrapper( - triggers.update, - ) - self.list = async_to_raw_response_wrapper( - triggers.list, - ) - self.delete = async_to_raw_response_wrapper( - triggers.delete, - ) - self.fire = async_to_raw_response_wrapper( - triggers.fire, - ) - - -class TriggersResourceWithStreamingResponse: - def __init__(self, triggers: TriggersResource) -> None: - self._triggers = triggers - - self.create = to_streamed_response_wrapper( - triggers.create, - ) - self.retrieve = to_streamed_response_wrapper( - triggers.retrieve, - ) - self.update = to_streamed_response_wrapper( - triggers.update, - ) - self.list = to_streamed_response_wrapper( - triggers.list, - ) - self.delete = to_streamed_response_wrapper( - triggers.delete, - ) - self.fire = to_streamed_response_wrapper( - triggers.fire, - ) - - -class AsyncTriggersResourceWithStreamingResponse: - def __init__(self, triggers: AsyncTriggersResource) -> None: - self._triggers = triggers - - self.create = async_to_streamed_response_wrapper( - triggers.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - triggers.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - triggers.update, - ) - self.list = async_to_streamed_response_wrapper( - triggers.list, - ) - self.delete = async_to_streamed_response_wrapper( - triggers.delete, - ) - self.fire = async_to_streamed_response_wrapper( - triggers.fire, - ) diff --git a/src/mobilerun_sdk/resources/workflows/workflows.py b/src/mobilerun_sdk/resources/workflows/workflows.py deleted file mode 100644 index 000d4bf..0000000 --- a/src/mobilerun_sdk/resources/workflows/workflows.py +++ /dev/null @@ -1,294 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from .triggers import ( - TriggersResource, - AsyncTriggersResource, - TriggersResourceWithRawResponse, - AsyncTriggersResourceWithRawResponse, - TriggersResourceWithStreamingResponse, - AsyncTriggersResourceWithStreamingResponse, -) -from ..._compat import cached_property -from .timezones import ( - TimezonesResource, - AsyncTimezonesResource, - TimezonesResourceWithRawResponse, - AsyncTimezonesResourceWithRawResponse, - TimezonesResourceWithStreamingResponse, - AsyncTimezonesResourceWithStreamingResponse, -) -from .executions import ( - ExecutionsResource, - AsyncExecutionsResource, - ExecutionsResourceWithRawResponse, - AsyncExecutionsResourceWithRawResponse, - ExecutionsResourceWithStreamingResponse, - AsyncExecutionsResourceWithStreamingResponse, -) -from ..._resource import SyncAPIResource, AsyncAPIResource -from .flows.flows import ( - FlowsResource, - AsyncFlowsResource, - FlowsResourceWithRawResponse, - AsyncFlowsResourceWithRawResponse, - FlowsResourceWithStreamingResponse, - AsyncFlowsResourceWithStreamingResponse, -) -from .action_catalog import ( - ActionCatalogResource, - AsyncActionCatalogResource, - ActionCatalogResourceWithRawResponse, - AsyncActionCatalogResourceWithRawResponse, - ActionCatalogResourceWithStreamingResponse, - AsyncActionCatalogResourceWithStreamingResponse, -) -from .actions.actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) - -__all__ = ["WorkflowsResource", "AsyncWorkflowsResource"] - - -class WorkflowsResource(SyncAPIResource): - @cached_property - def triggers(self) -> TriggersResource: - return TriggersResource(self._client) - - @cached_property - def action_catalog(self) -> ActionCatalogResource: - return ActionCatalogResource(self._client) - - @cached_property - def actions(self) -> ActionsResource: - return ActionsResource(self._client) - - @cached_property - def flows(self) -> FlowsResource: - return FlowsResource(self._client) - - @cached_property - def events(self) -> EventsResource: - return EventsResource(self._client) - - @cached_property - def executions(self) -> ExecutionsResource: - return ExecutionsResource(self._client) - - @cached_property - def timezones(self) -> TimezonesResource: - return TimezonesResource(self._client) - - @cached_property - def with_raw_response(self) -> WorkflowsResourceWithRawResponse: - """ - 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 WorkflowsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WorkflowsResourceWithStreamingResponse: - """ - 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 WorkflowsResourceWithStreamingResponse(self) - - -class AsyncWorkflowsResource(AsyncAPIResource): - @cached_property - def triggers(self) -> AsyncTriggersResource: - return AsyncTriggersResource(self._client) - - @cached_property - def action_catalog(self) -> AsyncActionCatalogResource: - return AsyncActionCatalogResource(self._client) - - @cached_property - def actions(self) -> AsyncActionsResource: - return AsyncActionsResource(self._client) - - @cached_property - def flows(self) -> AsyncFlowsResource: - return AsyncFlowsResource(self._client) - - @cached_property - def events(self) -> AsyncEventsResource: - return AsyncEventsResource(self._client) - - @cached_property - def executions(self) -> AsyncExecutionsResource: - return AsyncExecutionsResource(self._client) - - @cached_property - def timezones(self) -> AsyncTimezonesResource: - return AsyncTimezonesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncWorkflowsResourceWithRawResponse: - """ - 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 AsyncWorkflowsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWorkflowsResourceWithStreamingResponse: - """ - 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 AsyncWorkflowsResourceWithStreamingResponse(self) - - -class WorkflowsResourceWithRawResponse: - def __init__(self, workflows: WorkflowsResource) -> None: - self._workflows = workflows - - @cached_property - def triggers(self) -> TriggersResourceWithRawResponse: - return TriggersResourceWithRawResponse(self._workflows.triggers) - - @cached_property - def action_catalog(self) -> ActionCatalogResourceWithRawResponse: - return ActionCatalogResourceWithRawResponse(self._workflows.action_catalog) - - @cached_property - def actions(self) -> ActionsResourceWithRawResponse: - return ActionsResourceWithRawResponse(self._workflows.actions) - - @cached_property - def flows(self) -> FlowsResourceWithRawResponse: - return FlowsResourceWithRawResponse(self._workflows.flows) - - @cached_property - def events(self) -> EventsResourceWithRawResponse: - return EventsResourceWithRawResponse(self._workflows.events) - - @cached_property - def executions(self) -> ExecutionsResourceWithRawResponse: - return ExecutionsResourceWithRawResponse(self._workflows.executions) - - @cached_property - def timezones(self) -> TimezonesResourceWithRawResponse: - return TimezonesResourceWithRawResponse(self._workflows.timezones) - - -class AsyncWorkflowsResourceWithRawResponse: - def __init__(self, workflows: AsyncWorkflowsResource) -> None: - self._workflows = workflows - - @cached_property - def triggers(self) -> AsyncTriggersResourceWithRawResponse: - return AsyncTriggersResourceWithRawResponse(self._workflows.triggers) - - @cached_property - def action_catalog(self) -> AsyncActionCatalogResourceWithRawResponse: - return AsyncActionCatalogResourceWithRawResponse(self._workflows.action_catalog) - - @cached_property - def actions(self) -> AsyncActionsResourceWithRawResponse: - return AsyncActionsResourceWithRawResponse(self._workflows.actions) - - @cached_property - def flows(self) -> AsyncFlowsResourceWithRawResponse: - return AsyncFlowsResourceWithRawResponse(self._workflows.flows) - - @cached_property - def events(self) -> AsyncEventsResourceWithRawResponse: - return AsyncEventsResourceWithRawResponse(self._workflows.events) - - @cached_property - def executions(self) -> AsyncExecutionsResourceWithRawResponse: - return AsyncExecutionsResourceWithRawResponse(self._workflows.executions) - - @cached_property - def timezones(self) -> AsyncTimezonesResourceWithRawResponse: - return AsyncTimezonesResourceWithRawResponse(self._workflows.timezones) - - -class WorkflowsResourceWithStreamingResponse: - def __init__(self, workflows: WorkflowsResource) -> None: - self._workflows = workflows - - @cached_property - def triggers(self) -> TriggersResourceWithStreamingResponse: - return TriggersResourceWithStreamingResponse(self._workflows.triggers) - - @cached_property - def action_catalog(self) -> ActionCatalogResourceWithStreamingResponse: - return ActionCatalogResourceWithStreamingResponse(self._workflows.action_catalog) - - @cached_property - def actions(self) -> ActionsResourceWithStreamingResponse: - return ActionsResourceWithStreamingResponse(self._workflows.actions) - - @cached_property - def flows(self) -> FlowsResourceWithStreamingResponse: - return FlowsResourceWithStreamingResponse(self._workflows.flows) - - @cached_property - def events(self) -> EventsResourceWithStreamingResponse: - return EventsResourceWithStreamingResponse(self._workflows.events) - - @cached_property - def executions(self) -> ExecutionsResourceWithStreamingResponse: - return ExecutionsResourceWithStreamingResponse(self._workflows.executions) - - @cached_property - def timezones(self) -> TimezonesResourceWithStreamingResponse: - return TimezonesResourceWithStreamingResponse(self._workflows.timezones) - - -class AsyncWorkflowsResourceWithStreamingResponse: - def __init__(self, workflows: AsyncWorkflowsResource) -> None: - self._workflows = workflows - - @cached_property - def triggers(self) -> AsyncTriggersResourceWithStreamingResponse: - return AsyncTriggersResourceWithStreamingResponse(self._workflows.triggers) - - @cached_property - def action_catalog(self) -> AsyncActionCatalogResourceWithStreamingResponse: - return AsyncActionCatalogResourceWithStreamingResponse(self._workflows.action_catalog) - - @cached_property - def actions(self) -> AsyncActionsResourceWithStreamingResponse: - return AsyncActionsResourceWithStreamingResponse(self._workflows.actions) - - @cached_property - def flows(self) -> AsyncFlowsResourceWithStreamingResponse: - return AsyncFlowsResourceWithStreamingResponse(self._workflows.flows) - - @cached_property - def events(self) -> AsyncEventsResourceWithStreamingResponse: - return AsyncEventsResourceWithStreamingResponse(self._workflows.events) - - @cached_property - def executions(self) -> AsyncExecutionsResourceWithStreamingResponse: - return AsyncExecutionsResourceWithStreamingResponse(self._workflows.executions) - - @cached_property - def timezones(self) -> AsyncTimezonesResourceWithStreamingResponse: - return AsyncTimezonesResourceWithStreamingResponse(self._workflows.timezones) diff --git a/src/mobilerun_sdk/types/__init__.py b/src/mobilerun_sdk/types/__init__.py index ecf96d9..191a66a 100644 --- a/src/mobilerun_sdk/types/__init__.py +++ b/src/mobilerun_sdk/types/__init__.py @@ -4,7 +4,6 @@ from . import devices from .. import _compat -from .flow import Flow as Flow from .task import Task as Task from .device import Device as Device from .shared import ( diff --git a/src/mobilerun_sdk/types/flow.py b/src/mobilerun_sdk/types/flow.py deleted file mode 100644 index 6457f9d..0000000 --- a/src/mobilerun_sdk/types/flow.py +++ /dev/null @@ -1,54 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["Flow"] - - -class Flow(BaseModel): - id: str - - blocked_at: Optional[str] = FieldInfo(alias="blockedAt", default=None) - - consecutive_failures: int = FieldInfo(alias="consecutiveFailures") - - cooldown_scope: Literal["flow", "device"] = FieldInfo(alias="cooldownScope") - - cooldown_seconds: Optional[int] = FieldInfo(alias="cooldownSeconds", default=None) - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - description: Optional[str] = None - - device_ids: List[str] = FieldInfo(alias="deviceIds") - - enabled: bool - - last_failure_at: Optional[str] = FieldInfo(alias="lastFailureAt", default=None) - - last_failure_code: Optional[ - Literal["device_not_found", "permission_denied", "client_error", "transient", "logic", "invalid_config"] - ] = FieldInfo(alias="lastFailureCode", default=None) - - last_triggered_at: Optional[str] = FieldInfo(alias="lastTriggeredAt", default=None) - - name: str - - notify_on_failure: bool = FieldInfo(alias="notifyOnFailure") - - notify_on_success: bool = FieldInfo(alias="notifyOnSuccess") - - notify_webhook_id: Optional[str] = FieldInfo(alias="notifyWebhookId", default=None) - - status: Literal["healthy", "failing", "blocked"] - - trigger_id: str = FieldInfo(alias="triggerId") - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - user_id: str = FieldInfo(alias="userId") diff --git a/src/mobilerun_sdk/types/workflows/__init__.py b/src/mobilerun_sdk/types/workflows/__init__.py index 860c6eb..f8ee8b1 100644 --- a/src/mobilerun_sdk/types/workflows/__init__.py +++ b/src/mobilerun_sdk/types/workflows/__init__.py @@ -1,51 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .action import Action as Action -from .flow_execution import FlowExecution as FlowExecution -from .flow_list_params import FlowListParams as FlowListParams -from .flow_clone_params import FlowCloneParams as FlowCloneParams -from .action_list_params import ActionListParams as ActionListParams -from .flow_create_params import FlowCreateParams as FlowCreateParams -from .flow_list_response import FlowListResponse as FlowListResponse -from .flow_update_params import FlowUpdateParams as FlowUpdateParams -from .event_ingest_params import EventIngestParams as EventIngestParams -from .flow_clone_response import FlowCloneResponse as FlowCloneResponse -from .trigger_fire_params import TriggerFireParams as TriggerFireParams -from .trigger_list_params import TriggerListParams as TriggerListParams -from .action_catalog_entry import ActionCatalogEntry as ActionCatalogEntry -from .action_create_params import ActionCreateParams as ActionCreateParams -from .action_list_response import ActionListResponse as ActionListResponse -from .action_update_params import ActionUpdateParams as ActionUpdateParams -from .event_dry_run_params import EventDryRunParams as EventDryRunParams -from .flow_create_response import FlowCreateResponse as FlowCreateResponse -from .flow_delete_response import FlowDeleteResponse as FlowDeleteResponse -from .flow_update_response import FlowUpdateResponse as FlowUpdateResponse -from .event_ingest_response import EventIngestResponse as EventIngestResponse -from .execution_list_params import ExecutionListParams as ExecutionListParams -from .flow_unblock_response import FlowUnblockResponse as FlowUnblockResponse -from .trigger_create_params import TriggerCreateParams as TriggerCreateParams -from .trigger_fire_response import TriggerFireResponse as TriggerFireResponse -from .trigger_list_response import TriggerListResponse as TriggerListResponse -from .trigger_update_params import TriggerUpdateParams as TriggerUpdateParams -from .action_create_response import ActionCreateResponse as ActionCreateResponse -from .action_delete_response import ActionDeleteResponse as ActionDeleteResponse -from .action_update_response import ActionUpdateResponse as ActionUpdateResponse -from .event_dry_run_response import EventDryRunResponse as EventDryRunResponse -from .flow_retrieve_response import FlowRetrieveResponse as FlowRetrieveResponse -from .timezone_list_response import TimezoneListResponse as TimezoneListResponse -from .execution_list_response import ExecutionListResponse as ExecutionListResponse -from .trigger_create_response import TriggerCreateResponse as TriggerCreateResponse -from .trigger_delete_response import TriggerDeleteResponse as TriggerDeleteResponse -from .trigger_update_response import TriggerUpdateResponse as TriggerUpdateResponse -from .action_retrieve_response import ActionRetrieveResponse as ActionRetrieveResponse -from .trigger_retrieve_response import TriggerRetrieveResponse as TriggerRetrieveResponse -from .action_catalog_list_params import ActionCatalogListParams as ActionCatalogListParams -from .execution_retrieve_response import ExecutionRetrieveResponse as ExecutionRetrieveResponse -from .flow_action_overrides_param import FlowActionOverridesParam as FlowActionOverridesParam -from .action_catalog_list_response import ActionCatalogListResponse as ActionCatalogListResponse -from .execution_get_metrics_params import ExecutionGetMetricsParams as ExecutionGetMetricsParams -from .flow_child_action_input_param import FlowChildActionInputParam as FlowChildActionInputParam -from .execution_get_metrics_response import ExecutionGetMetricsResponse as ExecutionGetMetricsResponse -from .action_catalog_retrieve_response import ActionCatalogRetrieveResponse as ActionCatalogRetrieveResponse diff --git a/src/mobilerun_sdk/types/workflows/action.py b/src/mobilerun_sdk/types/workflows/action.py deleted file mode 100644 index 1b85a3f..0000000 --- a/src/mobilerun_sdk/types/workflows/action.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["Action"] - - -class Action(BaseModel): - id: str - - catalog_entry_id: str = FieldInfo(alias="catalogEntryId") - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - description: Optional[str] = None - - method: str - - name: str - - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - user_id: str = FieldInfo(alias="userId") - - params: Optional[object] = None - - params_schema: Optional[object] = FieldInfo(alias="paramsSchema", default=None) diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_entry.py b/src/mobilerun_sdk/types/workflows/action_catalog_entry.py deleted file mode 100644 index 5e6278c..0000000 --- a/src/mobilerun_sdk/types/workflows/action_catalog_entry.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["ActionCatalogEntry"] - - -class ActionCatalogEntry(BaseModel): - id: str - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - description: Optional[str] = None - - method: str - - name: str - - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - params_schema: Optional[object] = FieldInfo(alias="paramsSchema", default=None) diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_list_params.py b/src/mobilerun_sdk/types/workflows/action_catalog_list_params.py deleted file mode 100644 index 4e756a9..0000000 --- a/src/mobilerun_sdk/types/workflows/action_catalog_list_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 Literal, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ActionCatalogListParams"] - - -class ActionCatalogListParams(TypedDict, total=False): - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_list_response.py b/src/mobilerun_sdk/types/workflows/action_catalog_list_response.py deleted file mode 100644 index 967cfd0..0000000 --- a/src/mobilerun_sdk/types/workflows/action_catalog_list_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from ..shared.pagination import Pagination -from .action_catalog_entry import ActionCatalogEntry - -__all__ = ["ActionCatalogListResponse"] - - -class ActionCatalogListResponse(BaseModel): - items: List[ActionCatalogEntry] - - pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py b/src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py deleted file mode 100644 index 81d1b5f..0000000 --- a/src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel -from .action_catalog_entry import ActionCatalogEntry - -__all__ = ["ActionCatalogRetrieveResponse"] - - -class ActionCatalogRetrieveResponse(BaseModel): - data: ActionCatalogEntry diff --git a/src/mobilerun_sdk/types/workflows/action_create_params.py b/src/mobilerun_sdk/types/workflows/action_create_params.py deleted file mode 100644 index b85ffed..0000000 --- a/src/mobilerun_sdk/types/workflows/action_create_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ActionCreateParams"] - - -class ActionCreateParams(TypedDict, total=False): - catalog_entry_id: Required[Annotated[str, PropertyInfo(alias="catalogEntryId")]] - - name: Required[str] - - description: str - - params: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/action_create_response.py b/src/mobilerun_sdk/types/workflows/action_create_response.py deleted file mode 100644 index acd7aa5..0000000 --- a/src/mobilerun_sdk/types/workflows/action_create_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .action import Action -from ..._models import BaseModel - -__all__ = ["ActionCreateResponse"] - - -class ActionCreateResponse(BaseModel): - data: Action diff --git a/src/mobilerun_sdk/types/workflows/action_delete_response.py b/src/mobilerun_sdk/types/workflows/action_delete_response.py deleted file mode 100644 index 157bb1f..0000000 --- a/src/mobilerun_sdk/types/workflows/action_delete_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["ActionDeleteResponse"] - - -class ActionDeleteResponse(BaseModel): - message: str diff --git a/src/mobilerun_sdk/types/workflows/action_list_params.py b/src/mobilerun_sdk/types/workflows/action_list_params.py deleted file mode 100644 index 9873843..0000000 --- a/src/mobilerun_sdk/types/workflows/action_list_params.py +++ /dev/null @@ -1,23 +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__ = ["ActionListParams"] - - -class ActionListParams(TypedDict, total=False): - order_by: Annotated[Literal["name", "createdAt", "updatedAt"], PropertyInfo(alias="orderBy")] - - order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] - - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - - search: str - - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] diff --git a/src/mobilerun_sdk/types/workflows/action_list_response.py b/src/mobilerun_sdk/types/workflows/action_list_response.py deleted file mode 100644 index 2d5e996..0000000 --- a/src/mobilerun_sdk/types/workflows/action_list_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .action import Action -from ..._models import BaseModel -from ..shared.pagination import Pagination - -__all__ = ["ActionListResponse"] - - -class ActionListResponse(BaseModel): - items: List[Action] - - pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/action_retrieve_response.py b/src/mobilerun_sdk/types/workflows/action_retrieve_response.py deleted file mode 100644 index 7dc33b0..0000000 --- a/src/mobilerun_sdk/types/workflows/action_retrieve_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .action import Action -from ..._models import BaseModel - -__all__ = ["ActionRetrieveResponse"] - - -class ActionRetrieveResponse(BaseModel): - data: Action diff --git a/src/mobilerun_sdk/types/workflows/action_update_params.py b/src/mobilerun_sdk/types/workflows/action_update_params.py deleted file mode 100644 index 4644bac..0000000 --- a/src/mobilerun_sdk/types/workflows/action_update_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import TypedDict - -__all__ = ["ActionUpdateParams"] - - -class ActionUpdateParams(TypedDict, total=False): - description: str - - name: str - - params: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/action_update_response.py b/src/mobilerun_sdk/types/workflows/action_update_response.py deleted file mode 100644 index 4d6b872..0000000 --- a/src/mobilerun_sdk/types/workflows/action_update_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .action import Action -from ..._models import BaseModel - -__all__ = ["ActionUpdateResponse"] - - -class ActionUpdateResponse(BaseModel): - data: Action diff --git a/src/mobilerun_sdk/types/workflows/actions/__init__.py b/src/mobilerun_sdk/types/workflows/actions/__init__.py index 57284e5..f8ee8b1 100644 --- a/src/mobilerun_sdk/types/workflows/actions/__init__.py +++ b/src/mobilerun_sdk/types/workflows/actions/__init__.py @@ -1,6 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .service_list_response import ServiceListResponse as ServiceListResponse -from .service_list_methods_response import ServiceListMethodsResponse as ServiceListMethodsResponse diff --git a/src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py b/src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py deleted file mode 100644 index 95cff7a..0000000 --- a/src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ServiceListMethodsResponse", "Data", "DataParam"] - - -class DataParam(BaseModel): - description: str - - name: str - - required: bool - - type: Literal["string", "number", "boolean", "object", "array"] - - default: Optional[object] = None - - example: Optional[object] = None - - -class Data(BaseModel): - method: str - - params: List[DataParam] - - -class ServiceListMethodsResponse(BaseModel): - data: List[Data] diff --git a/src/mobilerun_sdk/types/workflows/actions/service_list_response.py b/src/mobilerun_sdk/types/workflows/actions/service_list_response.py deleted file mode 100644 index e8e712c..0000000 --- a/src/mobilerun_sdk/types/workflows/actions/service_list_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel - -__all__ = ["ServiceListResponse"] - - -class ServiceListResponse(BaseModel): - data: List[str] diff --git a/src/mobilerun_sdk/types/workflows/event_dry_run_params.py b/src/mobilerun_sdk/types/workflows/event_dry_run_params.py deleted file mode 100644 index c55498e..0000000 --- a/src/mobilerun_sdk/types/workflows/event_dry_run_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["EventDryRunParams"] - - -class EventDryRunParams(TypedDict, total=False): - event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] - - device_id: Annotated[str, PropertyInfo(alias="deviceId")] - - payload: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/event_dry_run_response.py b/src/mobilerun_sdk/types/workflows/event_dry_run_response.py deleted file mode 100644 index b1c8264..0000000 --- a/src/mobilerun_sdk/types/workflows/event_dry_run_response.py +++ /dev/null @@ -1,126 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..flow import Flow -from ..._models import BaseModel - -__all__ = [ - "EventDryRunResponse", - "Data", - "DataMatchedFlow", - "DataMatchedFlowAction", - "DataMatchedFlowGates", - "DataMatchedFlowTrigger", - "DataMatchedFlowTriggerScheduleRule", - "DataValidation", - "DataValidationError", -] - - -class DataMatchedFlowAction(BaseModel): - continue_on_error: bool = FieldInfo(alias="continueOnError") - - method: str - - name: str - - service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] - - children: Optional[List[Optional[object]]] = None - """ - Nested child actions (loop/branch bodies), each the same shape as a - ResolvedAction. - """ - - params: Optional[Dict[str, Optional[object]]] = None - - -class DataMatchedFlowGates(BaseModel): - blocked: bool - - cooldown_active: Optional[bool] = FieldInfo(alias="cooldownActive", default=None) - - device_attached: bool = FieldInfo(alias="deviceAttached") - - device_ids: List[str] = FieldInfo(alias="deviceIds") - - enabled: bool - - -class DataMatchedFlowTriggerScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" - - -class DataMatchedFlowTrigger(BaseModel): - id: str - - activation: Literal["event", "schedule", "custom"] - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) - - description: Optional[str] = None - - event_type: Optional[str] = FieldInfo(alias="eventType", default=None) - - name: str - - schedule_rule: Optional[DataMatchedFlowTriggerScheduleRule] = FieldInfo(alias="scheduleRule", default=None) - - timezone: Optional[str] = None - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - user_id: str = FieldInfo(alias="userId") - - conditions: Optional[object] = None - - next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) - - -class DataMatchedFlow(BaseModel): - actions: List[DataMatchedFlowAction] - - flow: Flow - - gates: DataMatchedFlowGates - - trigger: DataMatchedFlowTrigger - - would_fire: bool = FieldInfo(alias="wouldFire") - - -class DataValidationError(BaseModel): - field: str - - message: str - - -class DataValidation(BaseModel): - valid: bool - - errors: Optional[List[DataValidationError]] = None - - -class Data(BaseModel): - matched_flows: List[DataMatchedFlow] = FieldInfo(alias="matchedFlows") - - validation: DataValidation - - -class EventDryRunResponse(BaseModel): - data: Data diff --git a/src/mobilerun_sdk/types/workflows/event_ingest_params.py b/src/mobilerun_sdk/types/workflows/event_ingest_params.py deleted file mode 100644 index d8edf19..0000000 --- a/src/mobilerun_sdk/types/workflows/event_ingest_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["EventIngestParams"] - - -class EventIngestParams(TypedDict, total=False): - event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] - - device_id: Annotated[str, PropertyInfo(alias="deviceId")] - - payload: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/event_ingest_response.py b/src/mobilerun_sdk/types/workflows/event_ingest_response.py deleted file mode 100644 index 6136565..0000000 --- a/src/mobilerun_sdk/types/workflows/event_ingest_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["EventIngestResponse"] - - -class EventIngestResponse(BaseModel): - event_id: str = FieldInfo(alias="eventId") diff --git a/src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py b/src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py deleted file mode 100644 index b5d8cda..0000000 --- a/src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py +++ /dev/null @@ -1,20 +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 Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ExecutionGetMetricsParams"] - - -class ExecutionGetMetricsParams(TypedDict, total=False): - flow_id: Annotated[str, PropertyInfo(alias="flowId")] - - from_: Annotated[Optional[str], PropertyInfo(alias="from")] - - to: Optional[str] - - trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py b/src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py deleted file mode 100644 index cb796ac..0000000 --- a/src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py +++ /dev/null @@ -1,39 +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__ = ["ExecutionGetMetricsResponse", "Data", "DataByStatus"] - - -class DataByStatus(BaseModel): - cancelled: int - - failed: int - - invalid: int - - pending: int - - running: int - - skipped: int - - success: int - - -class Data(BaseModel): - avg_duration_ms: Optional[float] = FieldInfo(alias="avgDurationMs", default=None) - - by_status: DataByStatus = FieldInfo(alias="byStatus") - - last_execution_at: Optional[str] = FieldInfo(alias="lastExecutionAt", default=None) - - total: int - - -class ExecutionGetMetricsResponse(BaseModel): - data: Data diff --git a/src/mobilerun_sdk/types/workflows/execution_list_params.py b/src/mobilerun_sdk/types/workflows/execution_list_params.py deleted file mode 100644 index ccc40d4..0000000 --- a/src/mobilerun_sdk/types/workflows/execution_list_params.py +++ /dev/null @@ -1,32 +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, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ExecutionListParams"] - - -class ExecutionListParams(TypedDict, total=False): - flow_id: Annotated[str, PropertyInfo(alias="flowId")] - - from_: Annotated[Optional[str], PropertyInfo(alias="from")] - - order_by: Annotated[Literal["startedAt", "finishedAt", "status"], PropertyInfo(alias="orderBy")] - - order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] - - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - - search: str - - status: Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"] - - to: Optional[str] - - trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/execution_list_response.py b/src/mobilerun_sdk/types/workflows/execution_list_response.py deleted file mode 100644 index eddf7b3..0000000 --- a/src/mobilerun_sdk/types/workflows/execution_list_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .flow_execution import FlowExecution -from ..shared.pagination import Pagination - -__all__ = ["ExecutionListResponse"] - - -class ExecutionListResponse(BaseModel): - items: List[FlowExecution] - - pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/execution_retrieve_response.py b/src/mobilerun_sdk/types/workflows/execution_retrieve_response.py deleted file mode 100644 index 6892a2e..0000000 --- a/src/mobilerun_sdk/types/workflows/execution_retrieve_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel -from .flow_execution import FlowExecution - -__all__ = ["ExecutionRetrieveResponse"] - - -class ExecutionRetrieveResponse(BaseModel): - data: FlowExecution diff --git a/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py b/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py deleted file mode 100644 index 5f03d3a..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import TypedDict - -__all__ = ["FlowActionOverridesParam"] - - -class FlowActionOverridesParam(TypedDict, total=False): - params: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py b/src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py deleted file mode 100644 index a201a30..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py +++ /dev/null @@ -1,23 +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 Required, Annotated, TypedDict - -from ..._utils import PropertyInfo -from .flow_action_overrides_param import FlowActionOverridesParam - -__all__ = ["FlowChildActionInputParam"] - - -class FlowChildActionInputParam(TypedDict, total=False): - action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] - - position: Required[int] - - continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] - - name_override: Annotated[str, PropertyInfo(alias="nameOverride")] - - overrides: Optional[FlowActionOverridesParam] diff --git a/src/mobilerun_sdk/types/workflows/flow_clone_params.py b/src/mobilerun_sdk/types/workflows/flow_clone_params.py deleted file mode 100644 index c38a149..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_clone_params.py +++ /dev/null @@ -1,16 +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 ..._types import SequenceNotStr -from ..._utils import PropertyInfo - -__all__ = ["FlowCloneParams"] - - -class FlowCloneParams(TypedDict, total=False): - device_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="deviceIds")] - - name: str diff --git a/src/mobilerun_sdk/types/workflows/flow_clone_response.py b/src/mobilerun_sdk/types/workflows/flow_clone_response.py deleted file mode 100644 index 57a8637..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_clone_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..flow import Flow -from ..._models import BaseModel - -__all__ = ["FlowCloneResponse"] - - -class FlowCloneResponse(BaseModel): - data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_create_params.py b/src/mobilerun_sdk/types/workflows/flow_create_params.py deleted file mode 100644 index 464086f..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_create_params.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._types import SequenceNotStr -from ..._utils import PropertyInfo -from .flow_action_overrides_param import FlowActionOverridesParam -from .flow_child_action_input_param import FlowChildActionInputParam - -__all__ = ["FlowCreateParams", "Action"] - - -class FlowCreateParams(TypedDict, total=False): - actions: Required[Iterable[Action]] - - name: Required[str] - - trigger_id: Required[Annotated[str, PropertyInfo(alias="triggerId")]] - - cooldown_scope: Annotated[Literal["flow", "device"], PropertyInfo(alias="cooldownScope")] - - cooldown_seconds: Annotated[Optional[int], PropertyInfo(alias="cooldownSeconds")] - - description: str - - device_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="deviceIds")] - - enabled: bool - - notify_on_failure: Annotated[bool, PropertyInfo(alias="notifyOnFailure")] - - notify_on_success: Annotated[bool, PropertyInfo(alias="notifyOnSuccess")] - - notify_webhook_id: Annotated[Optional[str], PropertyInfo(alias="notifyWebhookId")] - - -class Action(TypedDict, total=False): - action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] - - position: Required[int] - - children: Iterable[FlowChildActionInputParam] - - continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] - - name_override: Annotated[str, PropertyInfo(alias="nameOverride")] - - overrides: Optional[FlowActionOverridesParam] diff --git a/src/mobilerun_sdk/types/workflows/flow_create_response.py b/src/mobilerun_sdk/types/workflows/flow_create_response.py deleted file mode 100644 index f9c5fea..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_create_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..flow import Flow -from ..._models import BaseModel - -__all__ = ["FlowCreateResponse"] - - -class FlowCreateResponse(BaseModel): - data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_delete_response.py b/src/mobilerun_sdk/types/workflows/flow_delete_response.py deleted file mode 100644 index a6243e6..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_delete_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["FlowDeleteResponse"] - - -class FlowDeleteResponse(BaseModel): - message: str diff --git a/src/mobilerun_sdk/types/workflows/flow_execution.py b/src/mobilerun_sdk/types/workflows/flow_execution.py deleted file mode 100644 index 96782d6..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_execution.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["FlowExecution"] - - -class FlowExecution(BaseModel): - id: str - - error: Optional[str] = None - - event_id: Optional[str] = FieldInfo(alias="eventId", default=None) - - finished_at: Optional[str] = FieldInfo(alias="finishedAt", default=None) - - flow_id: str = FieldInfo(alias="flowId") - - flow_name: Optional[str] = FieldInfo(alias="flowName", default=None) - - kind: Literal["live", "dry_run"] - - started_at: Optional[str] = FieldInfo(alias="startedAt", default=None) - - status: Optional[Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"]] = None - - trigger_id: str = FieldInfo(alias="triggerId") - - trigger_name: Optional[str] = FieldInfo(alias="triggerName", default=None) - - result: Optional[object] = None diff --git a/src/mobilerun_sdk/types/workflows/flow_list_params.py b/src/mobilerun_sdk/types/workflows/flow_list_params.py deleted file mode 100644 index 8f00af0..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_list_params.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["FlowListParams"] - - -class FlowListParams(TypedDict, total=False): - enabled: Optional[bool] - - order_by: Annotated[Literal["name", "createdAt", "updatedAt"], PropertyInfo(alias="orderBy")] - - order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] - - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - - search: str - - status: List[Literal["healthy", "failing", "blocked"]] - - trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/flow_list_response.py b/src/mobilerun_sdk/types/workflows/flow_list_response.py deleted file mode 100644 index ff0feb8..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_list_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..flow import Flow -from ..._models import BaseModel -from ..shared.pagination import Pagination - -__all__ = ["FlowListResponse"] - - -class FlowListResponse(BaseModel): - items: List[Flow] - - pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/flow_retrieve_response.py b/src/mobilerun_sdk/types/workflows/flow_retrieve_response.py deleted file mode 100644 index 0a002a6..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_retrieve_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..flow import Flow -from ..._models import BaseModel - -__all__ = ["FlowRetrieveResponse"] - - -class FlowRetrieveResponse(BaseModel): - data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_unblock_response.py b/src/mobilerun_sdk/types/workflows/flow_unblock_response.py deleted file mode 100644 index 3771e29..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_unblock_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..flow import Flow -from ..._models import BaseModel - -__all__ = ["FlowUnblockResponse"] - - -class FlowUnblockResponse(BaseModel): - data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_update_params.py b/src/mobilerun_sdk/types/workflows/flow_update_params.py deleted file mode 100644 index af63c04..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_update_params.py +++ /dev/null @@ -1,33 +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, Annotated, TypedDict - -from ..._types import SequenceNotStr -from ..._utils import PropertyInfo - -__all__ = ["FlowUpdateParams"] - - -class FlowUpdateParams(TypedDict, total=False): - cooldown_scope: Annotated[Literal["flow", "device"], PropertyInfo(alias="cooldownScope")] - - cooldown_seconds: Annotated[Optional[int], PropertyInfo(alias="cooldownSeconds")] - - description: str - - device_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="deviceIds")] - - enabled: bool - - name: str - - notify_on_failure: Annotated[bool, PropertyInfo(alias="notifyOnFailure")] - - notify_on_success: Annotated[bool, PropertyInfo(alias="notifyOnSuccess")] - - notify_webhook_id: Annotated[Optional[str], PropertyInfo(alias="notifyWebhookId")] - - trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/flow_update_response.py b/src/mobilerun_sdk/types/workflows/flow_update_response.py deleted file mode 100644 index 8725080..0000000 --- a/src/mobilerun_sdk/types/workflows/flow_update_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..flow import Flow -from ..._models import BaseModel - -__all__ = ["FlowUpdateResponse"] - - -class FlowUpdateResponse(BaseModel): - data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flows/__init__.py b/src/mobilerun_sdk/types/workflows/flows/__init__.py index fa77a33..f8ee8b1 100644 --- a/src/mobilerun_sdk/types/workflows/flows/__init__.py +++ b/src/mobilerun_sdk/types/workflows/flows/__init__.py @@ -1,11 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .flow_action import FlowAction as FlowAction -from .action_add_params import ActionAddParams as ActionAddParams -from .action_add_response import ActionAddResponse as ActionAddResponse -from .action_list_response import ActionListResponse as ActionListResponse -from .action_replace_params import ActionReplaceParams as ActionReplaceParams -from .action_remove_response import ActionRemoveResponse as ActionRemoveResponse -from .action_replace_response import ActionReplaceResponse as ActionReplaceResponse diff --git a/src/mobilerun_sdk/types/workflows/flows/action_add_params.py b/src/mobilerun_sdk/types/workflows/flows/action_add_params.py deleted file mode 100644 index 749fab6..0000000 --- a/src/mobilerun_sdk/types/workflows/flows/action_add_params.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo -from ..flow_action_overrides_param import FlowActionOverridesParam -from ..flow_child_action_input_param import FlowChildActionInputParam - -__all__ = ["ActionAddParams"] - - -class ActionAddParams(TypedDict, total=False): - action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] - - position: Required[int] - - children: Iterable[FlowChildActionInputParam] - - continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] - - name_override: Annotated[str, PropertyInfo(alias="nameOverride")] - - overrides: Optional[FlowActionOverridesParam] - - parent_flow_action_id: Annotated[Optional[str], PropertyInfo(alias="parentFlowActionId")] diff --git a/src/mobilerun_sdk/types/workflows/flows/action_add_response.py b/src/mobilerun_sdk/types/workflows/flows/action_add_response.py deleted file mode 100644 index 03d4e31..0000000 --- a/src/mobilerun_sdk/types/workflows/flows/action_add_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel -from .flow_action import FlowAction - -__all__ = ["ActionAddResponse"] - - -class ActionAddResponse(BaseModel): - data: FlowAction diff --git a/src/mobilerun_sdk/types/workflows/flows/action_list_response.py b/src/mobilerun_sdk/types/workflows/flows/action_list_response.py deleted file mode 100644 index 7f6bd53..0000000 --- a/src/mobilerun_sdk/types/workflows/flows/action_list_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel -from .flow_action import FlowAction - -__all__ = ["ActionListResponse"] - - -class ActionListResponse(BaseModel): - data: List[FlowAction] diff --git a/src/mobilerun_sdk/types/workflows/flows/action_remove_response.py b/src/mobilerun_sdk/types/workflows/flows/action_remove_response.py deleted file mode 100644 index a200db1..0000000 --- a/src/mobilerun_sdk/types/workflows/flows/action_remove_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel - -__all__ = ["ActionRemoveResponse"] - - -class ActionRemoveResponse(BaseModel): - message: str diff --git a/src/mobilerun_sdk/types/workflows/flows/action_replace_params.py b/src/mobilerun_sdk/types/workflows/flows/action_replace_params.py deleted file mode 100644 index 359f228..0000000 --- a/src/mobilerun_sdk/types/workflows/flows/action_replace_params.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo -from ..flow_action_overrides_param import FlowActionOverridesParam -from ..flow_child_action_input_param import FlowChildActionInputParam - -__all__ = ["ActionReplaceParams", "Action"] - - -class ActionReplaceParams(TypedDict, total=False): - actions: Required[Iterable[Action]] - - -class Action(TypedDict, total=False): - action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] - - position: Required[int] - - children: Iterable[FlowChildActionInputParam] - - continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] - - name_override: Annotated[str, PropertyInfo(alias="nameOverride")] - - overrides: Optional[FlowActionOverridesParam] diff --git a/src/mobilerun_sdk/types/workflows/flows/action_replace_response.py b/src/mobilerun_sdk/types/workflows/flows/action_replace_response.py deleted file mode 100644 index 2914bfa..0000000 --- a/src/mobilerun_sdk/types/workflows/flows/action_replace_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel -from .flow_action import FlowAction - -__all__ = ["ActionReplaceResponse"] - - -class ActionReplaceResponse(BaseModel): - data: List[FlowAction] diff --git a/src/mobilerun_sdk/types/workflows/flows/flow_action.py b/src/mobilerun_sdk/types/workflows/flows/flow_action.py deleted file mode 100644 index 2ab9154..0000000 --- a/src/mobilerun_sdk/types/workflows/flows/flow_action.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["FlowAction", "Overrides"] - - -class Overrides(BaseModel): - params: Optional[Dict[str, Optional[object]]] = None - - -class FlowAction(BaseModel): - id: str - - action_id: str = FieldInfo(alias="actionId") - - continue_on_error: bool = FieldInfo(alias="continueOnError") - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - flow_id: str = FieldInfo(alias="flowId") - - name_override: Optional[str] = FieldInfo(alias="nameOverride", default=None) - - overrides: Optional[Overrides] = None - - parent_flow_action_id: Optional[str] = FieldInfo(alias="parentFlowActionId", default=None) - - position: int diff --git a/src/mobilerun_sdk/types/workflows/timezone_list_response.py b/src/mobilerun_sdk/types/workflows/timezone_list_response.py deleted file mode 100644 index 6e49c63..0000000 --- a/src/mobilerun_sdk/types/workflows/timezone_list_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["TimezoneListResponse"] - - -class TimezoneListResponse(BaseModel): - data: List[str] diff --git a/src/mobilerun_sdk/types/workflows/trigger_create_params.py b/src/mobilerun_sdk/types/workflows/trigger_create_params.py deleted file mode 100644 index 7d8c4b8..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_create_params.py +++ /dev/null @@ -1,48 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["TriggerCreateParams", "Conditions", "ScheduleRule"] - - -class TriggerCreateParams(TypedDict, total=False): - activation: Required[Literal["event", "schedule", "custom"]] - - name: Required[str] - - conditions: Conditions - - custom_payload_schema: Annotated[Dict[str, object], PropertyInfo(alias="customPayloadSchema")] - """Optional JSON Schema for validating payloads sent to this custom trigger""" - - description: str - - event_type: Annotated[str, PropertyInfo(alias="eventType")] - - schedule_rule: Annotated[ScheduleRule, PropertyInfo(alias="scheduleRule")] - - timezone: str - - -class Conditions(TypedDict, total=False): - all: Iterable[object] - - any: Iterable[object] - - -class ScheduleRule(TypedDict, total=False): - type: Required[Literal["once", "cron", "recurring"]] - - date_time: Annotated[str, PropertyInfo(alias="dateTime")] - """ISO 8601 datetime (for type=once)""" - - expression: str - """Cron expression (for type=cron)""" - - rrule: str - """RRULE string (for type=recurring)""" diff --git a/src/mobilerun_sdk/types/workflows/trigger_create_response.py b/src/mobilerun_sdk/types/workflows/trigger_create_response.py deleted file mode 100644 index b2073b1..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_create_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["TriggerCreateResponse", "Data", "DataScheduleRule"] - - -class DataScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" - - -class Data(BaseModel): - id: str - - activation: Literal["event", "schedule", "custom"] - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - custom_payload_schema: Optional[Dict[str, Optional[object]]] = FieldInfo(alias="customPayloadSchema", default=None) - - description: Optional[str] = None - - event_type: Optional[str] = FieldInfo(alias="eventType", default=None) - - name: str - - schedule_rule: DataScheduleRule = FieldInfo(alias="scheduleRule") - - timezone: Optional[str] = None - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - user_id: str = FieldInfo(alias="userId") - - conditions: Optional[object] = None - - next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) - - -class TriggerCreateResponse(BaseModel): - data: Data diff --git a/src/mobilerun_sdk/types/workflows/trigger_delete_response.py b/src/mobilerun_sdk/types/workflows/trigger_delete_response.py deleted file mode 100644 index 5a4cf92..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_delete_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["TriggerDeleteResponse"] - - -class TriggerDeleteResponse(BaseModel): - message: str diff --git a/src/mobilerun_sdk/types/workflows/trigger_fire_params.py b/src/mobilerun_sdk/types/workflows/trigger_fire_params.py deleted file mode 100644 index 03847b7..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_fire_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 import Dict -from typing_extensions import Required, TypedDict - -__all__ = ["TriggerFireParams"] - - -class TriggerFireParams(TypedDict, total=False): - payload: Required[Dict[str, object]] - """Arbitrary JSON object forwarded to every flow attached to this trigger. - - Validated against the trigger's customPayloadSchema when one is configured; - otherwise only "must be a JSON object" is enforced. - """ diff --git a/src/mobilerun_sdk/types/workflows/trigger_fire_response.py b/src/mobilerun_sdk/types/workflows/trigger_fire_response.py deleted file mode 100644 index b0b4951..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_fire_response.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["TriggerFireResponse"] - - -class TriggerFireResponse(BaseModel): - enqueued_count: int = FieldInfo(alias="enqueuedCount") - """Number of flow executions enqueued. - - May be 0 if no flows are attached to this trigger, or if all attached flows are - currently in cooldown. - """ - - invocation_id: str = FieldInfo(alias="invocationId") - """Unique ID for this fire invocation. - - Job IDs in the execution queue are derived from it (one per enqueued flow). - """ diff --git a/src/mobilerun_sdk/types/workflows/trigger_list_params.py b/src/mobilerun_sdk/types/workflows/trigger_list_params.py deleted file mode 100644 index dad1a5f..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_list_params.py +++ /dev/null @@ -1,25 +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__ = ["TriggerListParams"] - - -class TriggerListParams(TypedDict, total=False): - activation: Literal["event", "schedule", "custom"] - - event_type: Annotated[str, PropertyInfo(alias="eventType")] - - order_by: Annotated[Literal["name", "createdAt", "updatedAt"], PropertyInfo(alias="orderBy")] - - order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] - - page: int - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - - search: str diff --git a/src/mobilerun_sdk/types/workflows/trigger_list_response.py b/src/mobilerun_sdk/types/workflows/trigger_list_response.py deleted file mode 100644 index 703fd4c..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_list_response.py +++ /dev/null @@ -1,58 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel -from ..shared.pagination import Pagination - -__all__ = ["TriggerListResponse", "Item", "ItemScheduleRule"] - - -class ItemScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" - - -class Item(BaseModel): - id: str - - activation: Literal["event", "schedule", "custom"] - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) - - description: Optional[str] = None - - event_type: Optional[str] = FieldInfo(alias="eventType", default=None) - - name: str - - schedule_rule: Optional[ItemScheduleRule] = FieldInfo(alias="scheduleRule", default=None) - - timezone: Optional[str] = None - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - user_id: str = FieldInfo(alias="userId") - - conditions: Optional[object] = None - - next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) - - -class TriggerListResponse(BaseModel): - items: List[Item] - - pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py b/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py deleted file mode 100644 index fc48aa4..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["TriggerRetrieveResponse", "Data", "DataScheduleRule"] - - -class DataScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" - - -class Data(BaseModel): - id: str - - activation: Literal["event", "schedule", "custom"] - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) - - description: Optional[str] = None - - event_type: Optional[str] = FieldInfo(alias="eventType", default=None) - - name: str - - schedule_rule: Optional[DataScheduleRule] = FieldInfo(alias="scheduleRule", default=None) - - timezone: Optional[str] = None - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - user_id: str = FieldInfo(alias="userId") - - conditions: Optional[object] = None - - next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) - - -class TriggerRetrieveResponse(BaseModel): - data: Data diff --git a/src/mobilerun_sdk/types/workflows/trigger_update_params.py b/src/mobilerun_sdk/types/workflows/trigger_update_params.py deleted file mode 100644 index ecf86b7..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_update_params.py +++ /dev/null @@ -1,48 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["TriggerUpdateParams", "Conditions", "ScheduleRule"] - - -class TriggerUpdateParams(TypedDict, total=False): - activation: Literal["event", "schedule", "custom"] - - conditions: Conditions - - custom_payload_schema: Annotated[Optional[Dict[str, object]], PropertyInfo(alias="customPayloadSchema")] - """Optional JSON Schema for validating payloads sent to this custom trigger""" - - description: str - - event_type: Annotated[str, PropertyInfo(alias="eventType")] - - name: str - - schedule_rule: Annotated[ScheduleRule, PropertyInfo(alias="scheduleRule")] - - timezone: Optional[str] - - -class Conditions(TypedDict, total=False): - all: Iterable[object] - - any: Iterable[object] - - -class ScheduleRule(TypedDict, total=False): - type: Required[Literal["once", "cron", "recurring"]] - - date_time: Annotated[str, PropertyInfo(alias="dateTime")] - """ISO 8601 datetime (for type=once)""" - - expression: str - """Cron expression (for type=cron)""" - - rrule: str - """RRULE string (for type=recurring)""" diff --git a/src/mobilerun_sdk/types/workflows/trigger_update_response.py b/src/mobilerun_sdk/types/workflows/trigger_update_response.py deleted file mode 100644 index a5a9418..0000000 --- a/src/mobilerun_sdk/types/workflows/trigger_update_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["TriggerUpdateResponse", "Data", "DataScheduleRule"] - - -class DataScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" - - -class Data(BaseModel): - id: str - - activation: Literal["event", "schedule", "custom"] - - created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - - custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) - - description: Optional[str] = None - - event_type: Optional[str] = FieldInfo(alias="eventType", default=None) - - name: str - - schedule_rule: Optional[DataScheduleRule] = FieldInfo(alias="scheduleRule", default=None) - - timezone: Optional[str] = None - - updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) - - user_id: str = FieldInfo(alias="userId") - - conditions: Optional[object] = None - - next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) - - -class TriggerUpdateResponse(BaseModel): - data: Data diff --git a/tests/api_resources/workflows/__init__.py b/tests/api_resources/workflows/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/workflows/__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/workflows/actions/__init__.py b/tests/api_resources/workflows/actions/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/workflows/actions/__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/workflows/actions/test_services.py b/tests/api_resources/workflows/actions/test_services.py deleted file mode 100644 index 442a3bd..0000000 --- a/tests/api_resources/workflows/actions/test_services.py +++ /dev/null @@ -1,164 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows.actions import ServiceListResponse, ServiceListMethodsResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestServices: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - service = client.workflows.actions.services.list() - assert_matches_type(ServiceListResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.actions.services.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service = response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.actions.services.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service = response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_methods(self, client: Mobilerun) -> None: - service = client.workflows.actions.services.list_methods( - "x", - ) - assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list_methods(self, client: Mobilerun) -> None: - response = client.workflows.actions.services.with_raw_response.list_methods( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service = response.parse() - assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list_methods(self, client: Mobilerun) -> None: - with client.workflows.actions.services.with_streaming_response.list_methods( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service = response.parse() - assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_list_methods(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service` but received ''"): - client.workflows.actions.services.with_raw_response.list_methods( - "", - ) - - -class TestAsyncServices: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - service = await async_client.workflows.actions.services.list() - assert_matches_type(ServiceListResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.actions.services.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service = await response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.actions.services.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service = await response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_methods(self, async_client: AsyncMobilerun) -> None: - service = await async_client.workflows.actions.services.list_methods( - "x", - ) - assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list_methods(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.actions.services.with_raw_response.list_methods( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service = await response.parse() - assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list_methods(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.actions.services.with_streaming_response.list_methods( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service = await response.parse() - assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_list_methods(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service` but received ''"): - await async_client.workflows.actions.services.with_raw_response.list_methods( - "", - ) diff --git a/tests/api_resources/workflows/flows/__init__.py b/tests/api_resources/workflows/flows/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/workflows/flows/__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/workflows/flows/test_actions.py b/tests/api_resources/workflows/flows/test_actions.py deleted file mode 100644 index 797f724..0000000 --- a/tests/api_resources/workflows/flows/test_actions.py +++ /dev/null @@ -1,495 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows.flows import ( - ActionAddResponse, - ActionListResponse, - ActionRemoveResponse, - ActionReplaceResponse, -) - -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="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - action = client.workflows.flows.actions.list( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.flows.actions.with_raw_response.list( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.flows.actions.with_streaming_response.list( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): - client.workflows.flows.actions.with_raw_response.list( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_add(self, client: Mobilerun) -> None: - action = client.workflows.flows.actions.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) - assert_matches_type(ActionAddResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_add_with_all_params(self, client: Mobilerun) -> None: - action = client.workflows.flows.actions.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - children=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - "continue_on_error": True, - "name_override": "x", - "overrides": {"params": {"foo": "bar"}}, - } - ], - continue_on_error=True, - name_override="x", - overrides={"params": {"foo": "bar"}}, - parent_flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionAddResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_add(self, client: Mobilerun) -> None: - response = client.workflows.flows.actions.with_raw_response.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionAddResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_add(self, client: Mobilerun) -> None: - with client.workflows.flows.actions.with_streaming_response.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionAddResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_add(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - client.workflows.flows.actions.with_raw_response.add( - flow_id="", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_remove(self, client: Mobilerun) -> None: - action = client.workflows.flows.actions.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionRemoveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_remove(self, client: Mobilerun) -> None: - response = client.workflows.flows.actions.with_raw_response.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionRemoveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_remove(self, client: Mobilerun) -> None: - with client.workflows.flows.actions.with_streaming_response.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionRemoveResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_remove(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - client.workflows.flows.actions.with_raw_response.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_action_id` but received ''"): - client.workflows.flows.actions.with_raw_response.remove( - flow_action_id="", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_replace(self, client: Mobilerun) -> None: - action = client.workflows.flows.actions.replace( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) - assert_matches_type(ActionReplaceResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_replace(self, client: Mobilerun) -> None: - response = client.workflows.flows.actions.with_raw_response.replace( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionReplaceResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_replace(self, client: Mobilerun) -> None: - with client.workflows.flows.actions.with_streaming_response.replace( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionReplaceResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_replace(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - client.workflows.flows.actions.with_raw_response.replace( - flow_id="", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) - - -class TestAsyncActions: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.flows.actions.list( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.actions.with_raw_response.list( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.actions.with_streaming_response.list( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): - await async_client.workflows.flows.actions.with_raw_response.list( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_add(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.flows.actions.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) - assert_matches_type(ActionAddResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_add_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.flows.actions.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - children=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - "continue_on_error": True, - "name_override": "x", - "overrides": {"params": {"foo": "bar"}}, - } - ], - continue_on_error=True, - name_override="x", - overrides={"params": {"foo": "bar"}}, - parent_flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionAddResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_add(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.actions.with_raw_response.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionAddResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_add(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.actions.with_streaming_response.add( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionAddResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_add(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - await async_client.workflows.flows.actions.with_raw_response.add( - flow_id="", - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - position=0, - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_remove(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.flows.actions.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionRemoveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_remove(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.actions.with_raw_response.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionRemoveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_remove(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.actions.with_streaming_response.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionRemoveResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_remove(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - await async_client.workflows.flows.actions.with_raw_response.remove( - flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - flow_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_action_id` but received ''"): - await async_client.workflows.flows.actions.with_raw_response.remove( - flow_action_id="", - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_replace(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.flows.actions.replace( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) - assert_matches_type(ActionReplaceResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_replace(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.actions.with_raw_response.replace( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionReplaceResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_replace(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.actions.with_streaming_response.replace( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionReplaceResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_replace(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - await async_client.workflows.flows.actions.with_raw_response.replace( - flow_id="", - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - ) diff --git a/tests/api_resources/workflows/test_action_catalog.py b/tests/api_resources/workflows/test_action_catalog.py deleted file mode 100644 index 9f228db..0000000 --- a/tests/api_resources/workflows/test_action_catalog.py +++ /dev/null @@ -1,187 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows import ( - ActionCatalogListResponse, - ActionCatalogRetrieveResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestActionCatalog: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - action_catalog = client.workflows.action_catalog.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.workflows.action_catalog.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action_catalog = response.parse() - assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.workflows.action_catalog.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action_catalog = response.parse() - assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `catalog_entry_id` but received ''"): - client.workflows.action_catalog.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - action_catalog = client.workflows.action_catalog.list() - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - action_catalog = client.workflows.action_catalog.list( - page=1, - page_size=1, - service="tasks_api", - ) - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.action_catalog.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action_catalog = response.parse() - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.action_catalog.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action_catalog = response.parse() - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncActionCatalog: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - action_catalog = await async_client.workflows.action_catalog.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.action_catalog.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action_catalog = await response.parse() - assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.action_catalog.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action_catalog = await response.parse() - assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `catalog_entry_id` but received ''"): - await async_client.workflows.action_catalog.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - action_catalog = await async_client.workflows.action_catalog.list() - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - action_catalog = await async_client.workflows.action_catalog.list( - page=1, - page_size=1, - service="tasks_api", - ) - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.action_catalog.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action_catalog = await response.parse() - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.action_catalog.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action_catalog = await response.parse() - assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_actions.py b/tests/api_resources/workflows/test_actions.py deleted file mode 100644 index 9533759..0000000 --- a/tests/api_resources/workflows/test_actions.py +++ /dev/null @@ -1,482 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows import ( - ActionListResponse, - ActionCreateResponse, - ActionDeleteResponse, - ActionUpdateResponse, - ActionRetrieveResponse, -) - -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="Mock server tests are disabled") - @parametrize - def test_method_create(self, client: Mobilerun) -> None: - action = client.workflows.actions.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - ) - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create_with_all_params(self, client: Mobilerun) -> None: - action = client.workflows.actions.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - description="description", - params={"foo": "bar"}, - ) - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_create(self, client: Mobilerun) -> None: - response = client.workflows.actions.with_raw_response.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_create(self, client: Mobilerun) -> None: - with client.workflows.actions.with_streaming_response.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - action = client.workflows.actions.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionRetrieveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.workflows.actions.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionRetrieveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.workflows.actions.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionRetrieveResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): - client.workflows.actions.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update(self, client: Mobilerun) -> None: - action = client.workflows.actions.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update_with_all_params(self, client: Mobilerun) -> None: - action = client.workflows.actions.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - description="description", - name="x", - params={"foo": "bar"}, - ) - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_update(self, client: Mobilerun) -> None: - response = client.workflows.actions.with_raw_response.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_update(self, client: Mobilerun) -> None: - with client.workflows.actions.with_streaming_response.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_update(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `action_id` but received ''"): - client.workflows.actions.with_raw_response.update( - action_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - action = client.workflows.actions.list() - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - action = client.workflows.actions.list( - order_by="name", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - service="tasks_api", - ) - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.actions.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.actions.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_delete(self, client: Mobilerun) -> None: - action = client.workflows.actions.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionDeleteResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_delete(self, client: Mobilerun) -> None: - response = client.workflows.actions.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionDeleteResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_delete(self, client: Mobilerun) -> None: - with client.workflows.actions.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionDeleteResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): - client.workflows.actions.with_raw_response.delete( - "", - ) - - -class TestAsyncActions: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - ) - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - description="description", - params={"foo": "bar"}, - ) - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.actions.with_raw_response.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.actions.with_streaming_response.create( - catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionCreateResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionRetrieveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.actions.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionRetrieveResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.actions.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionRetrieveResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): - await async_client.workflows.actions.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - description="description", - name="x", - params={"foo": "bar"}, - ) - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.actions.with_raw_response.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.actions.with_streaming_response.update( - action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionUpdateResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `action_id` but received ''"): - await async_client.workflows.actions.with_raw_response.update( - action_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.list() - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.list( - order_by="name", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - service="tasks_api", - ) - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.actions.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.actions.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionListResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_delete(self, async_client: AsyncMobilerun) -> None: - action = await async_client.workflows.actions.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ActionDeleteResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.actions.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionDeleteResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.actions.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionDeleteResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): - await async_client.workflows.actions.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/workflows/test_events.py b/tests/api_resources/workflows/test_events.py deleted file mode 100644 index 8ca70fa..0000000 --- a/tests/api_resources/workflows/test_events.py +++ /dev/null @@ -1,203 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows import ( - EventDryRunResponse, - EventIngestResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEvents: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_dry_run(self, client: Mobilerun) -> None: - event = client.workflows.events.dry_run( - event_type="x", - ) - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_dry_run_with_all_params(self, client: Mobilerun) -> None: - event = client.workflows.events.dry_run( - event_type="x", - device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_dry_run(self, client: Mobilerun) -> None: - response = client.workflows.events.with_raw_response.dry_run( - event_type="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_dry_run(self, client: Mobilerun) -> None: - with client.workflows.events.with_streaming_response.dry_run( - event_type="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_ingest(self, client: Mobilerun) -> None: - event = client.workflows.events.ingest( - event_type="x", - ) - assert_matches_type(EventIngestResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_ingest_with_all_params(self, client: Mobilerun) -> None: - event = client.workflows.events.ingest( - event_type="x", - device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - assert_matches_type(EventIngestResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_ingest(self, client: Mobilerun) -> None: - response = client.workflows.events.with_raw_response.ingest( - event_type="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(EventIngestResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_ingest(self, client: Mobilerun) -> None: - with client.workflows.events.with_streaming_response.ingest( - event_type="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(EventIngestResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncEvents: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_dry_run(self, async_client: AsyncMobilerun) -> None: - event = await async_client.workflows.events.dry_run( - event_type="x", - ) - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_dry_run_with_all_params(self, async_client: AsyncMobilerun) -> None: - event = await async_client.workflows.events.dry_run( - event_type="x", - device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_dry_run(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.events.with_raw_response.dry_run( - event_type="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_dry_run(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.events.with_streaming_response.dry_run( - event_type="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(EventDryRunResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_ingest(self, async_client: AsyncMobilerun) -> None: - event = await async_client.workflows.events.ingest( - event_type="x", - ) - assert_matches_type(EventIngestResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_ingest_with_all_params(self, async_client: AsyncMobilerun) -> None: - event = await async_client.workflows.events.ingest( - event_type="x", - device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - assert_matches_type(EventIngestResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_ingest(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.events.with_raw_response.ingest( - event_type="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(EventIngestResponse, event, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_ingest(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.events.with_streaming_response.ingest( - event_type="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(EventIngestResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_executions.py b/tests/api_resources/workflows/test_executions.py deleted file mode 100644 index 891bd9b..0000000 --- a/tests/api_resources/workflows/test_executions.py +++ /dev/null @@ -1,280 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows import ( - ExecutionListResponse, - ExecutionRetrieveResponse, - ExecutionGetMetricsResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestExecutions: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - execution = client.workflows.executions.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.workflows.executions.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = response.parse() - assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.workflows.executions.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = response.parse() - assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `execution_id` but received ''"): - client.workflows.executions.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - execution = client.workflows.executions.list() - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - execution = client.workflows.executions.list( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - from_="from", - order_by="startedAt", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - status="pending", - to="to", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.executions.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = response.parse() - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.executions.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = response.parse() - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_metrics(self, client: Mobilerun) -> None: - execution = client.workflows.executions.get_metrics() - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_metrics_with_all_params(self, client: Mobilerun) -> None: - execution = client.workflows.executions.get_metrics( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - from_="from", - to="to", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_get_metrics(self, client: Mobilerun) -> None: - response = client.workflows.executions.with_raw_response.get_metrics() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = response.parse() - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_get_metrics(self, client: Mobilerun) -> None: - with client.workflows.executions.with_streaming_response.get_metrics() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = response.parse() - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncExecutions: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - execution = await async_client.workflows.executions.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.executions.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = await response.parse() - assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.executions.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = await response.parse() - assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `execution_id` but received ''"): - await async_client.workflows.executions.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - execution = await async_client.workflows.executions.list() - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - execution = await async_client.workflows.executions.list( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - from_="from", - order_by="startedAt", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - status="pending", - to="to", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.executions.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = await response.parse() - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.executions.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = await response.parse() - assert_matches_type(ExecutionListResponse, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_metrics(self, async_client: AsyncMobilerun) -> None: - execution = await async_client.workflows.executions.get_metrics() - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_metrics_with_all_params(self, async_client: AsyncMobilerun) -> None: - execution = await async_client.workflows.executions.get_metrics( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - from_="from", - to="to", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_get_metrics(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.executions.with_raw_response.get_metrics() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = await response.parse() - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_get_metrics(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.executions.with_streaming_response.get_metrics() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = await response.parse() - assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_flows.py b/tests/api_resources/workflows/test_flows.py deleted file mode 100644 index 34eb5e5..0000000 --- a/tests/api_resources/workflows/test_flows.py +++ /dev/null @@ -1,774 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows import ( - FlowListResponse, - FlowCloneResponse, - FlowCreateResponse, - FlowDeleteResponse, - FlowUpdateResponse, - FlowUnblockResponse, - FlowRetrieveResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFlows: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create(self, client: Mobilerun) -> None: - flow = client.workflows.flows.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create_with_all_params(self, client: Mobilerun) -> None: - flow = client.workflows.flows.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - "children": [ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - "continue_on_error": True, - "name_override": "x", - "overrides": {"params": {"foo": "bar"}}, - } - ], - "continue_on_error": True, - "name_override": "x", - "overrides": {"params": {"foo": "bar"}}, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - cooldown_scope="flow", - cooldown_seconds=0, - description="description", - device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - enabled=True, - notify_on_failure=True, - notify_on_success=True, - notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_create(self, client: Mobilerun) -> None: - response = client.workflows.flows.with_raw_response.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = response.parse() - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_create(self, client: Mobilerun) -> None: - with client.workflows.flows.with_streaming_response.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = response.parse() - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - flow = client.workflows.flows.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.workflows.flows.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = response.parse() - assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.workflows.flows.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = response.parse() - assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): - client.workflows.flows.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update(self, client: Mobilerun) -> None: - flow = client.workflows.flows.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update_with_all_params(self, client: Mobilerun) -> None: - flow = client.workflows.flows.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - cooldown_scope="flow", - cooldown_seconds=0, - description="description", - device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - enabled=True, - name="x", - notify_on_failure=True, - notify_on_success=True, - notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_update(self, client: Mobilerun) -> None: - response = client.workflows.flows.with_raw_response.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = response.parse() - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_update(self, client: Mobilerun) -> None: - with client.workflows.flows.with_streaming_response.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = response.parse() - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_update(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - client.workflows.flows.with_raw_response.update( - flow_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - flow = client.workflows.flows.list() - assert_matches_type(FlowListResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - flow = client.workflows.flows.list( - enabled=True, - order_by="name", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - status=["healthy"], - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowListResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.flows.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = response.parse() - assert_matches_type(FlowListResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.flows.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = response.parse() - assert_matches_type(FlowListResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_delete(self, client: Mobilerun) -> None: - flow = client.workflows.flows.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowDeleteResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_delete(self, client: Mobilerun) -> None: - response = client.workflows.flows.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = response.parse() - assert_matches_type(FlowDeleteResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_delete(self, client: Mobilerun) -> None: - with client.workflows.flows.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = response.parse() - assert_matches_type(FlowDeleteResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): - client.workflows.flows.with_raw_response.delete( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_clone(self, client: Mobilerun) -> None: - flow = client.workflows.flows.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_clone_with_all_params(self, client: Mobilerun) -> None: - flow = client.workflows.flows.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - name="x", - ) - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_clone(self, client: Mobilerun) -> None: - response = client.workflows.flows.with_raw_response.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = response.parse() - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_clone(self, client: Mobilerun) -> None: - with client.workflows.flows.with_streaming_response.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = response.parse() - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_clone(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - client.workflows.flows.with_raw_response.clone( - flow_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_unblock(self, client: Mobilerun) -> None: - flow = client.workflows.flows.unblock( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowUnblockResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_unblock(self, client: Mobilerun) -> None: - response = client.workflows.flows.with_raw_response.unblock( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = response.parse() - assert_matches_type(FlowUnblockResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_unblock(self, client: Mobilerun) -> None: - with client.workflows.flows.with_streaming_response.unblock( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = response.parse() - assert_matches_type(FlowUnblockResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_unblock(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - client.workflows.flows.with_raw_response.unblock( - "", - ) - - -class TestAsyncFlows: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - "children": [ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - "continue_on_error": True, - "name_override": "x", - "overrides": {"params": {"foo": "bar"}}, - } - ], - "continue_on_error": True, - "name_override": "x", - "overrides": {"params": {"foo": "bar"}}, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - cooldown_scope="flow", - cooldown_seconds=0, - description="description", - device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - enabled=True, - notify_on_failure=True, - notify_on_success=True, - notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.with_raw_response.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = await response.parse() - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.with_streaming_response.create( - actions=[ - { - "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "position": 0, - } - ], - name="x", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = await response.parse() - assert_matches_type(FlowCreateResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = await response.parse() - assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = await response.parse() - assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): - await async_client.workflows.flows.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - cooldown_scope="flow", - cooldown_seconds=0, - description="description", - device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - enabled=True, - name="x", - notify_on_failure=True, - notify_on_success=True, - notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.with_raw_response.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = await response.parse() - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.with_streaming_response.update( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = await response.parse() - assert_matches_type(FlowUpdateResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - await async_client.workflows.flows.with_raw_response.update( - flow_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.list() - assert_matches_type(FlowListResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.list( - enabled=True, - order_by="name", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - status=["healthy"], - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowListResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = await response.parse() - assert_matches_type(FlowListResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = await response.parse() - assert_matches_type(FlowListResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_delete(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowDeleteResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = await response.parse() - assert_matches_type(FlowDeleteResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = await response.parse() - assert_matches_type(FlowDeleteResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): - await async_client.workflows.flows.with_raw_response.delete( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_clone(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_clone_with_all_params(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - name="x", - ) - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_clone(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.with_raw_response.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = await response.parse() - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_clone(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.with_streaming_response.clone( - flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = await response.parse() - assert_matches_type(FlowCloneResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_clone(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - await async_client.workflows.flows.with_raw_response.clone( - flow_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_unblock(self, async_client: AsyncMobilerun) -> None: - flow = await async_client.workflows.flows.unblock( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(FlowUnblockResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_unblock(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.flows.with_raw_response.unblock( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flow = await response.parse() - assert_matches_type(FlowUnblockResponse, flow, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_unblock(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.flows.with_streaming_response.unblock( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flow = await response.parse() - assert_matches_type(FlowUnblockResponse, flow, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_unblock(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - await async_client.workflows.flows.with_raw_response.unblock( - "", - ) diff --git a/tests/api_resources/workflows/test_timezones.py b/tests/api_resources/workflows/test_timezones.py deleted file mode 100644 index fab060b..0000000 --- a/tests/api_resources/workflows/test_timezones.py +++ /dev/null @@ -1,80 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows import TimezoneListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTimezones: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - timezone = client.workflows.timezones.list() - assert_matches_type(TimezoneListResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.timezones.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - timezone = response.parse() - assert_matches_type(TimezoneListResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.timezones.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - timezone = response.parse() - assert_matches_type(TimezoneListResponse, timezone, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncTimezones: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - timezone = await async_client.workflows.timezones.list() - assert_matches_type(TimezoneListResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.timezones.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - timezone = await response.parse() - assert_matches_type(TimezoneListResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.timezones.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - timezone = await response.parse() - assert_matches_type(TimezoneListResponse, timezone, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_triggers.py b/tests/api_resources/workflows/test_triggers.py deleted file mode 100644 index 5f9b669..0000000 --- a/tests/api_resources/workflows/test_triggers.py +++ /dev/null @@ -1,627 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.workflows import ( - TriggerFireResponse, - TriggerListResponse, - TriggerCreateResponse, - TriggerDeleteResponse, - TriggerUpdateResponse, - TriggerRetrieveResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTriggers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.create( - activation="event", - name="x", - ) - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create_with_all_params(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.create( - activation="event", - name="x", - conditions={ - "all": [{}], - "any": [{}], - }, - custom_payload_schema={"foo": "bar"}, - description="description", - event_type="eventType", - schedule_rule={ - "type": "once", - "date_time": "dateTime", - "expression": "expression", - "rrule": "rrule", - }, - timezone="timezone", - ) - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_create(self, client: Mobilerun) -> None: - response = client.workflows.triggers.with_raw_response.create( - activation="event", - name="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = response.parse() - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_create(self, client: Mobilerun) -> None: - with client.workflows.triggers.with_streaming_response.create( - activation="event", - name="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = response.parse() - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.workflows.triggers.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = response.parse() - assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.workflows.triggers.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = response.parse() - assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): - client.workflows.triggers.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update_with_all_params(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - activation="event", - conditions={ - "all": [{}], - "any": [{}], - }, - custom_payload_schema={"foo": "bar"}, - description="description", - event_type="eventType", - name="x", - schedule_rule={ - "type": "once", - "date_time": "dateTime", - "expression": "expression", - "rrule": "rrule", - }, - timezone="timezone", - ) - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_update(self, client: Mobilerun) -> None: - response = client.workflows.triggers.with_raw_response.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = response.parse() - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_update(self, client: Mobilerun) -> None: - with client.workflows.triggers.with_streaming_response.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = response.parse() - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_update(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): - client.workflows.triggers.with_raw_response.update( - trigger_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.list() - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.list( - activation="event", - event_type="eventType", - order_by="name", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - ) - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.workflows.triggers.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = response.parse() - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.workflows.triggers.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = response.parse() - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_delete(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_delete(self, client: Mobilerun) -> None: - response = client.workflows.triggers.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = response.parse() - assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_delete(self, client: Mobilerun) -> None: - with client.workflows.triggers.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = response.parse() - assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): - client.workflows.triggers.with_raw_response.delete( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_fire(self, client: Mobilerun) -> None: - trigger = client.workflows.triggers.fire( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - assert_matches_type(TriggerFireResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_fire(self, client: Mobilerun) -> None: - response = client.workflows.triggers.with_raw_response.fire( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = response.parse() - assert_matches_type(TriggerFireResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_fire(self, client: Mobilerun) -> None: - with client.workflows.triggers.with_streaming_response.fire( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = response.parse() - assert_matches_type(TriggerFireResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_fire(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): - client.workflows.triggers.with_raw_response.fire( - trigger_id="", - payload={"foo": "bar"}, - ) - - -class TestAsyncTriggers: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.create( - activation="event", - name="x", - ) - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.create( - activation="event", - name="x", - conditions={ - "all": [{}], - "any": [{}], - }, - custom_payload_schema={"foo": "bar"}, - description="description", - event_type="eventType", - schedule_rule={ - "type": "once", - "date_time": "dateTime", - "expression": "expression", - "rrule": "rrule", - }, - timezone="timezone", - ) - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.triggers.with_raw_response.create( - activation="event", - name="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = await response.parse() - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.triggers.with_streaming_response.create( - activation="event", - name="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = await response.parse() - assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.triggers.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = await response.parse() - assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.triggers.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = await response.parse() - assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): - await async_client.workflows.triggers.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - activation="event", - conditions={ - "all": [{}], - "any": [{}], - }, - custom_payload_schema={"foo": "bar"}, - description="description", - event_type="eventType", - name="x", - schedule_rule={ - "type": "once", - "date_time": "dateTime", - "expression": "expression", - "rrule": "rrule", - }, - timezone="timezone", - ) - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.triggers.with_raw_response.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = await response.parse() - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.triggers.with_streaming_response.update( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = await response.parse() - assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): - await async_client.workflows.triggers.with_raw_response.update( - trigger_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.list() - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.list( - activation="event", - event_type="eventType", - order_by="name", - order_by_direction="asc", - page=1, - page_size=1, - search="search", - ) - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.triggers.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = await response.parse() - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.triggers.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = await response.parse() - assert_matches_type(TriggerListResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_delete(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.triggers.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = await response.parse() - assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.triggers.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = await response.parse() - assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): - await async_client.workflows.triggers.with_raw_response.delete( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_fire(self, async_client: AsyncMobilerun) -> None: - trigger = await async_client.workflows.triggers.fire( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - assert_matches_type(TriggerFireResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_fire(self, async_client: AsyncMobilerun) -> None: - response = await async_client.workflows.triggers.with_raw_response.fire( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trigger = await response.parse() - assert_matches_type(TriggerFireResponse, trigger, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_fire(self, async_client: AsyncMobilerun) -> None: - async with async_client.workflows.triggers.with_streaming_response.fire( - trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - payload={"foo": "bar"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trigger = await response.parse() - assert_matches_type(TriggerFireResponse, trigger, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_fire(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): - await async_client.workflows.triggers.with_raw_response.fire( - trigger_id="", - payload={"foo": "bar"}, - ) From faaad668d436ba097cc51ff38716d0f46effafb6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 28 Jun 2026 00:14:45 +0000 Subject: [PATCH 04/10] feat(api): api update --- .stats.yml | 6 +- api.md | 178 ++++ src/mobilerun_sdk/_client.py | 51 +- src/mobilerun_sdk/resources/__init__.py | 14 + .../resources/workflows/__init__.py | 117 +++ .../resources/workflows/action_catalog.py | 268 ++++++ .../resources/workflows/actions/__init__.py | 33 + .../resources/workflows/actions/actions.py | 592 +++++++++++++ .../resources/workflows/actions/services.py | 215 +++++ .../resources/workflows/events.py | 284 ++++++ .../resources/workflows/executions.py | 402 +++++++++ .../resources/workflows/flows/__init__.py | 33 + .../resources/workflows/flows/actions.py | 454 ++++++++++ .../resources/workflows/flows/flows.py | 836 ++++++++++++++++++ .../resources/workflows/timezones.py | 135 +++ .../resources/workflows/triggers.py | 731 +++++++++++++++ .../resources/workflows/workflows.py | 294 ++++++ src/mobilerun_sdk/types/__init__.py | 1 + src/mobilerun_sdk/types/flow.py | 54 ++ src/mobilerun_sdk/types/workflows/__init__.py | 48 + src/mobilerun_sdk/types/workflows/action.py | 34 + .../types/workflows/action_catalog_entry.py | 28 + .../workflows/action_catalog_list_params.py | 17 + .../workflows/action_catalog_list_response.py | 15 + .../action_catalog_retrieve_response.py | 10 + .../types/workflows/action_create_params.py | 20 + .../types/workflows/action_create_response.py | 10 + .../types/workflows/action_delete_response.py | 9 + .../types/workflows/action_list_params.py | 23 + .../types/workflows/action_list_response.py | 15 + .../workflows/action_retrieve_response.py | 10 + .../types/workflows/action_update_params.py | 16 + .../types/workflows/action_update_response.py | 10 + .../types/workflows/actions/__init__.py | 3 + .../actions/service_list_methods_response.py | 32 + .../actions/service_list_response.py | 11 + .../types/workflows/event_dry_run_params.py | 18 + .../types/workflows/event_dry_run_response.py | 126 +++ .../types/workflows/event_ingest_params.py | 18 + .../types/workflows/event_ingest_response.py | 11 + .../workflows/execution_get_metrics_params.py | 20 + .../execution_get_metrics_response.py | 39 + .../types/workflows/execution_list_params.py | 32 + .../workflows/execution_list_response.py | 15 + .../workflows/execution_retrieve_response.py | 10 + .../workflows/flow_action_overrides_param.py | 12 + .../flow_child_action_input_param.py | 23 + .../types/workflows/flow_clone_params.py | 16 + .../types/workflows/flow_clone_response.py | 10 + .../types/workflows/flow_create_params.py | 51 ++ .../types/workflows/flow_create_response.py | 10 + .../types/workflows/flow_delete_response.py | 9 + .../types/workflows/flow_execution.py | 36 + .../types/workflows/flow_list_params.py | 28 + .../types/workflows/flow_list_response.py | 15 + .../types/workflows/flow_retrieve_response.py | 10 + .../types/workflows/flow_unblock_response.py | 10 + .../types/workflows/flow_update_params.py | 33 + .../types/workflows/flow_update_response.py | 10 + .../types/workflows/flows/__init__.py | 8 + .../workflows/flows/action_add_params.py | 28 + .../workflows/flows/action_add_response.py | 10 + .../workflows/flows/action_list_response.py | 12 + .../workflows/flows/action_remove_response.py | 9 + .../workflows/flows/action_replace_params.py | 30 + .../flows/action_replace_response.py | 12 + .../types/workflows/flows/flow_action.py | 33 + .../types/workflows/timezone_list_response.py | 11 + .../types/workflows/trigger_create_params.py | 48 + .../workflows/trigger_create_response.py | 55 ++ .../workflows/trigger_delete_response.py | 9 + .../types/workflows/trigger_fire_params.py | 17 + .../types/workflows/trigger_fire_response.py | 22 + .../types/workflows/trigger_list_params.py | 25 + .../types/workflows/trigger_list_response.py | 58 ++ .../workflows/trigger_retrieve_response.py | 55 ++ .../types/workflows/trigger_update_params.py | 48 + .../workflows/trigger_update_response.py | 55 ++ tests/api_resources/workflows/__init__.py | 1 + .../workflows/actions/__init__.py | 1 + .../workflows/actions/test_services.py | 164 ++++ .../api_resources/workflows/flows/__init__.py | 1 + .../workflows/flows/test_actions.py | 495 +++++++++++ .../workflows/test_action_catalog.py | 187 ++++ tests/api_resources/workflows/test_actions.py | 482 ++++++++++ tests/api_resources/workflows/test_events.py | 203 +++++ .../workflows/test_executions.py | 280 ++++++ tests/api_resources/workflows/test_flows.py | 774 ++++++++++++++++ .../api_resources/workflows/test_timezones.py | 80 ++ .../api_resources/workflows/test_triggers.py | 627 +++++++++++++ 90 files changed, 9407 insertions(+), 4 deletions(-) create mode 100644 src/mobilerun_sdk/resources/workflows/__init__.py create mode 100644 src/mobilerun_sdk/resources/workflows/action_catalog.py create mode 100644 src/mobilerun_sdk/resources/workflows/actions/__init__.py create mode 100644 src/mobilerun_sdk/resources/workflows/actions/actions.py create mode 100644 src/mobilerun_sdk/resources/workflows/actions/services.py create mode 100644 src/mobilerun_sdk/resources/workflows/events.py create mode 100644 src/mobilerun_sdk/resources/workflows/executions.py create mode 100644 src/mobilerun_sdk/resources/workflows/flows/__init__.py create mode 100644 src/mobilerun_sdk/resources/workflows/flows/actions.py create mode 100644 src/mobilerun_sdk/resources/workflows/flows/flows.py create mode 100644 src/mobilerun_sdk/resources/workflows/timezones.py create mode 100644 src/mobilerun_sdk/resources/workflows/triggers.py create mode 100644 src/mobilerun_sdk/resources/workflows/workflows.py create mode 100644 src/mobilerun_sdk/types/flow.py create mode 100644 src/mobilerun_sdk/types/workflows/action.py create mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_entry.py create mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_list_params.py create mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py create mode 100644 src/mobilerun_sdk/types/workflows/action_create_params.py create mode 100644 src/mobilerun_sdk/types/workflows/action_create_response.py create mode 100644 src/mobilerun_sdk/types/workflows/action_delete_response.py create mode 100644 src/mobilerun_sdk/types/workflows/action_list_params.py create mode 100644 src/mobilerun_sdk/types/workflows/action_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/action_retrieve_response.py create mode 100644 src/mobilerun_sdk/types/workflows/action_update_params.py create mode 100644 src/mobilerun_sdk/types/workflows/action_update_response.py create mode 100644 src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py create mode 100644 src/mobilerun_sdk/types/workflows/actions/service_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/event_dry_run_params.py create mode 100644 src/mobilerun_sdk/types/workflows/event_dry_run_response.py create mode 100644 src/mobilerun_sdk/types/workflows/event_ingest_params.py create mode 100644 src/mobilerun_sdk/types/workflows/event_ingest_response.py create mode 100644 src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py create mode 100644 src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py create mode 100644 src/mobilerun_sdk/types/workflows/execution_list_params.py create mode 100644 src/mobilerun_sdk/types/workflows/execution_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/execution_retrieve_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_clone_params.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_clone_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_create_params.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_create_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_delete_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_execution.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_list_params.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_retrieve_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_unblock_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_update_params.py create mode 100644 src/mobilerun_sdk/types/workflows/flow_update_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flows/action_add_params.py create mode 100644 src/mobilerun_sdk/types/workflows/flows/action_add_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flows/action_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flows/action_remove_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flows/action_replace_params.py create mode 100644 src/mobilerun_sdk/types/workflows/flows/action_replace_response.py create mode 100644 src/mobilerun_sdk/types/workflows/flows/flow_action.py create mode 100644 src/mobilerun_sdk/types/workflows/timezone_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_create_params.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_create_response.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_delete_response.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_fire_params.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_fire_response.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_list_params.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_list_response.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_update_params.py create mode 100644 src/mobilerun_sdk/types/workflows/trigger_update_response.py create mode 100644 tests/api_resources/workflows/__init__.py create mode 100644 tests/api_resources/workflows/actions/__init__.py create mode 100644 tests/api_resources/workflows/actions/test_services.py create mode 100644 tests/api_resources/workflows/flows/__init__.py create mode 100644 tests/api_resources/workflows/flows/test_actions.py create mode 100644 tests/api_resources/workflows/test_action_catalog.py create mode 100644 tests/api_resources/workflows/test_actions.py create mode 100644 tests/api_resources/workflows/test_events.py create mode 100644 tests/api_resources/workflows/test_executions.py create mode 100644 tests/api_resources/workflows/test_flows.py create mode 100644 tests/api_resources/workflows/test_timezones.py create mode 100644 tests/api_resources/workflows/test_triggers.py diff --git a/.stats.yml b/.stats.yml index 90ec418..18785ef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 118 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-ba11696b1ce362ff0ca1de1db5753b839bb976e2c0d6f46b1a6ca682da4b75d2.yml -openapi_spec_hash: 7126ef9674cfcbfed175e48aa1fe3cd6 +configured_endpoints: 150 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-521a4a2c8ab8dd16173d533d8c851a057b04ff6d144bfa35a062103fbe417aef.yml +openapi_spec_hash: f3077f6c61aff5d5c4468a7968777041 config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/api.md b/api.md index a922cdb..1a26682 100644 --- a/api.md +++ b/api.md @@ -490,6 +490,184 @@ Methods: - client.tasks.ui_states.retrieve(index, \*, task_id) -> MediaResponse - client.tasks.ui_states.list(task_id) -> UiStateListResponse +# Workflows + +Types: + +```python +from mobilerun_sdk.types import Flow +``` + +## Triggers + +Types: + +```python +from mobilerun_sdk.types.workflows import ( + TriggerCreateResponse, + TriggerRetrieveResponse, + TriggerUpdateResponse, + TriggerListResponse, + TriggerDeleteResponse, + TriggerFireResponse, +) +``` + +Methods: + +- client.workflows.triggers.create(\*\*params) -> TriggerCreateResponse +- client.workflows.triggers.retrieve(trigger_id) -> TriggerRetrieveResponse +- client.workflows.triggers.update(trigger_id, \*\*params) -> TriggerUpdateResponse +- client.workflows.triggers.list(\*\*params) -> TriggerListResponse +- client.workflows.triggers.delete(trigger_id) -> TriggerDeleteResponse +- client.workflows.triggers.fire(trigger_id, \*\*params) -> TriggerFireResponse + +## ActionCatalog + +Types: + +```python +from mobilerun_sdk.types.workflows import ( + ActionCatalogEntry, + ActionCatalogRetrieveResponse, + ActionCatalogListResponse, +) +``` + +Methods: + +- client.workflows.action_catalog.retrieve(catalog_entry_id) -> ActionCatalogRetrieveResponse +- client.workflows.action_catalog.list(\*\*params) -> ActionCatalogListResponse + +## Actions + +Types: + +```python +from mobilerun_sdk.types.workflows import ( + Action, + ActionCreateResponse, + ActionRetrieveResponse, + ActionUpdateResponse, + ActionListResponse, + ActionDeleteResponse, +) +``` + +Methods: + +- client.workflows.actions.create(\*\*params) -> ActionCreateResponse +- client.workflows.actions.retrieve(action_id) -> ActionRetrieveResponse +- client.workflows.actions.update(action_id, \*\*params) -> ActionUpdateResponse +- client.workflows.actions.list(\*\*params) -> ActionListResponse +- client.workflows.actions.delete(action_id) -> ActionDeleteResponse + +### Services + +Types: + +```python +from mobilerun_sdk.types.workflows.actions import ServiceListResponse, ServiceListMethodsResponse +``` + +Methods: + +- client.workflows.actions.services.list() -> ServiceListResponse +- client.workflows.actions.services.list_methods(service) -> ServiceListMethodsResponse + +## Flows + +Types: + +```python +from mobilerun_sdk.types.workflows import ( + FlowActionOverrides, + FlowChildActionInput, + FlowCreateResponse, + FlowRetrieveResponse, + FlowUpdateResponse, + FlowListResponse, + FlowDeleteResponse, + FlowCloneResponse, + FlowUnblockResponse, +) +``` + +Methods: + +- client.workflows.flows.create(\*\*params) -> FlowCreateResponse +- client.workflows.flows.retrieve(flow_id) -> FlowRetrieveResponse +- client.workflows.flows.update(flow_id, \*\*params) -> FlowUpdateResponse +- client.workflows.flows.list(\*\*params) -> FlowListResponse +- client.workflows.flows.delete(flow_id) -> FlowDeleteResponse +- client.workflows.flows.clone(flow_id, \*\*params) -> FlowCloneResponse +- client.workflows.flows.unblock(flow_id) -> FlowUnblockResponse + +### Actions + +Types: + +```python +from mobilerun_sdk.types.workflows.flows import ( + FlowAction, + ActionListResponse, + ActionAddResponse, + ActionRemoveResponse, + ActionReplaceResponse, +) +``` + +Methods: + +- client.workflows.flows.actions.list(flow_id) -> ActionListResponse +- client.workflows.flows.actions.add(flow_id, \*\*params) -> ActionAddResponse +- client.workflows.flows.actions.remove(flow_action_id, \*, flow_id) -> ActionRemoveResponse +- client.workflows.flows.actions.replace(flow_id, \*\*params) -> ActionReplaceResponse + +## Events + +Types: + +```python +from mobilerun_sdk.types.workflows import EventDryRunResponse, EventIngestResponse +``` + +Methods: + +- client.workflows.events.dry_run(\*\*params) -> EventDryRunResponse +- client.workflows.events.ingest(\*\*params) -> EventIngestResponse + +## Executions + +Types: + +```python +from mobilerun_sdk.types.workflows import ( + FlowExecution, + ExecutionRetrieveResponse, + ExecutionListResponse, + ExecutionGetMetricsResponse, +) +``` + +Methods: + +- client.workflows.executions.retrieve(execution_id) -> ExecutionRetrieveResponse +- client.workflows.executions.list(\*\*params) -> ExecutionListResponse +- client.workflows.executions.get_metrics(\*\*params) -> ExecutionGetMetricsResponse + +## Timezones + +Types: + +```python +from mobilerun_sdk.types.workflows import TimezoneListResponse +``` + +Methods: + +- client.workflows.timezones.list() -> TimezoneListResponse + # Webhooks Types: diff --git a/src/mobilerun_sdk/_client.py b/src/mobilerun_sdk/_client.py index 0ed2e4e..4f5c67e 100644 --- a/src/mobilerun_sdk/_client.py +++ b/src/mobilerun_sdk/_client.py @@ -36,7 +36,19 @@ ) if TYPE_CHECKING: - from .resources import apps, tasks, models, connect, devices, proxies, carriers, profiles, webhooks, credentials + from .resources import ( + apps, + tasks, + models, + connect, + devices, + proxies, + carriers, + profiles, + webhooks, + workflows, + credentials, + ) from .resources.apps import AppsResource, AsyncAppsResource from .resources.models import ModelsResource, AsyncModelsResource from .resources.proxies import ProxiesResource, AsyncProxiesResource @@ -46,6 +58,7 @@ from .resources.connect.connect import ConnectResource, AsyncConnectResource from .resources.devices.devices import DevicesResource, AsyncDevicesResource from .resources.webhooks.webhooks import WebhooksResource, AsyncWebhooksResource + from .resources.workflows.workflows import WorkflowsResource, AsyncWorkflowsResource from .resources.credentials.credentials import CredentialsResource, AsyncCredentialsResource __all__ = [ @@ -180,6 +193,12 @@ def tasks(self) -> TasksResource: return TasksResource(self) + @cached_property + def workflows(self) -> WorkflowsResource: + from .resources.workflows import WorkflowsResource + + return WorkflowsResource(self) + @cached_property def webhooks(self) -> WebhooksResource: from .resources.webhooks import WebhooksResource @@ -430,6 +449,12 @@ def tasks(self) -> AsyncTasksResource: return AsyncTasksResource(self) + @cached_property + def workflows(self) -> AsyncWorkflowsResource: + from .resources.workflows import AsyncWorkflowsResource + + return AsyncWorkflowsResource(self) + @cached_property def webhooks(self) -> AsyncWebhooksResource: from .resources.webhooks import AsyncWebhooksResource @@ -626,6 +651,12 @@ def tasks(self) -> tasks.TasksResourceWithRawResponse: return TasksResourceWithRawResponse(self._client.tasks) + @cached_property + def workflows(self) -> workflows.WorkflowsResourceWithRawResponse: + from .resources.workflows import WorkflowsResourceWithRawResponse + + return WorkflowsResourceWithRawResponse(self._client.workflows) + @cached_property def webhooks(self) -> webhooks.WebhooksResourceWithRawResponse: from .resources.webhooks import WebhooksResourceWithRawResponse @@ -699,6 +730,12 @@ def tasks(self) -> tasks.AsyncTasksResourceWithRawResponse: return AsyncTasksResourceWithRawResponse(self._client.tasks) + @cached_property + def workflows(self) -> workflows.AsyncWorkflowsResourceWithRawResponse: + from .resources.workflows import AsyncWorkflowsResourceWithRawResponse + + return AsyncWorkflowsResourceWithRawResponse(self._client.workflows) + @cached_property def webhooks(self) -> webhooks.AsyncWebhooksResourceWithRawResponse: from .resources.webhooks import AsyncWebhooksResourceWithRawResponse @@ -772,6 +809,12 @@ def tasks(self) -> tasks.TasksResourceWithStreamingResponse: return TasksResourceWithStreamingResponse(self._client.tasks) + @cached_property + def workflows(self) -> workflows.WorkflowsResourceWithStreamingResponse: + from .resources.workflows import WorkflowsResourceWithStreamingResponse + + return WorkflowsResourceWithStreamingResponse(self._client.workflows) + @cached_property def webhooks(self) -> webhooks.WebhooksResourceWithStreamingResponse: from .resources.webhooks import WebhooksResourceWithStreamingResponse @@ -845,6 +888,12 @@ def tasks(self) -> tasks.AsyncTasksResourceWithStreamingResponse: return AsyncTasksResourceWithStreamingResponse(self._client.tasks) + @cached_property + def workflows(self) -> workflows.AsyncWorkflowsResourceWithStreamingResponse: + from .resources.workflows import AsyncWorkflowsResourceWithStreamingResponse + + return AsyncWorkflowsResourceWithStreamingResponse(self._client.workflows) + @cached_property def webhooks(self) -> webhooks.AsyncWebhooksResourceWithStreamingResponse: from .resources.webhooks import AsyncWebhooksResourceWithStreamingResponse diff --git a/src/mobilerun_sdk/resources/__init__.py b/src/mobilerun_sdk/resources/__init__.py index 3f3887c..be9be40 100644 --- a/src/mobilerun_sdk/resources/__init__.py +++ b/src/mobilerun_sdk/resources/__init__.py @@ -72,6 +72,14 @@ WebhooksResourceWithStreamingResponse, AsyncWebhooksResourceWithStreamingResponse, ) +from .workflows import ( + WorkflowsResource, + AsyncWorkflowsResource, + WorkflowsResourceWithRawResponse, + AsyncWorkflowsResourceWithRawResponse, + WorkflowsResourceWithStreamingResponse, + AsyncWorkflowsResourceWithStreamingResponse, +) from .credentials import ( CredentialsResource, AsyncCredentialsResource, @@ -136,6 +144,12 @@ "AsyncTasksResourceWithRawResponse", "TasksResourceWithStreamingResponse", "AsyncTasksResourceWithStreamingResponse", + "WorkflowsResource", + "AsyncWorkflowsResource", + "WorkflowsResourceWithRawResponse", + "AsyncWorkflowsResourceWithRawResponse", + "WorkflowsResourceWithStreamingResponse", + "AsyncWorkflowsResourceWithStreamingResponse", "WebhooksResource", "AsyncWebhooksResource", "WebhooksResourceWithRawResponse", diff --git a/src/mobilerun_sdk/resources/workflows/__init__.py b/src/mobilerun_sdk/resources/workflows/__init__.py new file mode 100644 index 0000000..2b80e07 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/__init__.py @@ -0,0 +1,117 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .flows import ( + FlowsResource, + AsyncFlowsResource, + FlowsResourceWithRawResponse, + AsyncFlowsResourceWithRawResponse, + FlowsResourceWithStreamingResponse, + AsyncFlowsResourceWithStreamingResponse, +) +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) +from .triggers import ( + TriggersResource, + AsyncTriggersResource, + TriggersResourceWithRawResponse, + AsyncTriggersResourceWithRawResponse, + TriggersResourceWithStreamingResponse, + AsyncTriggersResourceWithStreamingResponse, +) +from .timezones import ( + TimezonesResource, + AsyncTimezonesResource, + TimezonesResourceWithRawResponse, + AsyncTimezonesResourceWithRawResponse, + TimezonesResourceWithStreamingResponse, + AsyncTimezonesResourceWithStreamingResponse, +) +from .workflows import ( + WorkflowsResource, + AsyncWorkflowsResource, + WorkflowsResourceWithRawResponse, + AsyncWorkflowsResourceWithRawResponse, + WorkflowsResourceWithStreamingResponse, + AsyncWorkflowsResourceWithStreamingResponse, +) +from .executions import ( + ExecutionsResource, + AsyncExecutionsResource, + ExecutionsResourceWithRawResponse, + AsyncExecutionsResourceWithRawResponse, + ExecutionsResourceWithStreamingResponse, + AsyncExecutionsResourceWithStreamingResponse, +) +from .action_catalog import ( + ActionCatalogResource, + AsyncActionCatalogResource, + ActionCatalogResourceWithRawResponse, + AsyncActionCatalogResourceWithRawResponse, + ActionCatalogResourceWithStreamingResponse, + AsyncActionCatalogResourceWithStreamingResponse, +) + +__all__ = [ + "TriggersResource", + "AsyncTriggersResource", + "TriggersResourceWithRawResponse", + "AsyncTriggersResourceWithRawResponse", + "TriggersResourceWithStreamingResponse", + "AsyncTriggersResourceWithStreamingResponse", + "ActionCatalogResource", + "AsyncActionCatalogResource", + "ActionCatalogResourceWithRawResponse", + "AsyncActionCatalogResourceWithRawResponse", + "ActionCatalogResourceWithStreamingResponse", + "AsyncActionCatalogResourceWithStreamingResponse", + "ActionsResource", + "AsyncActionsResource", + "ActionsResourceWithRawResponse", + "AsyncActionsResourceWithRawResponse", + "ActionsResourceWithStreamingResponse", + "AsyncActionsResourceWithStreamingResponse", + "FlowsResource", + "AsyncFlowsResource", + "FlowsResourceWithRawResponse", + "AsyncFlowsResourceWithRawResponse", + "FlowsResourceWithStreamingResponse", + "AsyncFlowsResourceWithStreamingResponse", + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "ExecutionsResource", + "AsyncExecutionsResource", + "ExecutionsResourceWithRawResponse", + "AsyncExecutionsResourceWithRawResponse", + "ExecutionsResourceWithStreamingResponse", + "AsyncExecutionsResourceWithStreamingResponse", + "TimezonesResource", + "AsyncTimezonesResource", + "TimezonesResourceWithRawResponse", + "AsyncTimezonesResourceWithRawResponse", + "TimezonesResourceWithStreamingResponse", + "AsyncTimezonesResourceWithStreamingResponse", + "WorkflowsResource", + "AsyncWorkflowsResource", + "WorkflowsResourceWithRawResponse", + "AsyncWorkflowsResourceWithRawResponse", + "WorkflowsResourceWithStreamingResponse", + "AsyncWorkflowsResourceWithStreamingResponse", +] diff --git a/src/mobilerun_sdk/resources/workflows/action_catalog.py b/src/mobilerun_sdk/resources/workflows/action_catalog.py new file mode 100644 index 0000000..b637dd4 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/action_catalog.py @@ -0,0 +1,268 @@ +# 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 path_template, 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.workflows import action_catalog_list_params +from ...types.workflows.action_catalog_list_response import ActionCatalogListResponse +from ...types.workflows.action_catalog_retrieve_response import ActionCatalogRetrieveResponse + +__all__ = ["ActionCatalogResource", "AsyncActionCatalogResource"] + + +class ActionCatalogResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ActionCatalogResourceWithRawResponse: + """ + 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 ActionCatalogResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ActionCatalogResourceWithStreamingResponse: + """ + 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 ActionCatalogResourceWithStreamingResponse(self) + + def retrieve( + self, + catalog_entry_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, + ) -> ActionCatalogRetrieveResponse: + """ + Get a catalog entry + + 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 catalog_entry_id: + raise ValueError(f"Expected a non-empty value for `catalog_entry_id` but received {catalog_entry_id!r}") + return self._get( + path_template("/action-catalog/{catalog_entry_id}", catalog_entry_id=catalog_entry_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionCatalogRetrieveResponse, + ) + + def list( + self, + *, + page: int | Omit = omit, + page_size: int | Omit = omit, + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, + ) -> ActionCatalogListResponse: + """ + List action catalog entries + + 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( + "/action-catalog", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "page": page, + "page_size": page_size, + "service": service, + }, + action_catalog_list_params.ActionCatalogListParams, + ), + ), + cast_to=ActionCatalogListResponse, + ) + + +class AsyncActionCatalogResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncActionCatalogResourceWithRawResponse: + """ + 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 AsyncActionCatalogResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncActionCatalogResourceWithStreamingResponse: + """ + 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 AsyncActionCatalogResourceWithStreamingResponse(self) + + async def retrieve( + self, + catalog_entry_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, + ) -> ActionCatalogRetrieveResponse: + """ + Get a catalog entry + + 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 catalog_entry_id: + raise ValueError(f"Expected a non-empty value for `catalog_entry_id` but received {catalog_entry_id!r}") + return await self._get( + path_template("/action-catalog/{catalog_entry_id}", catalog_entry_id=catalog_entry_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionCatalogRetrieveResponse, + ) + + async def list( + self, + *, + page: int | Omit = omit, + page_size: int | Omit = omit, + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, + ) -> ActionCatalogListResponse: + """ + List action catalog entries + + 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( + "/action-catalog", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "page": page, + "page_size": page_size, + "service": service, + }, + action_catalog_list_params.ActionCatalogListParams, + ), + ), + cast_to=ActionCatalogListResponse, + ) + + +class ActionCatalogResourceWithRawResponse: + def __init__(self, action_catalog: ActionCatalogResource) -> None: + self._action_catalog = action_catalog + + self.retrieve = to_raw_response_wrapper( + action_catalog.retrieve, + ) + self.list = to_raw_response_wrapper( + action_catalog.list, + ) + + +class AsyncActionCatalogResourceWithRawResponse: + def __init__(self, action_catalog: AsyncActionCatalogResource) -> None: + self._action_catalog = action_catalog + + self.retrieve = async_to_raw_response_wrapper( + action_catalog.retrieve, + ) + self.list = async_to_raw_response_wrapper( + action_catalog.list, + ) + + +class ActionCatalogResourceWithStreamingResponse: + def __init__(self, action_catalog: ActionCatalogResource) -> None: + self._action_catalog = action_catalog + + self.retrieve = to_streamed_response_wrapper( + action_catalog.retrieve, + ) + self.list = to_streamed_response_wrapper( + action_catalog.list, + ) + + +class AsyncActionCatalogResourceWithStreamingResponse: + def __init__(self, action_catalog: AsyncActionCatalogResource) -> None: + self._action_catalog = action_catalog + + self.retrieve = async_to_streamed_response_wrapper( + action_catalog.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + action_catalog.list, + ) diff --git a/src/mobilerun_sdk/resources/workflows/actions/__init__.py b/src/mobilerun_sdk/resources/workflows/actions/__init__.py new file mode 100644 index 0000000..f4307e4 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/actions/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) +from .services import ( + ServicesResource, + AsyncServicesResource, + ServicesResourceWithRawResponse, + AsyncServicesResourceWithRawResponse, + ServicesResourceWithStreamingResponse, + AsyncServicesResourceWithStreamingResponse, +) + +__all__ = [ + "ServicesResource", + "AsyncServicesResource", + "ServicesResourceWithRawResponse", + "AsyncServicesResourceWithRawResponse", + "ServicesResourceWithStreamingResponse", + "AsyncServicesResourceWithStreamingResponse", + "ActionsResource", + "AsyncActionsResource", + "ActionsResourceWithRawResponse", + "AsyncActionsResourceWithRawResponse", + "ActionsResourceWithStreamingResponse", + "AsyncActionsResourceWithStreamingResponse", +] diff --git a/src/mobilerun_sdk/resources/workflows/actions/actions.py b/src/mobilerun_sdk/resources/workflows/actions/actions.py new file mode 100644 index 0000000..2b4723a --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/actions/actions.py @@ -0,0 +1,592 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal + +import httpx + +from .services import ( + ServicesResource, + AsyncServicesResource, + ServicesResourceWithRawResponse, + AsyncServicesResourceWithRawResponse, + ServicesResourceWithStreamingResponse, + AsyncServicesResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, 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.workflows import action_list_params, action_create_params, action_update_params +from ....types.workflows.action_list_response import ActionListResponse +from ....types.workflows.action_create_response import ActionCreateResponse +from ....types.workflows.action_delete_response import ActionDeleteResponse +from ....types.workflows.action_update_response import ActionUpdateResponse +from ....types.workflows.action_retrieve_response import ActionRetrieveResponse + +__all__ = ["ActionsResource", "AsyncActionsResource"] + + +class ActionsResource(SyncAPIResource): + @cached_property + def services(self) -> ServicesResource: + return ServicesResource(self._client) + + @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 create( + self, + *, + catalog_entry_id: str, + name: str, + description: str | Omit = omit, + params: Dict[str, Optional[object]] | 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, + ) -> ActionCreateResponse: + """ + Create an 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 + """ + return self._post( + "/actions", + body=maybe_transform( + { + "catalog_entry_id": catalog_entry_id, + "name": name, + "description": description, + "params": params, + }, + action_create_params.ActionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionCreateResponse, + ) + + def retrieve( + self, + action_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, + ) -> ActionRetrieveResponse: + """ + Get an 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 action_id: + raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") + return self._get( + path_template("/actions/{action_id}", action_id=action_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionRetrieveResponse, + ) + + def update( + self, + action_id: str, + *, + description: str | Omit = omit, + name: str | Omit = omit, + params: Dict[str, Optional[object]] | 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, + ) -> ActionUpdateResponse: + """ + Update an 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 action_id: + raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") + return self._patch( + path_template("/actions/{action_id}", action_id=action_id), + body=maybe_transform( + { + "description": description, + "name": name, + "params": params, + }, + action_update_params.ActionUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionUpdateResponse, + ) + + def list( + self, + *, + order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | Omit = omit, + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, + ) -> ActionListResponse: + """ + List actions + + 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( + "/actions", + 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, + "search": search, + "service": service, + }, + action_list_params.ActionListParams, + ), + ), + cast_to=ActionListResponse, + ) + + def delete( + self, + action_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, + ) -> ActionDeleteResponse: + """ + Delete an 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 action_id: + raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") + return self._delete( + path_template("/actions/{action_id}", action_id=action_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionDeleteResponse, + ) + + +class AsyncActionsResource(AsyncAPIResource): + @cached_property + def services(self) -> AsyncServicesResource: + return AsyncServicesResource(self._client) + + @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 create( + self, + *, + catalog_entry_id: str, + name: str, + description: str | Omit = omit, + params: Dict[str, Optional[object]] | 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, + ) -> ActionCreateResponse: + """ + Create an 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 + """ + return await self._post( + "/actions", + body=await async_maybe_transform( + { + "catalog_entry_id": catalog_entry_id, + "name": name, + "description": description, + "params": params, + }, + action_create_params.ActionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionCreateResponse, + ) + + async def retrieve( + self, + action_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, + ) -> ActionRetrieveResponse: + """ + Get an 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 action_id: + raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") + return await self._get( + path_template("/actions/{action_id}", action_id=action_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionRetrieveResponse, + ) + + async def update( + self, + action_id: str, + *, + description: str | Omit = omit, + name: str | Omit = omit, + params: Dict[str, Optional[object]] | 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, + ) -> ActionUpdateResponse: + """ + Update an 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 action_id: + raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") + return await self._patch( + path_template("/actions/{action_id}", action_id=action_id), + body=await async_maybe_transform( + { + "description": description, + "name": name, + "params": params, + }, + action_update_params.ActionUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionUpdateResponse, + ) + + async def list( + self, + *, + order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | Omit = omit, + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] | 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, + ) -> ActionListResponse: + """ + List actions + + 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( + "/actions", + 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, + "search": search, + "service": service, + }, + action_list_params.ActionListParams, + ), + ), + cast_to=ActionListResponse, + ) + + async def delete( + self, + action_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, + ) -> ActionDeleteResponse: + """ + Delete an 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 action_id: + raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}") + return await self._delete( + path_template("/actions/{action_id}", action_id=action_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionDeleteResponse, + ) + + +class ActionsResourceWithRawResponse: + def __init__(self, actions: ActionsResource) -> None: + self._actions = actions + + self.create = to_raw_response_wrapper( + actions.create, + ) + self.retrieve = to_raw_response_wrapper( + actions.retrieve, + ) + self.update = to_raw_response_wrapper( + actions.update, + ) + self.list = to_raw_response_wrapper( + actions.list, + ) + self.delete = to_raw_response_wrapper( + actions.delete, + ) + + @cached_property + def services(self) -> ServicesResourceWithRawResponse: + return ServicesResourceWithRawResponse(self._actions.services) + + +class AsyncActionsResourceWithRawResponse: + def __init__(self, actions: AsyncActionsResource) -> None: + self._actions = actions + + self.create = async_to_raw_response_wrapper( + actions.create, + ) + self.retrieve = async_to_raw_response_wrapper( + actions.retrieve, + ) + self.update = async_to_raw_response_wrapper( + actions.update, + ) + self.list = async_to_raw_response_wrapper( + actions.list, + ) + self.delete = async_to_raw_response_wrapper( + actions.delete, + ) + + @cached_property + def services(self) -> AsyncServicesResourceWithRawResponse: + return AsyncServicesResourceWithRawResponse(self._actions.services) + + +class ActionsResourceWithStreamingResponse: + def __init__(self, actions: ActionsResource) -> None: + self._actions = actions + + self.create = to_streamed_response_wrapper( + actions.create, + ) + self.retrieve = to_streamed_response_wrapper( + actions.retrieve, + ) + self.update = to_streamed_response_wrapper( + actions.update, + ) + self.list = to_streamed_response_wrapper( + actions.list, + ) + self.delete = to_streamed_response_wrapper( + actions.delete, + ) + + @cached_property + def services(self) -> ServicesResourceWithStreamingResponse: + return ServicesResourceWithStreamingResponse(self._actions.services) + + +class AsyncActionsResourceWithStreamingResponse: + def __init__(self, actions: AsyncActionsResource) -> None: + self._actions = actions + + self.create = async_to_streamed_response_wrapper( + actions.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + actions.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + actions.update, + ) + self.list = async_to_streamed_response_wrapper( + actions.list, + ) + self.delete = async_to_streamed_response_wrapper( + actions.delete, + ) + + @cached_property + def services(self) -> AsyncServicesResourceWithStreamingResponse: + return AsyncServicesResourceWithStreamingResponse(self._actions.services) diff --git a/src/mobilerun_sdk/resources/workflows/actions/services.py b/src/mobilerun_sdk/resources/workflows/actions/services.py new file mode 100644 index 0000000..fd46c48 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/actions/services.py @@ -0,0 +1,215 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template +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.workflows.actions.service_list_response import ServiceListResponse +from ....types.workflows.actions.service_list_methods_response import ServiceListMethodsResponse + +__all__ = ["ServicesResource", "AsyncServicesResource"] + + +class ServicesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ServicesResourceWithRawResponse: + """ + 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 ServicesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ServicesResourceWithStreamingResponse: + """ + 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 ServicesResourceWithStreamingResponse(self) + + def list( + 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, + ) -> ServiceListResponse: + """List available services""" + return self._get( + "/actions/services", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ServiceListResponse, + ) + + def list_methods( + self, + service: 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, + ) -> ServiceListMethodsResponse: + """ + List allowed methods for a service + + 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 service: + raise ValueError(f"Expected a non-empty value for `service` but received {service!r}") + return self._get( + path_template("/actions/services/{service}/methods", service=service), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ServiceListMethodsResponse, + ) + + +class AsyncServicesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncServicesResourceWithRawResponse: + """ + 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 AsyncServicesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncServicesResourceWithStreamingResponse: + """ + 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 AsyncServicesResourceWithStreamingResponse(self) + + async def list( + 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, + ) -> ServiceListResponse: + """List available services""" + return await self._get( + "/actions/services", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ServiceListResponse, + ) + + async def list_methods( + self, + service: 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, + ) -> ServiceListMethodsResponse: + """ + List allowed methods for a service + + 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 service: + raise ValueError(f"Expected a non-empty value for `service` but received {service!r}") + return await self._get( + path_template("/actions/services/{service}/methods", service=service), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ServiceListMethodsResponse, + ) + + +class ServicesResourceWithRawResponse: + def __init__(self, services: ServicesResource) -> None: + self._services = services + + self.list = to_raw_response_wrapper( + services.list, + ) + self.list_methods = to_raw_response_wrapper( + services.list_methods, + ) + + +class AsyncServicesResourceWithRawResponse: + def __init__(self, services: AsyncServicesResource) -> None: + self._services = services + + self.list = async_to_raw_response_wrapper( + services.list, + ) + self.list_methods = async_to_raw_response_wrapper( + services.list_methods, + ) + + +class ServicesResourceWithStreamingResponse: + def __init__(self, services: ServicesResource) -> None: + self._services = services + + self.list = to_streamed_response_wrapper( + services.list, + ) + self.list_methods = to_streamed_response_wrapper( + services.list_methods, + ) + + +class AsyncServicesResourceWithStreamingResponse: + def __init__(self, services: AsyncServicesResource) -> None: + self._services = services + + self.list = async_to_streamed_response_wrapper( + services.list, + ) + self.list_methods = async_to_streamed_response_wrapper( + services.list_methods, + ) diff --git a/src/mobilerun_sdk/resources/workflows/events.py b/src/mobilerun_sdk/resources/workflows/events.py new file mode 100644 index 0000000..34c5350 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/events.py @@ -0,0 +1,284 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional + +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.workflows import event_ingest_params, event_dry_run_params +from ...types.workflows.event_ingest_response import EventIngestResponse +from ...types.workflows.event_dry_run_response import EventDryRunResponse + +__all__ = ["EventsResource", "AsyncEventsResource"] + + +class EventsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EventsResourceWithRawResponse: + """ + 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 EventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + """ + 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 EventsResourceWithStreamingResponse(self) + + def dry_run( + self, + *, + event_type: str, + device_id: str | Omit = omit, + payload: Dict[str, Optional[object]] | 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, + ) -> EventDryRunResponse: + """Simulate an event against all configured flows. + + Returns which flows would match + and what actions would run, without storing the event or enqueuing jobs. + + 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( + "/events/dry-run", + body=maybe_transform( + { + "event_type": event_type, + "device_id": device_id, + "payload": payload, + }, + event_dry_run_params.EventDryRunParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EventDryRunResponse, + ) + + def ingest( + self, + *, + event_type: str, + device_id: str | Omit = omit, + payload: Dict[str, Optional[object]] | 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, + ) -> EventIngestResponse: + """Ingest an event for trigger evaluation. + + Returns immediately with 202 Accepted. + + 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( + "/events/ingest", + body=maybe_transform( + { + "event_type": event_type, + "device_id": device_id, + "payload": payload, + }, + event_ingest_params.EventIngestParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EventIngestResponse, + ) + + +class AsyncEventsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + """ + 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 AsyncEventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + """ + 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 AsyncEventsResourceWithStreamingResponse(self) + + async def dry_run( + self, + *, + event_type: str, + device_id: str | Omit = omit, + payload: Dict[str, Optional[object]] | 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, + ) -> EventDryRunResponse: + """Simulate an event against all configured flows. + + Returns which flows would match + and what actions would run, without storing the event or enqueuing jobs. + + 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( + "/events/dry-run", + body=await async_maybe_transform( + { + "event_type": event_type, + "device_id": device_id, + "payload": payload, + }, + event_dry_run_params.EventDryRunParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EventDryRunResponse, + ) + + async def ingest( + self, + *, + event_type: str, + device_id: str | Omit = omit, + payload: Dict[str, Optional[object]] | 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, + ) -> EventIngestResponse: + """Ingest an event for trigger evaluation. + + Returns immediately with 202 Accepted. + + 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( + "/events/ingest", + body=await async_maybe_transform( + { + "event_type": event_type, + "device_id": device_id, + "payload": payload, + }, + event_ingest_params.EventIngestParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EventIngestResponse, + ) + + +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.dry_run = to_raw_response_wrapper( + events.dry_run, + ) + self.ingest = to_raw_response_wrapper( + events.ingest, + ) + + +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.dry_run = async_to_raw_response_wrapper( + events.dry_run, + ) + self.ingest = async_to_raw_response_wrapper( + events.ingest, + ) + + +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.dry_run = to_streamed_response_wrapper( + events.dry_run, + ) + self.ingest = to_streamed_response_wrapper( + events.ingest, + ) + + +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.dry_run = async_to_streamed_response_wrapper( + events.dry_run, + ) + self.ingest = async_to_streamed_response_wrapper( + events.ingest, + ) diff --git a/src/mobilerun_sdk/resources/workflows/executions.py b/src/mobilerun_sdk/resources/workflows/executions.py new file mode 100644 index 0000000..4d12f2d --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/executions.py @@ -0,0 +1,402 @@ +# 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 ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, 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.workflows import execution_list_params, execution_get_metrics_params +from ...types.workflows.execution_list_response import ExecutionListResponse +from ...types.workflows.execution_retrieve_response import ExecutionRetrieveResponse +from ...types.workflows.execution_get_metrics_response import ExecutionGetMetricsResponse + +__all__ = ["ExecutionsResource", "AsyncExecutionsResource"] + + +class ExecutionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ExecutionsResourceWithRawResponse: + """ + 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 ExecutionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ExecutionsResourceWithStreamingResponse: + """ + 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 ExecutionsResourceWithStreamingResponse(self) + + def retrieve( + self, + execution_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, + ) -> ExecutionRetrieveResponse: + """ + Get execution details + + 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 execution_id: + raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") + return self._get( + path_template("/executions/{execution_id}", execution_id=execution_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExecutionRetrieveResponse, + ) + + def list( + self, + *, + flow_id: str | Omit = omit, + from_: Optional[str] | Omit = omit, + order_by: Literal["startedAt", "finishedAt", "status"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | Omit = omit, + status: Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"] | Omit = omit, + to: Optional[str] | Omit = omit, + trigger_id: str | 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, + ) -> ExecutionListResponse: + """ + List flow executions + + 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( + "/executions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "flow_id": flow_id, + "from_": from_, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "search": search, + "status": status, + "to": to, + "trigger_id": trigger_id, + }, + execution_list_params.ExecutionListParams, + ), + ), + cast_to=ExecutionListResponse, + ) + + def get_metrics( + self, + *, + flow_id: str | Omit = omit, + from_: Optional[str] | Omit = omit, + to: Optional[str] | Omit = omit, + trigger_id: str | 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, + ) -> ExecutionGetMetricsResponse: + """ + Get execution metrics + + 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( + "/executions/metrics", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "flow_id": flow_id, + "from_": from_, + "to": to, + "trigger_id": trigger_id, + }, + execution_get_metrics_params.ExecutionGetMetricsParams, + ), + ), + cast_to=ExecutionGetMetricsResponse, + ) + + +class AsyncExecutionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncExecutionsResourceWithRawResponse: + """ + 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 AsyncExecutionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncExecutionsResourceWithStreamingResponse: + """ + 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 AsyncExecutionsResourceWithStreamingResponse(self) + + async def retrieve( + self, + execution_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, + ) -> ExecutionRetrieveResponse: + """ + Get execution details + + 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 execution_id: + raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") + return await self._get( + path_template("/executions/{execution_id}", execution_id=execution_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExecutionRetrieveResponse, + ) + + async def list( + self, + *, + flow_id: str | Omit = omit, + from_: Optional[str] | Omit = omit, + order_by: Literal["startedAt", "finishedAt", "status"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | Omit = omit, + status: Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"] | Omit = omit, + to: Optional[str] | Omit = omit, + trigger_id: str | 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, + ) -> ExecutionListResponse: + """ + List flow executions + + 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( + "/executions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "flow_id": flow_id, + "from_": from_, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "search": search, + "status": status, + "to": to, + "trigger_id": trigger_id, + }, + execution_list_params.ExecutionListParams, + ), + ), + cast_to=ExecutionListResponse, + ) + + async def get_metrics( + self, + *, + flow_id: str | Omit = omit, + from_: Optional[str] | Omit = omit, + to: Optional[str] | Omit = omit, + trigger_id: str | 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, + ) -> ExecutionGetMetricsResponse: + """ + Get execution metrics + + 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( + "/executions/metrics", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "flow_id": flow_id, + "from_": from_, + "to": to, + "trigger_id": trigger_id, + }, + execution_get_metrics_params.ExecutionGetMetricsParams, + ), + ), + cast_to=ExecutionGetMetricsResponse, + ) + + +class ExecutionsResourceWithRawResponse: + def __init__(self, executions: ExecutionsResource) -> None: + self._executions = executions + + self.retrieve = to_raw_response_wrapper( + executions.retrieve, + ) + self.list = to_raw_response_wrapper( + executions.list, + ) + self.get_metrics = to_raw_response_wrapper( + executions.get_metrics, + ) + + +class AsyncExecutionsResourceWithRawResponse: + def __init__(self, executions: AsyncExecutionsResource) -> None: + self._executions = executions + + self.retrieve = async_to_raw_response_wrapper( + executions.retrieve, + ) + self.list = async_to_raw_response_wrapper( + executions.list, + ) + self.get_metrics = async_to_raw_response_wrapper( + executions.get_metrics, + ) + + +class ExecutionsResourceWithStreamingResponse: + def __init__(self, executions: ExecutionsResource) -> None: + self._executions = executions + + self.retrieve = to_streamed_response_wrapper( + executions.retrieve, + ) + self.list = to_streamed_response_wrapper( + executions.list, + ) + self.get_metrics = to_streamed_response_wrapper( + executions.get_metrics, + ) + + +class AsyncExecutionsResourceWithStreamingResponse: + def __init__(self, executions: AsyncExecutionsResource) -> None: + self._executions = executions + + self.retrieve = async_to_streamed_response_wrapper( + executions.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + executions.list, + ) + self.get_metrics = async_to_streamed_response_wrapper( + executions.get_metrics, + ) diff --git a/src/mobilerun_sdk/resources/workflows/flows/__init__.py b/src/mobilerun_sdk/resources/workflows/flows/__init__.py new file mode 100644 index 0000000..bfeb155 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/flows/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .flows import ( + FlowsResource, + AsyncFlowsResource, + FlowsResourceWithRawResponse, + AsyncFlowsResourceWithRawResponse, + FlowsResourceWithStreamingResponse, + AsyncFlowsResourceWithStreamingResponse, +) +from .actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) + +__all__ = [ + "ActionsResource", + "AsyncActionsResource", + "ActionsResourceWithRawResponse", + "AsyncActionsResourceWithRawResponse", + "ActionsResourceWithStreamingResponse", + "AsyncActionsResourceWithStreamingResponse", + "FlowsResource", + "AsyncFlowsResource", + "FlowsResourceWithRawResponse", + "AsyncFlowsResourceWithRawResponse", + "FlowsResourceWithStreamingResponse", + "AsyncFlowsResourceWithStreamingResponse", +] diff --git a/src/mobilerun_sdk/resources/workflows/flows/actions.py b/src/mobilerun_sdk/resources/workflows/flows/actions.py new file mode 100644 index 0000000..06e3278 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/flows/actions.py @@ -0,0 +1,454 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, 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.workflows.flows import action_add_params, action_replace_params +from ....types.workflows.flows.action_add_response import ActionAddResponse +from ....types.workflows.flows.action_list_response import ActionListResponse +from ....types.workflows.flow_action_overrides_param import FlowActionOverridesParam +from ....types.workflows.flows.action_remove_response import ActionRemoveResponse +from ....types.workflows.flow_child_action_input_param import FlowChildActionInputParam +from ....types.workflows.flows.action_replace_response import ActionReplaceResponse + +__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 list( + self, + flow_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, + ) -> ActionListResponse: + """ + List actions for a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._get( + path_template("/flows/{flow_id}/actions", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionListResponse, + ) + + def add( + self, + flow_id: str, + *, + action_id: str, + position: int, + children: Iterable[FlowChildActionInputParam] | Omit = omit, + continue_on_error: bool | Omit = omit, + name_override: str | Omit = omit, + overrides: Optional[FlowActionOverridesParam] | Omit = omit, + parent_flow_action_id: Optional[str] | 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, + ) -> ActionAddResponse: + """ + Add an action to a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._post( + path_template("/flows/{flow_id}/actions", flow_id=flow_id), + body=maybe_transform( + { + "action_id": action_id, + "position": position, + "children": children, + "continue_on_error": continue_on_error, + "name_override": name_override, + "overrides": overrides, + "parent_flow_action_id": parent_flow_action_id, + }, + action_add_params.ActionAddParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionAddResponse, + ) + + def remove( + self, + flow_action_id: str, + *, + flow_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, + ) -> ActionRemoveResponse: + """ + Remove an action from a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + if not flow_action_id: + raise ValueError(f"Expected a non-empty value for `flow_action_id` but received {flow_action_id!r}") + return self._delete( + path_template("/flows/{flow_id}/actions/{flow_action_id}", flow_id=flow_id, flow_action_id=flow_action_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionRemoveResponse, + ) + + def replace( + self, + flow_id: str, + *, + actions: Iterable[action_replace_params.Action], + # 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, + ) -> ActionReplaceResponse: + """ + Replace all actions for a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._put( + path_template("/flows/{flow_id}/actions", flow_id=flow_id), + body=maybe_transform({"actions": actions}, action_replace_params.ActionReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionReplaceResponse, + ) + + +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 list( + self, + flow_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, + ) -> ActionListResponse: + """ + List actions for a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._get( + path_template("/flows/{flow_id}/actions", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionListResponse, + ) + + async def add( + self, + flow_id: str, + *, + action_id: str, + position: int, + children: Iterable[FlowChildActionInputParam] | Omit = omit, + continue_on_error: bool | Omit = omit, + name_override: str | Omit = omit, + overrides: Optional[FlowActionOverridesParam] | Omit = omit, + parent_flow_action_id: Optional[str] | 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, + ) -> ActionAddResponse: + """ + Add an action to a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._post( + path_template("/flows/{flow_id}/actions", flow_id=flow_id), + body=await async_maybe_transform( + { + "action_id": action_id, + "position": position, + "children": children, + "continue_on_error": continue_on_error, + "name_override": name_override, + "overrides": overrides, + "parent_flow_action_id": parent_flow_action_id, + }, + action_add_params.ActionAddParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionAddResponse, + ) + + async def remove( + self, + flow_action_id: str, + *, + flow_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, + ) -> ActionRemoveResponse: + """ + Remove an action from a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + if not flow_action_id: + raise ValueError(f"Expected a non-empty value for `flow_action_id` but received {flow_action_id!r}") + return await self._delete( + path_template("/flows/{flow_id}/actions/{flow_action_id}", flow_id=flow_id, flow_action_id=flow_action_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionRemoveResponse, + ) + + async def replace( + self, + flow_id: str, + *, + actions: Iterable[action_replace_params.Action], + # 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, + ) -> ActionReplaceResponse: + """ + Replace all actions for a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._put( + path_template("/flows/{flow_id}/actions", flow_id=flow_id), + body=await async_maybe_transform({"actions": actions}, action_replace_params.ActionReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionReplaceResponse, + ) + + +class ActionsResourceWithRawResponse: + def __init__(self, actions: ActionsResource) -> None: + self._actions = actions + + self.list = to_raw_response_wrapper( + actions.list, + ) + self.add = to_raw_response_wrapper( + actions.add, + ) + self.remove = to_raw_response_wrapper( + actions.remove, + ) + self.replace = to_raw_response_wrapper( + actions.replace, + ) + + +class AsyncActionsResourceWithRawResponse: + def __init__(self, actions: AsyncActionsResource) -> None: + self._actions = actions + + self.list = async_to_raw_response_wrapper( + actions.list, + ) + self.add = async_to_raw_response_wrapper( + actions.add, + ) + self.remove = async_to_raw_response_wrapper( + actions.remove, + ) + self.replace = async_to_raw_response_wrapper( + actions.replace, + ) + + +class ActionsResourceWithStreamingResponse: + def __init__(self, actions: ActionsResource) -> None: + self._actions = actions + + self.list = to_streamed_response_wrapper( + actions.list, + ) + self.add = to_streamed_response_wrapper( + actions.add, + ) + self.remove = to_streamed_response_wrapper( + actions.remove, + ) + self.replace = to_streamed_response_wrapper( + actions.replace, + ) + + +class AsyncActionsResourceWithStreamingResponse: + def __init__(self, actions: AsyncActionsResource) -> None: + self._actions = actions + + self.list = async_to_streamed_response_wrapper( + actions.list, + ) + self.add = async_to_streamed_response_wrapper( + actions.add, + ) + self.remove = async_to_streamed_response_wrapper( + actions.remove, + ) + self.replace = async_to_streamed_response_wrapper( + actions.replace, + ) diff --git a/src/mobilerun_sdk/resources/workflows/flows/flows.py b/src/mobilerun_sdk/resources/workflows/flows/flows.py new file mode 100644 index 0000000..c1acea9 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/flows/flows.py @@ -0,0 +1,836 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Literal + +import httpx + +from .actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import path_template, 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.workflows import flow_list_params, flow_clone_params, flow_create_params, flow_update_params +from ....types.workflows.flow_list_response import FlowListResponse +from ....types.workflows.flow_clone_response import FlowCloneResponse +from ....types.workflows.flow_create_response import FlowCreateResponse +from ....types.workflows.flow_delete_response import FlowDeleteResponse +from ....types.workflows.flow_update_response import FlowUpdateResponse +from ....types.workflows.flow_unblock_response import FlowUnblockResponse +from ....types.workflows.flow_retrieve_response import FlowRetrieveResponse + +__all__ = ["FlowsResource", "AsyncFlowsResource"] + + +class FlowsResource(SyncAPIResource): + @cached_property + def actions(self) -> ActionsResource: + return ActionsResource(self._client) + + @cached_property + def with_raw_response(self) -> FlowsResourceWithRawResponse: + """ + 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 FlowsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlowsResourceWithStreamingResponse: + """ + 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 FlowsResourceWithStreamingResponse(self) + + def create( + self, + *, + actions: Iterable[flow_create_params.Action], + name: str, + trigger_id: str, + cooldown_scope: Literal["flow", "device"] | Omit = omit, + cooldown_seconds: Optional[int] | Omit = omit, + description: str | Omit = omit, + device_ids: SequenceNotStr[str] | Omit = omit, + enabled: bool | Omit = omit, + notify_on_failure: bool | Omit = omit, + notify_on_success: bool | Omit = omit, + notify_webhook_id: Optional[str] | 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, + ) -> FlowCreateResponse: + """ + Create a flow + + 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( + "/flows", + body=maybe_transform( + { + "actions": actions, + "name": name, + "trigger_id": trigger_id, + "cooldown_scope": cooldown_scope, + "cooldown_seconds": cooldown_seconds, + "description": description, + "device_ids": device_ids, + "enabled": enabled, + "notify_on_failure": notify_on_failure, + "notify_on_success": notify_on_success, + "notify_webhook_id": notify_webhook_id, + }, + flow_create_params.FlowCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowCreateResponse, + ) + + def retrieve( + self, + flow_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, + ) -> FlowRetrieveResponse: + """ + Get a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._get( + path_template("/flows/{flow_id}", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowRetrieveResponse, + ) + + def update( + self, + flow_id: str, + *, + cooldown_scope: Literal["flow", "device"] | Omit = omit, + cooldown_seconds: Optional[int] | Omit = omit, + description: str | Omit = omit, + device_ids: SequenceNotStr[str] | Omit = omit, + enabled: bool | Omit = omit, + name: str | Omit = omit, + notify_on_failure: bool | Omit = omit, + notify_on_success: bool | Omit = omit, + notify_webhook_id: Optional[str] | Omit = omit, + trigger_id: str | 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, + ) -> FlowUpdateResponse: + """ + Update a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._patch( + path_template("/flows/{flow_id}", flow_id=flow_id), + body=maybe_transform( + { + "cooldown_scope": cooldown_scope, + "cooldown_seconds": cooldown_seconds, + "description": description, + "device_ids": device_ids, + "enabled": enabled, + "name": name, + "notify_on_failure": notify_on_failure, + "notify_on_success": notify_on_success, + "notify_webhook_id": notify_webhook_id, + "trigger_id": trigger_id, + }, + flow_update_params.FlowUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowUpdateResponse, + ) + + def list( + self, + *, + enabled: Optional[bool] | Omit = omit, + order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | Omit = omit, + status: List[Literal["healthy", "failing", "blocked"]] | Omit = omit, + trigger_id: str | 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, + ) -> FlowListResponse: + """ + List flows + + 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( + "/flows", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "enabled": enabled, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "search": search, + "status": status, + "trigger_id": trigger_id, + }, + flow_list_params.FlowListParams, + ), + ), + cast_to=FlowListResponse, + ) + + def delete( + self, + flow_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, + ) -> FlowDeleteResponse: + """ + Delete a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._delete( + path_template("/flows/{flow_id}", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowDeleteResponse, + ) + + def clone( + self, + flow_id: str, + *, + device_ids: SequenceNotStr[str] | Omit = omit, + name: str | 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, + ) -> FlowCloneResponse: + """ + Clone a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._post( + path_template("/flows/{flow_id}/clone", flow_id=flow_id), + body=maybe_transform( + { + "device_ids": device_ids, + "name": name, + }, + flow_clone_params.FlowCloneParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowCloneResponse, + ) + + def unblock( + self, + flow_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, + ) -> FlowUnblockResponse: + """Clear a flow's blocked status after fixing the underlying issue. + + Idempotent — + safe to call on already-healthy flows. + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return self._post( + path_template("/flows/{flow_id}/unblock", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowUnblockResponse, + ) + + +class AsyncFlowsResource(AsyncAPIResource): + @cached_property + def actions(self) -> AsyncActionsResource: + return AsyncActionsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncFlowsResourceWithRawResponse: + """ + 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 AsyncFlowsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlowsResourceWithStreamingResponse: + """ + 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 AsyncFlowsResourceWithStreamingResponse(self) + + async def create( + self, + *, + actions: Iterable[flow_create_params.Action], + name: str, + trigger_id: str, + cooldown_scope: Literal["flow", "device"] | Omit = omit, + cooldown_seconds: Optional[int] | Omit = omit, + description: str | Omit = omit, + device_ids: SequenceNotStr[str] | Omit = omit, + enabled: bool | Omit = omit, + notify_on_failure: bool | Omit = omit, + notify_on_success: bool | Omit = omit, + notify_webhook_id: Optional[str] | 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, + ) -> FlowCreateResponse: + """ + Create a flow + + 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( + "/flows", + body=await async_maybe_transform( + { + "actions": actions, + "name": name, + "trigger_id": trigger_id, + "cooldown_scope": cooldown_scope, + "cooldown_seconds": cooldown_seconds, + "description": description, + "device_ids": device_ids, + "enabled": enabled, + "notify_on_failure": notify_on_failure, + "notify_on_success": notify_on_success, + "notify_webhook_id": notify_webhook_id, + }, + flow_create_params.FlowCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowCreateResponse, + ) + + async def retrieve( + self, + flow_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, + ) -> FlowRetrieveResponse: + """ + Get a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._get( + path_template("/flows/{flow_id}", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowRetrieveResponse, + ) + + async def update( + self, + flow_id: str, + *, + cooldown_scope: Literal["flow", "device"] | Omit = omit, + cooldown_seconds: Optional[int] | Omit = omit, + description: str | Omit = omit, + device_ids: SequenceNotStr[str] | Omit = omit, + enabled: bool | Omit = omit, + name: str | Omit = omit, + notify_on_failure: bool | Omit = omit, + notify_on_success: bool | Omit = omit, + notify_webhook_id: Optional[str] | Omit = omit, + trigger_id: str | 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, + ) -> FlowUpdateResponse: + """ + Update a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._patch( + path_template("/flows/{flow_id}", flow_id=flow_id), + body=await async_maybe_transform( + { + "cooldown_scope": cooldown_scope, + "cooldown_seconds": cooldown_seconds, + "description": description, + "device_ids": device_ids, + "enabled": enabled, + "name": name, + "notify_on_failure": notify_on_failure, + "notify_on_success": notify_on_success, + "notify_webhook_id": notify_webhook_id, + "trigger_id": trigger_id, + }, + flow_update_params.FlowUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowUpdateResponse, + ) + + async def list( + self, + *, + enabled: Optional[bool] | Omit = omit, + order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | Omit = omit, + status: List[Literal["healthy", "failing", "blocked"]] | Omit = omit, + trigger_id: str | 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, + ) -> FlowListResponse: + """ + List flows + + 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( + "/flows", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "enabled": enabled, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "search": search, + "status": status, + "trigger_id": trigger_id, + }, + flow_list_params.FlowListParams, + ), + ), + cast_to=FlowListResponse, + ) + + async def delete( + self, + flow_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, + ) -> FlowDeleteResponse: + """ + Delete a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._delete( + path_template("/flows/{flow_id}", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowDeleteResponse, + ) + + async def clone( + self, + flow_id: str, + *, + device_ids: SequenceNotStr[str] | Omit = omit, + name: str | 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, + ) -> FlowCloneResponse: + """ + Clone a flow + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._post( + path_template("/flows/{flow_id}/clone", flow_id=flow_id), + body=await async_maybe_transform( + { + "device_ids": device_ids, + "name": name, + }, + flow_clone_params.FlowCloneParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowCloneResponse, + ) + + async def unblock( + self, + flow_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, + ) -> FlowUnblockResponse: + """Clear a flow's blocked status after fixing the underlying issue. + + Idempotent — + safe to call on already-healthy flows. + + 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 flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return await self._post( + path_template("/flows/{flow_id}/unblock", flow_id=flow_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FlowUnblockResponse, + ) + + +class FlowsResourceWithRawResponse: + def __init__(self, flows: FlowsResource) -> None: + self._flows = flows + + self.create = to_raw_response_wrapper( + flows.create, + ) + self.retrieve = to_raw_response_wrapper( + flows.retrieve, + ) + self.update = to_raw_response_wrapper( + flows.update, + ) + self.list = to_raw_response_wrapper( + flows.list, + ) + self.delete = to_raw_response_wrapper( + flows.delete, + ) + self.clone = to_raw_response_wrapper( + flows.clone, + ) + self.unblock = to_raw_response_wrapper( + flows.unblock, + ) + + @cached_property + def actions(self) -> ActionsResourceWithRawResponse: + return ActionsResourceWithRawResponse(self._flows.actions) + + +class AsyncFlowsResourceWithRawResponse: + def __init__(self, flows: AsyncFlowsResource) -> None: + self._flows = flows + + self.create = async_to_raw_response_wrapper( + flows.create, + ) + self.retrieve = async_to_raw_response_wrapper( + flows.retrieve, + ) + self.update = async_to_raw_response_wrapper( + flows.update, + ) + self.list = async_to_raw_response_wrapper( + flows.list, + ) + self.delete = async_to_raw_response_wrapper( + flows.delete, + ) + self.clone = async_to_raw_response_wrapper( + flows.clone, + ) + self.unblock = async_to_raw_response_wrapper( + flows.unblock, + ) + + @cached_property + def actions(self) -> AsyncActionsResourceWithRawResponse: + return AsyncActionsResourceWithRawResponse(self._flows.actions) + + +class FlowsResourceWithStreamingResponse: + def __init__(self, flows: FlowsResource) -> None: + self._flows = flows + + self.create = to_streamed_response_wrapper( + flows.create, + ) + self.retrieve = to_streamed_response_wrapper( + flows.retrieve, + ) + self.update = to_streamed_response_wrapper( + flows.update, + ) + self.list = to_streamed_response_wrapper( + flows.list, + ) + self.delete = to_streamed_response_wrapper( + flows.delete, + ) + self.clone = to_streamed_response_wrapper( + flows.clone, + ) + self.unblock = to_streamed_response_wrapper( + flows.unblock, + ) + + @cached_property + def actions(self) -> ActionsResourceWithStreamingResponse: + return ActionsResourceWithStreamingResponse(self._flows.actions) + + +class AsyncFlowsResourceWithStreamingResponse: + def __init__(self, flows: AsyncFlowsResource) -> None: + self._flows = flows + + self.create = async_to_streamed_response_wrapper( + flows.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + flows.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + flows.update, + ) + self.list = async_to_streamed_response_wrapper( + flows.list, + ) + self.delete = async_to_streamed_response_wrapper( + flows.delete, + ) + self.clone = async_to_streamed_response_wrapper( + flows.clone, + ) + self.unblock = async_to_streamed_response_wrapper( + flows.unblock, + ) + + @cached_property + def actions(self) -> AsyncActionsResourceWithStreamingResponse: + return AsyncActionsResourceWithStreamingResponse(self._flows.actions) diff --git a/src/mobilerun_sdk/resources/workflows/timezones.py b/src/mobilerun_sdk/resources/workflows/timezones.py new file mode 100644 index 0000000..5b7e797 --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/timezones.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +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.workflows.timezone_list_response import TimezoneListResponse + +__all__ = ["TimezonesResource", "AsyncTimezonesResource"] + + +class TimezonesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TimezonesResourceWithRawResponse: + """ + 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 TimezonesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TimezonesResourceWithStreamingResponse: + """ + 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 TimezonesResourceWithStreamingResponse(self) + + def list( + 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, + ) -> TimezoneListResponse: + """List supported IANA timezones""" + return self._get( + "/timezones", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TimezoneListResponse, + ) + + +class AsyncTimezonesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTimezonesResourceWithRawResponse: + """ + 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 AsyncTimezonesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTimezonesResourceWithStreamingResponse: + """ + 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 AsyncTimezonesResourceWithStreamingResponse(self) + + async def list( + 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, + ) -> TimezoneListResponse: + """List supported IANA timezones""" + return await self._get( + "/timezones", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TimezoneListResponse, + ) + + +class TimezonesResourceWithRawResponse: + def __init__(self, timezones: TimezonesResource) -> None: + self._timezones = timezones + + self.list = to_raw_response_wrapper( + timezones.list, + ) + + +class AsyncTimezonesResourceWithRawResponse: + def __init__(self, timezones: AsyncTimezonesResource) -> None: + self._timezones = timezones + + self.list = async_to_raw_response_wrapper( + timezones.list, + ) + + +class TimezonesResourceWithStreamingResponse: + def __init__(self, timezones: TimezonesResource) -> None: + self._timezones = timezones + + self.list = to_streamed_response_wrapper( + timezones.list, + ) + + +class AsyncTimezonesResourceWithStreamingResponse: + def __init__(self, timezones: AsyncTimezonesResource) -> None: + self._timezones = timezones + + self.list = async_to_streamed_response_wrapper( + timezones.list, + ) diff --git a/src/mobilerun_sdk/resources/workflows/triggers.py b/src/mobilerun_sdk/resources/workflows/triggers.py new file mode 100644 index 0000000..b6a1b4c --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/triggers.py @@ -0,0 +1,731 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, 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.workflows import trigger_fire_params, trigger_list_params, trigger_create_params, trigger_update_params +from ...types.workflows.trigger_fire_response import TriggerFireResponse +from ...types.workflows.trigger_list_response import TriggerListResponse +from ...types.workflows.trigger_create_response import TriggerCreateResponse +from ...types.workflows.trigger_delete_response import TriggerDeleteResponse +from ...types.workflows.trigger_update_response import TriggerUpdateResponse +from ...types.workflows.trigger_retrieve_response import TriggerRetrieveResponse + +__all__ = ["TriggersResource", "AsyncTriggersResource"] + + +class TriggersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TriggersResourceWithRawResponse: + """ + 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 TriggersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TriggersResourceWithStreamingResponse: + """ + 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 TriggersResourceWithStreamingResponse(self) + + def create( + self, + *, + activation: Literal["event", "schedule", "custom"], + name: str, + conditions: trigger_create_params.Conditions | Omit = omit, + custom_payload_schema: Dict[str, object] | Omit = omit, + description: str | Omit = omit, + event_type: str | Omit = omit, + schedule_rule: trigger_create_params.ScheduleRule | Omit = omit, + timezone: str | 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, + ) -> TriggerCreateResponse: + """ + Create a trigger + + Args: + custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger + + 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( + "/triggers", + body=maybe_transform( + { + "activation": activation, + "name": name, + "conditions": conditions, + "custom_payload_schema": custom_payload_schema, + "description": description, + "event_type": event_type, + "schedule_rule": schedule_rule, + "timezone": timezone, + }, + trigger_create_params.TriggerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerCreateResponse, + ) + + def retrieve( + self, + trigger_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, + ) -> TriggerRetrieveResponse: + """ + Get a trigger + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return self._get( + path_template("/triggers/{trigger_id}", trigger_id=trigger_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerRetrieveResponse, + ) + + def update( + self, + trigger_id: str, + *, + activation: Literal["event", "schedule", "custom"] | Omit = omit, + conditions: trigger_update_params.Conditions | Omit = omit, + custom_payload_schema: Optional[Dict[str, object]] | Omit = omit, + description: str | Omit = omit, + event_type: str | Omit = omit, + name: str | Omit = omit, + schedule_rule: trigger_update_params.ScheduleRule | Omit = omit, + timezone: Optional[str] | 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, + ) -> TriggerUpdateResponse: + """ + Update a trigger + + Args: + custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return self._patch( + path_template("/triggers/{trigger_id}", trigger_id=trigger_id), + body=maybe_transform( + { + "activation": activation, + "conditions": conditions, + "custom_payload_schema": custom_payload_schema, + "description": description, + "event_type": event_type, + "name": name, + "schedule_rule": schedule_rule, + "timezone": timezone, + }, + trigger_update_params.TriggerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerUpdateResponse, + ) + + def list( + self, + *, + activation: Literal["event", "schedule", "custom"] | Omit = omit, + event_type: str | Omit = omit, + order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | 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, + ) -> TriggerListResponse: + """ + List triggers + + 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( + "/triggers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "activation": activation, + "event_type": event_type, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "search": search, + }, + trigger_list_params.TriggerListParams, + ), + ), + cast_to=TriggerListResponse, + ) + + def delete( + self, + trigger_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, + ) -> TriggerDeleteResponse: + """ + Delete a trigger + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return self._delete( + path_template("/triggers/{trigger_id}", trigger_id=trigger_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerDeleteResponse, + ) + + def fire( + self, + trigger_id: str, + *, + payload: Dict[str, object], + # 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, + ) -> TriggerFireResponse: + """ + Invoke a custom trigger directly with an arbitrary JSON payload. + + Fan-out: a trigger may be referenced by multiple flows (workflows). Firing it + enqueues one execution per enabled, non-deleted flow attached to this trigger, + each receiving the same payload. The `enqueuedCount` in the response reports how + many were enqueued (0 if no flows are attached, or if all matching flows are + gated by a cooldown). + + Payload validation: + + - If the trigger has a `customPayloadSchema`, the payload is validated against + it (JSON Schema via AJV). + - If no schema is configured, the payload only needs to be a JSON object — any + keys and values are accepted. + + Only triggers with `activation = "custom"` can be fired through this endpoint; + event and schedule triggers return 409. + + Args: + payload: Arbitrary JSON object forwarded to every flow attached to this trigger. + Validated against the trigger's customPayloadSchema when one is configured; + otherwise only "must be a JSON object" is enforced. + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return self._post( + path_template("/triggers/{trigger_id}/fire", trigger_id=trigger_id), + body=maybe_transform({"payload": payload}, trigger_fire_params.TriggerFireParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerFireResponse, + ) + + +class AsyncTriggersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTriggersResourceWithRawResponse: + """ + 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 AsyncTriggersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTriggersResourceWithStreamingResponse: + """ + 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 AsyncTriggersResourceWithStreamingResponse(self) + + async def create( + self, + *, + activation: Literal["event", "schedule", "custom"], + name: str, + conditions: trigger_create_params.Conditions | Omit = omit, + custom_payload_schema: Dict[str, object] | Omit = omit, + description: str | Omit = omit, + event_type: str | Omit = omit, + schedule_rule: trigger_create_params.ScheduleRule | Omit = omit, + timezone: str | 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, + ) -> TriggerCreateResponse: + """ + Create a trigger + + Args: + custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger + + 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( + "/triggers", + body=await async_maybe_transform( + { + "activation": activation, + "name": name, + "conditions": conditions, + "custom_payload_schema": custom_payload_schema, + "description": description, + "event_type": event_type, + "schedule_rule": schedule_rule, + "timezone": timezone, + }, + trigger_create_params.TriggerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerCreateResponse, + ) + + async def retrieve( + self, + trigger_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, + ) -> TriggerRetrieveResponse: + """ + Get a trigger + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return await self._get( + path_template("/triggers/{trigger_id}", trigger_id=trigger_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerRetrieveResponse, + ) + + async def update( + self, + trigger_id: str, + *, + activation: Literal["event", "schedule", "custom"] | Omit = omit, + conditions: trigger_update_params.Conditions | Omit = omit, + custom_payload_schema: Optional[Dict[str, object]] | Omit = omit, + description: str | Omit = omit, + event_type: str | Omit = omit, + name: str | Omit = omit, + schedule_rule: trigger_update_params.ScheduleRule | Omit = omit, + timezone: Optional[str] | 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, + ) -> TriggerUpdateResponse: + """ + Update a trigger + + Args: + custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return await self._patch( + path_template("/triggers/{trigger_id}", trigger_id=trigger_id), + body=await async_maybe_transform( + { + "activation": activation, + "conditions": conditions, + "custom_payload_schema": custom_payload_schema, + "description": description, + "event_type": event_type, + "name": name, + "schedule_rule": schedule_rule, + "timezone": timezone, + }, + trigger_update_params.TriggerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerUpdateResponse, + ) + + async def list( + self, + *, + activation: Literal["event", "schedule", "custom"] | Omit = omit, + event_type: str | Omit = omit, + order_by: Literal["name", "createdAt", "updatedAt"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, + page: int | Omit = omit, + page_size: int | Omit = omit, + search: str | 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, + ) -> TriggerListResponse: + """ + List triggers + + 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( + "/triggers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "activation": activation, + "event_type": event_type, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + "search": search, + }, + trigger_list_params.TriggerListParams, + ), + ), + cast_to=TriggerListResponse, + ) + + async def delete( + self, + trigger_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, + ) -> TriggerDeleteResponse: + """ + Delete a trigger + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return await self._delete( + path_template("/triggers/{trigger_id}", trigger_id=trigger_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerDeleteResponse, + ) + + async def fire( + self, + trigger_id: str, + *, + payload: Dict[str, object], + # 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, + ) -> TriggerFireResponse: + """ + Invoke a custom trigger directly with an arbitrary JSON payload. + + Fan-out: a trigger may be referenced by multiple flows (workflows). Firing it + enqueues one execution per enabled, non-deleted flow attached to this trigger, + each receiving the same payload. The `enqueuedCount` in the response reports how + many were enqueued (0 if no flows are attached, or if all matching flows are + gated by a cooldown). + + Payload validation: + + - If the trigger has a `customPayloadSchema`, the payload is validated against + it (JSON Schema via AJV). + - If no schema is configured, the payload only needs to be a JSON object — any + keys and values are accepted. + + Only triggers with `activation = "custom"` can be fired through this endpoint; + event and schedule triggers return 409. + + Args: + payload: Arbitrary JSON object forwarded to every flow attached to this trigger. + Validated against the trigger's customPayloadSchema when one is configured; + otherwise only "must be a JSON object" is enforced. + + 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 trigger_id: + raise ValueError(f"Expected a non-empty value for `trigger_id` but received {trigger_id!r}") + return await self._post( + path_template("/triggers/{trigger_id}/fire", trigger_id=trigger_id), + body=await async_maybe_transform({"payload": payload}, trigger_fire_params.TriggerFireParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TriggerFireResponse, + ) + + +class TriggersResourceWithRawResponse: + def __init__(self, triggers: TriggersResource) -> None: + self._triggers = triggers + + self.create = to_raw_response_wrapper( + triggers.create, + ) + self.retrieve = to_raw_response_wrapper( + triggers.retrieve, + ) + self.update = to_raw_response_wrapper( + triggers.update, + ) + self.list = to_raw_response_wrapper( + triggers.list, + ) + self.delete = to_raw_response_wrapper( + triggers.delete, + ) + self.fire = to_raw_response_wrapper( + triggers.fire, + ) + + +class AsyncTriggersResourceWithRawResponse: + def __init__(self, triggers: AsyncTriggersResource) -> None: + self._triggers = triggers + + self.create = async_to_raw_response_wrapper( + triggers.create, + ) + self.retrieve = async_to_raw_response_wrapper( + triggers.retrieve, + ) + self.update = async_to_raw_response_wrapper( + triggers.update, + ) + self.list = async_to_raw_response_wrapper( + triggers.list, + ) + self.delete = async_to_raw_response_wrapper( + triggers.delete, + ) + self.fire = async_to_raw_response_wrapper( + triggers.fire, + ) + + +class TriggersResourceWithStreamingResponse: + def __init__(self, triggers: TriggersResource) -> None: + self._triggers = triggers + + self.create = to_streamed_response_wrapper( + triggers.create, + ) + self.retrieve = to_streamed_response_wrapper( + triggers.retrieve, + ) + self.update = to_streamed_response_wrapper( + triggers.update, + ) + self.list = to_streamed_response_wrapper( + triggers.list, + ) + self.delete = to_streamed_response_wrapper( + triggers.delete, + ) + self.fire = to_streamed_response_wrapper( + triggers.fire, + ) + + +class AsyncTriggersResourceWithStreamingResponse: + def __init__(self, triggers: AsyncTriggersResource) -> None: + self._triggers = triggers + + self.create = async_to_streamed_response_wrapper( + triggers.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + triggers.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + triggers.update, + ) + self.list = async_to_streamed_response_wrapper( + triggers.list, + ) + self.delete = async_to_streamed_response_wrapper( + triggers.delete, + ) + self.fire = async_to_streamed_response_wrapper( + triggers.fire, + ) diff --git a/src/mobilerun_sdk/resources/workflows/workflows.py b/src/mobilerun_sdk/resources/workflows/workflows.py new file mode 100644 index 0000000..000d4bf --- /dev/null +++ b/src/mobilerun_sdk/resources/workflows/workflows.py @@ -0,0 +1,294 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .triggers import ( + TriggersResource, + AsyncTriggersResource, + TriggersResourceWithRawResponse, + AsyncTriggersResourceWithRawResponse, + TriggersResourceWithStreamingResponse, + AsyncTriggersResourceWithStreamingResponse, +) +from ..._compat import cached_property +from .timezones import ( + TimezonesResource, + AsyncTimezonesResource, + TimezonesResourceWithRawResponse, + AsyncTimezonesResourceWithRawResponse, + TimezonesResourceWithStreamingResponse, + AsyncTimezonesResourceWithStreamingResponse, +) +from .executions import ( + ExecutionsResource, + AsyncExecutionsResource, + ExecutionsResourceWithRawResponse, + AsyncExecutionsResourceWithRawResponse, + ExecutionsResourceWithStreamingResponse, + AsyncExecutionsResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from .flows.flows import ( + FlowsResource, + AsyncFlowsResource, + FlowsResourceWithRawResponse, + AsyncFlowsResourceWithRawResponse, + FlowsResourceWithStreamingResponse, + AsyncFlowsResourceWithStreamingResponse, +) +from .action_catalog import ( + ActionCatalogResource, + AsyncActionCatalogResource, + ActionCatalogResourceWithRawResponse, + AsyncActionCatalogResourceWithRawResponse, + ActionCatalogResourceWithStreamingResponse, + AsyncActionCatalogResourceWithStreamingResponse, +) +from .actions.actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) + +__all__ = ["WorkflowsResource", "AsyncWorkflowsResource"] + + +class WorkflowsResource(SyncAPIResource): + @cached_property + def triggers(self) -> TriggersResource: + return TriggersResource(self._client) + + @cached_property + def action_catalog(self) -> ActionCatalogResource: + return ActionCatalogResource(self._client) + + @cached_property + def actions(self) -> ActionsResource: + return ActionsResource(self._client) + + @cached_property + def flows(self) -> FlowsResource: + return FlowsResource(self._client) + + @cached_property + def events(self) -> EventsResource: + return EventsResource(self._client) + + @cached_property + def executions(self) -> ExecutionsResource: + return ExecutionsResource(self._client) + + @cached_property + def timezones(self) -> TimezonesResource: + return TimezonesResource(self._client) + + @cached_property + def with_raw_response(self) -> WorkflowsResourceWithRawResponse: + """ + 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 WorkflowsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> WorkflowsResourceWithStreamingResponse: + """ + 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 WorkflowsResourceWithStreamingResponse(self) + + +class AsyncWorkflowsResource(AsyncAPIResource): + @cached_property + def triggers(self) -> AsyncTriggersResource: + return AsyncTriggersResource(self._client) + + @cached_property + def action_catalog(self) -> AsyncActionCatalogResource: + return AsyncActionCatalogResource(self._client) + + @cached_property + def actions(self) -> AsyncActionsResource: + return AsyncActionsResource(self._client) + + @cached_property + def flows(self) -> AsyncFlowsResource: + return AsyncFlowsResource(self._client) + + @cached_property + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) + + @cached_property + def executions(self) -> AsyncExecutionsResource: + return AsyncExecutionsResource(self._client) + + @cached_property + def timezones(self) -> AsyncTimezonesResource: + return AsyncTimezonesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncWorkflowsResourceWithRawResponse: + """ + 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 AsyncWorkflowsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncWorkflowsResourceWithStreamingResponse: + """ + 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 AsyncWorkflowsResourceWithStreamingResponse(self) + + +class WorkflowsResourceWithRawResponse: + def __init__(self, workflows: WorkflowsResource) -> None: + self._workflows = workflows + + @cached_property + def triggers(self) -> TriggersResourceWithRawResponse: + return TriggersResourceWithRawResponse(self._workflows.triggers) + + @cached_property + def action_catalog(self) -> ActionCatalogResourceWithRawResponse: + return ActionCatalogResourceWithRawResponse(self._workflows.action_catalog) + + @cached_property + def actions(self) -> ActionsResourceWithRawResponse: + return ActionsResourceWithRawResponse(self._workflows.actions) + + @cached_property + def flows(self) -> FlowsResourceWithRawResponse: + return FlowsResourceWithRawResponse(self._workflows.flows) + + @cached_property + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._workflows.events) + + @cached_property + def executions(self) -> ExecutionsResourceWithRawResponse: + return ExecutionsResourceWithRawResponse(self._workflows.executions) + + @cached_property + def timezones(self) -> TimezonesResourceWithRawResponse: + return TimezonesResourceWithRawResponse(self._workflows.timezones) + + +class AsyncWorkflowsResourceWithRawResponse: + def __init__(self, workflows: AsyncWorkflowsResource) -> None: + self._workflows = workflows + + @cached_property + def triggers(self) -> AsyncTriggersResourceWithRawResponse: + return AsyncTriggersResourceWithRawResponse(self._workflows.triggers) + + @cached_property + def action_catalog(self) -> AsyncActionCatalogResourceWithRawResponse: + return AsyncActionCatalogResourceWithRawResponse(self._workflows.action_catalog) + + @cached_property + def actions(self) -> AsyncActionsResourceWithRawResponse: + return AsyncActionsResourceWithRawResponse(self._workflows.actions) + + @cached_property + def flows(self) -> AsyncFlowsResourceWithRawResponse: + return AsyncFlowsResourceWithRawResponse(self._workflows.flows) + + @cached_property + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._workflows.events) + + @cached_property + def executions(self) -> AsyncExecutionsResourceWithRawResponse: + return AsyncExecutionsResourceWithRawResponse(self._workflows.executions) + + @cached_property + def timezones(self) -> AsyncTimezonesResourceWithRawResponse: + return AsyncTimezonesResourceWithRawResponse(self._workflows.timezones) + + +class WorkflowsResourceWithStreamingResponse: + def __init__(self, workflows: WorkflowsResource) -> None: + self._workflows = workflows + + @cached_property + def triggers(self) -> TriggersResourceWithStreamingResponse: + return TriggersResourceWithStreamingResponse(self._workflows.triggers) + + @cached_property + def action_catalog(self) -> ActionCatalogResourceWithStreamingResponse: + return ActionCatalogResourceWithStreamingResponse(self._workflows.action_catalog) + + @cached_property + def actions(self) -> ActionsResourceWithStreamingResponse: + return ActionsResourceWithStreamingResponse(self._workflows.actions) + + @cached_property + def flows(self) -> FlowsResourceWithStreamingResponse: + return FlowsResourceWithStreamingResponse(self._workflows.flows) + + @cached_property + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._workflows.events) + + @cached_property + def executions(self) -> ExecutionsResourceWithStreamingResponse: + return ExecutionsResourceWithStreamingResponse(self._workflows.executions) + + @cached_property + def timezones(self) -> TimezonesResourceWithStreamingResponse: + return TimezonesResourceWithStreamingResponse(self._workflows.timezones) + + +class AsyncWorkflowsResourceWithStreamingResponse: + def __init__(self, workflows: AsyncWorkflowsResource) -> None: + self._workflows = workflows + + @cached_property + def triggers(self) -> AsyncTriggersResourceWithStreamingResponse: + return AsyncTriggersResourceWithStreamingResponse(self._workflows.triggers) + + @cached_property + def action_catalog(self) -> AsyncActionCatalogResourceWithStreamingResponse: + return AsyncActionCatalogResourceWithStreamingResponse(self._workflows.action_catalog) + + @cached_property + def actions(self) -> AsyncActionsResourceWithStreamingResponse: + return AsyncActionsResourceWithStreamingResponse(self._workflows.actions) + + @cached_property + def flows(self) -> AsyncFlowsResourceWithStreamingResponse: + return AsyncFlowsResourceWithStreamingResponse(self._workflows.flows) + + @cached_property + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._workflows.events) + + @cached_property + def executions(self) -> AsyncExecutionsResourceWithStreamingResponse: + return AsyncExecutionsResourceWithStreamingResponse(self._workflows.executions) + + @cached_property + def timezones(self) -> AsyncTimezonesResourceWithStreamingResponse: + return AsyncTimezonesResourceWithStreamingResponse(self._workflows.timezones) diff --git a/src/mobilerun_sdk/types/__init__.py b/src/mobilerun_sdk/types/__init__.py index 191a66a..ecf96d9 100644 --- a/src/mobilerun_sdk/types/__init__.py +++ b/src/mobilerun_sdk/types/__init__.py @@ -4,6 +4,7 @@ from . import devices from .. import _compat +from .flow import Flow as Flow from .task import Task as Task from .device import Device as Device from .shared import ( diff --git a/src/mobilerun_sdk/types/flow.py b/src/mobilerun_sdk/types/flow.py new file mode 100644 index 0000000..6457f9d --- /dev/null +++ b/src/mobilerun_sdk/types/flow.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["Flow"] + + +class Flow(BaseModel): + id: str + + blocked_at: Optional[str] = FieldInfo(alias="blockedAt", default=None) + + consecutive_failures: int = FieldInfo(alias="consecutiveFailures") + + cooldown_scope: Literal["flow", "device"] = FieldInfo(alias="cooldownScope") + + cooldown_seconds: Optional[int] = FieldInfo(alias="cooldownSeconds", default=None) + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + description: Optional[str] = None + + device_ids: List[str] = FieldInfo(alias="deviceIds") + + enabled: bool + + last_failure_at: Optional[str] = FieldInfo(alias="lastFailureAt", default=None) + + last_failure_code: Optional[ + Literal["device_not_found", "permission_denied", "client_error", "transient", "logic", "invalid_config"] + ] = FieldInfo(alias="lastFailureCode", default=None) + + last_triggered_at: Optional[str] = FieldInfo(alias="lastTriggeredAt", default=None) + + name: str + + notify_on_failure: bool = FieldInfo(alias="notifyOnFailure") + + notify_on_success: bool = FieldInfo(alias="notifyOnSuccess") + + notify_webhook_id: Optional[str] = FieldInfo(alias="notifyWebhookId", default=None) + + status: Literal["healthy", "failing", "blocked"] + + trigger_id: str = FieldInfo(alias="triggerId") + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + user_id: str = FieldInfo(alias="userId") diff --git a/src/mobilerun_sdk/types/workflows/__init__.py b/src/mobilerun_sdk/types/workflows/__init__.py index f8ee8b1..860c6eb 100644 --- a/src/mobilerun_sdk/types/workflows/__init__.py +++ b/src/mobilerun_sdk/types/workflows/__init__.py @@ -1,3 +1,51 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .action import Action as Action +from .flow_execution import FlowExecution as FlowExecution +from .flow_list_params import FlowListParams as FlowListParams +from .flow_clone_params import FlowCloneParams as FlowCloneParams +from .action_list_params import ActionListParams as ActionListParams +from .flow_create_params import FlowCreateParams as FlowCreateParams +from .flow_list_response import FlowListResponse as FlowListResponse +from .flow_update_params import FlowUpdateParams as FlowUpdateParams +from .event_ingest_params import EventIngestParams as EventIngestParams +from .flow_clone_response import FlowCloneResponse as FlowCloneResponse +from .trigger_fire_params import TriggerFireParams as TriggerFireParams +from .trigger_list_params import TriggerListParams as TriggerListParams +from .action_catalog_entry import ActionCatalogEntry as ActionCatalogEntry +from .action_create_params import ActionCreateParams as ActionCreateParams +from .action_list_response import ActionListResponse as ActionListResponse +from .action_update_params import ActionUpdateParams as ActionUpdateParams +from .event_dry_run_params import EventDryRunParams as EventDryRunParams +from .flow_create_response import FlowCreateResponse as FlowCreateResponse +from .flow_delete_response import FlowDeleteResponse as FlowDeleteResponse +from .flow_update_response import FlowUpdateResponse as FlowUpdateResponse +from .event_ingest_response import EventIngestResponse as EventIngestResponse +from .execution_list_params import ExecutionListParams as ExecutionListParams +from .flow_unblock_response import FlowUnblockResponse as FlowUnblockResponse +from .trigger_create_params import TriggerCreateParams as TriggerCreateParams +from .trigger_fire_response import TriggerFireResponse as TriggerFireResponse +from .trigger_list_response import TriggerListResponse as TriggerListResponse +from .trigger_update_params import TriggerUpdateParams as TriggerUpdateParams +from .action_create_response import ActionCreateResponse as ActionCreateResponse +from .action_delete_response import ActionDeleteResponse as ActionDeleteResponse +from .action_update_response import ActionUpdateResponse as ActionUpdateResponse +from .event_dry_run_response import EventDryRunResponse as EventDryRunResponse +from .flow_retrieve_response import FlowRetrieveResponse as FlowRetrieveResponse +from .timezone_list_response import TimezoneListResponse as TimezoneListResponse +from .execution_list_response import ExecutionListResponse as ExecutionListResponse +from .trigger_create_response import TriggerCreateResponse as TriggerCreateResponse +from .trigger_delete_response import TriggerDeleteResponse as TriggerDeleteResponse +from .trigger_update_response import TriggerUpdateResponse as TriggerUpdateResponse +from .action_retrieve_response import ActionRetrieveResponse as ActionRetrieveResponse +from .trigger_retrieve_response import TriggerRetrieveResponse as TriggerRetrieveResponse +from .action_catalog_list_params import ActionCatalogListParams as ActionCatalogListParams +from .execution_retrieve_response import ExecutionRetrieveResponse as ExecutionRetrieveResponse +from .flow_action_overrides_param import FlowActionOverridesParam as FlowActionOverridesParam +from .action_catalog_list_response import ActionCatalogListResponse as ActionCatalogListResponse +from .execution_get_metrics_params import ExecutionGetMetricsParams as ExecutionGetMetricsParams +from .flow_child_action_input_param import FlowChildActionInputParam as FlowChildActionInputParam +from .execution_get_metrics_response import ExecutionGetMetricsResponse as ExecutionGetMetricsResponse +from .action_catalog_retrieve_response import ActionCatalogRetrieveResponse as ActionCatalogRetrieveResponse diff --git a/src/mobilerun_sdk/types/workflows/action.py b/src/mobilerun_sdk/types/workflows/action.py new file mode 100644 index 0000000..1b85a3f --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["Action"] + + +class Action(BaseModel): + id: str + + catalog_entry_id: str = FieldInfo(alias="catalogEntryId") + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + description: Optional[str] = None + + method: str + + name: str + + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + user_id: str = FieldInfo(alias="userId") + + params: Optional[object] = None + + params_schema: Optional[object] = FieldInfo(alias="paramsSchema", default=None) diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_entry.py b/src/mobilerun_sdk/types/workflows/action_catalog_entry.py new file mode 100644 index 0000000..5e6278c --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_catalog_entry.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ActionCatalogEntry"] + + +class ActionCatalogEntry(BaseModel): + id: str + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + description: Optional[str] = None + + method: str + + name: str + + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + params_schema: Optional[object] = FieldInfo(alias="paramsSchema", default=None) diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_list_params.py b/src/mobilerun_sdk/types/workflows/action_catalog_list_params.py new file mode 100644 index 0000000..4e756a9 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_catalog_list_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 Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ActionCatalogListParams"] + + +class ActionCatalogListParams(TypedDict, total=False): + page: int + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_list_response.py b/src/mobilerun_sdk/types/workflows/action_catalog_list_response.py new file mode 100644 index 0000000..967cfd0 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_catalog_list_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from ..shared.pagination import Pagination +from .action_catalog_entry import ActionCatalogEntry + +__all__ = ["ActionCatalogListResponse"] + + +class ActionCatalogListResponse(BaseModel): + items: List[ActionCatalogEntry] + + pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py b/src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py new file mode 100644 index 0000000..81d1b5f --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_catalog_retrieve_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .action_catalog_entry import ActionCatalogEntry + +__all__ = ["ActionCatalogRetrieveResponse"] + + +class ActionCatalogRetrieveResponse(BaseModel): + data: ActionCatalogEntry diff --git a/src/mobilerun_sdk/types/workflows/action_create_params.py b/src/mobilerun_sdk/types/workflows/action_create_params.py new file mode 100644 index 0000000..b85ffed --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_create_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ActionCreateParams"] + + +class ActionCreateParams(TypedDict, total=False): + catalog_entry_id: Required[Annotated[str, PropertyInfo(alias="catalogEntryId")]] + + name: Required[str] + + description: str + + params: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/action_create_response.py b/src/mobilerun_sdk/types/workflows/action_create_response.py new file mode 100644 index 0000000..acd7aa5 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_create_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .action import Action +from ..._models import BaseModel + +__all__ = ["ActionCreateResponse"] + + +class ActionCreateResponse(BaseModel): + data: Action diff --git a/src/mobilerun_sdk/types/workflows/action_delete_response.py b/src/mobilerun_sdk/types/workflows/action_delete_response.py new file mode 100644 index 0000000..157bb1f --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_delete_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ActionDeleteResponse"] + + +class ActionDeleteResponse(BaseModel): + message: str diff --git a/src/mobilerun_sdk/types/workflows/action_list_params.py b/src/mobilerun_sdk/types/workflows/action_list_params.py new file mode 100644 index 0000000..9873843 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_list_params.py @@ -0,0 +1,23 @@ +# 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__ = ["ActionListParams"] + + +class ActionListParams(TypedDict, total=False): + order_by: Annotated[Literal["name", "createdAt", "updatedAt"], PropertyInfo(alias="orderBy")] + + order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] + + page: int + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + search: str + + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] diff --git a/src/mobilerun_sdk/types/workflows/action_list_response.py b/src/mobilerun_sdk/types/workflows/action_list_response.py new file mode 100644 index 0000000..2d5e996 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_list_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .action import Action +from ..._models import BaseModel +from ..shared.pagination import Pagination + +__all__ = ["ActionListResponse"] + + +class ActionListResponse(BaseModel): + items: List[Action] + + pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/action_retrieve_response.py b/src/mobilerun_sdk/types/workflows/action_retrieve_response.py new file mode 100644 index 0000000..7dc33b0 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_retrieve_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .action import Action +from ..._models import BaseModel + +__all__ = ["ActionRetrieveResponse"] + + +class ActionRetrieveResponse(BaseModel): + data: Action diff --git a/src/mobilerun_sdk/types/workflows/action_update_params.py b/src/mobilerun_sdk/types/workflows/action_update_params.py new file mode 100644 index 0000000..4644bac --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_update_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +__all__ = ["ActionUpdateParams"] + + +class ActionUpdateParams(TypedDict, total=False): + description: str + + name: str + + params: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/action_update_response.py b/src/mobilerun_sdk/types/workflows/action_update_response.py new file mode 100644 index 0000000..4d6b872 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/action_update_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .action import Action +from ..._models import BaseModel + +__all__ = ["ActionUpdateResponse"] + + +class ActionUpdateResponse(BaseModel): + data: Action diff --git a/src/mobilerun_sdk/types/workflows/actions/__init__.py b/src/mobilerun_sdk/types/workflows/actions/__init__.py index f8ee8b1..57284e5 100644 --- a/src/mobilerun_sdk/types/workflows/actions/__init__.py +++ b/src/mobilerun_sdk/types/workflows/actions/__init__.py @@ -1,3 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .service_list_response import ServiceListResponse as ServiceListResponse +from .service_list_methods_response import ServiceListMethodsResponse as ServiceListMethodsResponse diff --git a/src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py b/src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py new file mode 100644 index 0000000..95cff7a --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/actions/service_list_methods_response.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ServiceListMethodsResponse", "Data", "DataParam"] + + +class DataParam(BaseModel): + description: str + + name: str + + required: bool + + type: Literal["string", "number", "boolean", "object", "array"] + + default: Optional[object] = None + + example: Optional[object] = None + + +class Data(BaseModel): + method: str + + params: List[DataParam] + + +class ServiceListMethodsResponse(BaseModel): + data: List[Data] diff --git a/src/mobilerun_sdk/types/workflows/actions/service_list_response.py b/src/mobilerun_sdk/types/workflows/actions/service_list_response.py new file mode 100644 index 0000000..e8e712c --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/actions/service_list_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel + +__all__ = ["ServiceListResponse"] + + +class ServiceListResponse(BaseModel): + data: List[str] diff --git a/src/mobilerun_sdk/types/workflows/event_dry_run_params.py b/src/mobilerun_sdk/types/workflows/event_dry_run_params.py new file mode 100644 index 0000000..c55498e --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/event_dry_run_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["EventDryRunParams"] + + +class EventDryRunParams(TypedDict, total=False): + event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] + + device_id: Annotated[str, PropertyInfo(alias="deviceId")] + + payload: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/event_dry_run_response.py b/src/mobilerun_sdk/types/workflows/event_dry_run_response.py new file mode 100644 index 0000000..b1c8264 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/event_dry_run_response.py @@ -0,0 +1,126 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..flow import Flow +from ..._models import BaseModel + +__all__ = [ + "EventDryRunResponse", + "Data", + "DataMatchedFlow", + "DataMatchedFlowAction", + "DataMatchedFlowGates", + "DataMatchedFlowTrigger", + "DataMatchedFlowTriggerScheduleRule", + "DataValidation", + "DataValidationError", +] + + +class DataMatchedFlowAction(BaseModel): + continue_on_error: bool = FieldInfo(alias="continueOnError") + + method: str + + name: str + + service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] + + children: Optional[List[Optional[object]]] = None + """ + Nested child actions (loop/branch bodies), each the same shape as a + ResolvedAction. + """ + + params: Optional[Dict[str, Optional[object]]] = None + + +class DataMatchedFlowGates(BaseModel): + blocked: bool + + cooldown_active: Optional[bool] = FieldInfo(alias="cooldownActive", default=None) + + device_attached: bool = FieldInfo(alias="deviceAttached") + + device_ids: List[str] = FieldInfo(alias="deviceIds") + + enabled: bool + + +class DataMatchedFlowTriggerScheduleRule(BaseModel): + type: Literal["once", "cron", "recurring"] + + date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) + """ISO 8601 datetime (for type=once)""" + + expression: Optional[str] = None + """Cron expression (for type=cron)""" + + rrule: Optional[str] = None + """RRULE string (for type=recurring)""" + + +class DataMatchedFlowTrigger(BaseModel): + id: str + + activation: Literal["event", "schedule", "custom"] + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) + + description: Optional[str] = None + + event_type: Optional[str] = FieldInfo(alias="eventType", default=None) + + name: str + + schedule_rule: Optional[DataMatchedFlowTriggerScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + + timezone: Optional[str] = None + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + user_id: str = FieldInfo(alias="userId") + + conditions: Optional[object] = None + + next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) + + +class DataMatchedFlow(BaseModel): + actions: List[DataMatchedFlowAction] + + flow: Flow + + gates: DataMatchedFlowGates + + trigger: DataMatchedFlowTrigger + + would_fire: bool = FieldInfo(alias="wouldFire") + + +class DataValidationError(BaseModel): + field: str + + message: str + + +class DataValidation(BaseModel): + valid: bool + + errors: Optional[List[DataValidationError]] = None + + +class Data(BaseModel): + matched_flows: List[DataMatchedFlow] = FieldInfo(alias="matchedFlows") + + validation: DataValidation + + +class EventDryRunResponse(BaseModel): + data: Data diff --git a/src/mobilerun_sdk/types/workflows/event_ingest_params.py b/src/mobilerun_sdk/types/workflows/event_ingest_params.py new file mode 100644 index 0000000..d8edf19 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/event_ingest_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["EventIngestParams"] + + +class EventIngestParams(TypedDict, total=False): + event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] + + device_id: Annotated[str, PropertyInfo(alias="deviceId")] + + payload: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/event_ingest_response.py b/src/mobilerun_sdk/types/workflows/event_ingest_response.py new file mode 100644 index 0000000..6136565 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/event_ingest_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["EventIngestResponse"] + + +class EventIngestResponse(BaseModel): + event_id: str = FieldInfo(alias="eventId") diff --git a/src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py b/src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py new file mode 100644 index 0000000..b5d8cda --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/execution_get_metrics_params.py @@ -0,0 +1,20 @@ +# 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 Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ExecutionGetMetricsParams"] + + +class ExecutionGetMetricsParams(TypedDict, total=False): + flow_id: Annotated[str, PropertyInfo(alias="flowId")] + + from_: Annotated[Optional[str], PropertyInfo(alias="from")] + + to: Optional[str] + + trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py b/src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py new file mode 100644 index 0000000..cb796ac --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/execution_get_metrics_response.py @@ -0,0 +1,39 @@ +# 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__ = ["ExecutionGetMetricsResponse", "Data", "DataByStatus"] + + +class DataByStatus(BaseModel): + cancelled: int + + failed: int + + invalid: int + + pending: int + + running: int + + skipped: int + + success: int + + +class Data(BaseModel): + avg_duration_ms: Optional[float] = FieldInfo(alias="avgDurationMs", default=None) + + by_status: DataByStatus = FieldInfo(alias="byStatus") + + last_execution_at: Optional[str] = FieldInfo(alias="lastExecutionAt", default=None) + + total: int + + +class ExecutionGetMetricsResponse(BaseModel): + data: Data diff --git a/src/mobilerun_sdk/types/workflows/execution_list_params.py b/src/mobilerun_sdk/types/workflows/execution_list_params.py new file mode 100644 index 0000000..ccc40d4 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/execution_list_params.py @@ -0,0 +1,32 @@ +# 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, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ExecutionListParams"] + + +class ExecutionListParams(TypedDict, total=False): + flow_id: Annotated[str, PropertyInfo(alias="flowId")] + + from_: Annotated[Optional[str], PropertyInfo(alias="from")] + + order_by: Annotated[Literal["startedAt", "finishedAt", "status"], PropertyInfo(alias="orderBy")] + + order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] + + page: int + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + search: str + + status: Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"] + + to: Optional[str] + + trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/execution_list_response.py b/src/mobilerun_sdk/types/workflows/execution_list_response.py new file mode 100644 index 0000000..eddf7b3 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/execution_list_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .flow_execution import FlowExecution +from ..shared.pagination import Pagination + +__all__ = ["ExecutionListResponse"] + + +class ExecutionListResponse(BaseModel): + items: List[FlowExecution] + + pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/execution_retrieve_response.py b/src/mobilerun_sdk/types/workflows/execution_retrieve_response.py new file mode 100644 index 0000000..6892a2e --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/execution_retrieve_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .flow_execution import FlowExecution + +__all__ = ["ExecutionRetrieveResponse"] + + +class ExecutionRetrieveResponse(BaseModel): + data: FlowExecution diff --git a/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py b/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py new file mode 100644 index 0000000..5f03d3a --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +__all__ = ["FlowActionOverridesParam"] + + +class FlowActionOverridesParam(TypedDict, total=False): + params: Dict[str, Optional[object]] diff --git a/src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py b/src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py new file mode 100644 index 0000000..a201a30 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_child_action_input_param.py @@ -0,0 +1,23 @@ +# 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 Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from .flow_action_overrides_param import FlowActionOverridesParam + +__all__ = ["FlowChildActionInputParam"] + + +class FlowChildActionInputParam(TypedDict, total=False): + action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] + + position: Required[int] + + continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] + + name_override: Annotated[str, PropertyInfo(alias="nameOverride")] + + overrides: Optional[FlowActionOverridesParam] diff --git a/src/mobilerun_sdk/types/workflows/flow_clone_params.py b/src/mobilerun_sdk/types/workflows/flow_clone_params.py new file mode 100644 index 0000000..c38a149 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_clone_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["FlowCloneParams"] + + +class FlowCloneParams(TypedDict, total=False): + device_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="deviceIds")] + + name: str diff --git a/src/mobilerun_sdk/types/workflows/flow_clone_response.py b/src/mobilerun_sdk/types/workflows/flow_clone_response.py new file mode 100644 index 0000000..57a8637 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_clone_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..flow import Flow +from ..._models import BaseModel + +__all__ = ["FlowCloneResponse"] + + +class FlowCloneResponse(BaseModel): + data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_create_params.py b/src/mobilerun_sdk/types/workflows/flow_create_params.py new file mode 100644 index 0000000..464086f --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_create_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo +from .flow_action_overrides_param import FlowActionOverridesParam +from .flow_child_action_input_param import FlowChildActionInputParam + +__all__ = ["FlowCreateParams", "Action"] + + +class FlowCreateParams(TypedDict, total=False): + actions: Required[Iterable[Action]] + + name: Required[str] + + trigger_id: Required[Annotated[str, PropertyInfo(alias="triggerId")]] + + cooldown_scope: Annotated[Literal["flow", "device"], PropertyInfo(alias="cooldownScope")] + + cooldown_seconds: Annotated[Optional[int], PropertyInfo(alias="cooldownSeconds")] + + description: str + + device_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="deviceIds")] + + enabled: bool + + notify_on_failure: Annotated[bool, PropertyInfo(alias="notifyOnFailure")] + + notify_on_success: Annotated[bool, PropertyInfo(alias="notifyOnSuccess")] + + notify_webhook_id: Annotated[Optional[str], PropertyInfo(alias="notifyWebhookId")] + + +class Action(TypedDict, total=False): + action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] + + position: Required[int] + + children: Iterable[FlowChildActionInputParam] + + continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] + + name_override: Annotated[str, PropertyInfo(alias="nameOverride")] + + overrides: Optional[FlowActionOverridesParam] diff --git a/src/mobilerun_sdk/types/workflows/flow_create_response.py b/src/mobilerun_sdk/types/workflows/flow_create_response.py new file mode 100644 index 0000000..f9c5fea --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_create_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..flow import Flow +from ..._models import BaseModel + +__all__ = ["FlowCreateResponse"] + + +class FlowCreateResponse(BaseModel): + data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_delete_response.py b/src/mobilerun_sdk/types/workflows/flow_delete_response.py new file mode 100644 index 0000000..a6243e6 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_delete_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["FlowDeleteResponse"] + + +class FlowDeleteResponse(BaseModel): + message: str diff --git a/src/mobilerun_sdk/types/workflows/flow_execution.py b/src/mobilerun_sdk/types/workflows/flow_execution.py new file mode 100644 index 0000000..96782d6 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_execution.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["FlowExecution"] + + +class FlowExecution(BaseModel): + id: str + + error: Optional[str] = None + + event_id: Optional[str] = FieldInfo(alias="eventId", default=None) + + finished_at: Optional[str] = FieldInfo(alias="finishedAt", default=None) + + flow_id: str = FieldInfo(alias="flowId") + + flow_name: Optional[str] = FieldInfo(alias="flowName", default=None) + + kind: Literal["live", "dry_run"] + + started_at: Optional[str] = FieldInfo(alias="startedAt", default=None) + + status: Optional[Literal["pending", "running", "success", "failed", "cancelled", "skipped", "invalid"]] = None + + trigger_id: str = FieldInfo(alias="triggerId") + + trigger_name: Optional[str] = FieldInfo(alias="triggerName", default=None) + + result: Optional[object] = None diff --git a/src/mobilerun_sdk/types/workflows/flow_list_params.py b/src/mobilerun_sdk/types/workflows/flow_list_params.py new file mode 100644 index 0000000..8f00af0 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_list_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["FlowListParams"] + + +class FlowListParams(TypedDict, total=False): + enabled: Optional[bool] + + order_by: Annotated[Literal["name", "createdAt", "updatedAt"], PropertyInfo(alias="orderBy")] + + order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] + + page: int + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + search: str + + status: List[Literal["healthy", "failing", "blocked"]] + + trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/flow_list_response.py b/src/mobilerun_sdk/types/workflows/flow_list_response.py new file mode 100644 index 0000000..ff0feb8 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_list_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..flow import Flow +from ..._models import BaseModel +from ..shared.pagination import Pagination + +__all__ = ["FlowListResponse"] + + +class FlowListResponse(BaseModel): + items: List[Flow] + + pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/flow_retrieve_response.py b/src/mobilerun_sdk/types/workflows/flow_retrieve_response.py new file mode 100644 index 0000000..0a002a6 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_retrieve_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..flow import Flow +from ..._models import BaseModel + +__all__ = ["FlowRetrieveResponse"] + + +class FlowRetrieveResponse(BaseModel): + data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_unblock_response.py b/src/mobilerun_sdk/types/workflows/flow_unblock_response.py new file mode 100644 index 0000000..3771e29 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_unblock_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..flow import Flow +from ..._models import BaseModel + +__all__ = ["FlowUnblockResponse"] + + +class FlowUnblockResponse(BaseModel): + data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flow_update_params.py b/src/mobilerun_sdk/types/workflows/flow_update_params.py new file mode 100644 index 0000000..af63c04 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_update_params.py @@ -0,0 +1,33 @@ +# 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, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["FlowUpdateParams"] + + +class FlowUpdateParams(TypedDict, total=False): + cooldown_scope: Annotated[Literal["flow", "device"], PropertyInfo(alias="cooldownScope")] + + cooldown_seconds: Annotated[Optional[int], PropertyInfo(alias="cooldownSeconds")] + + description: str + + device_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="deviceIds")] + + enabled: bool + + name: str + + notify_on_failure: Annotated[bool, PropertyInfo(alias="notifyOnFailure")] + + notify_on_success: Annotated[bool, PropertyInfo(alias="notifyOnSuccess")] + + notify_webhook_id: Annotated[Optional[str], PropertyInfo(alias="notifyWebhookId")] + + trigger_id: Annotated[str, PropertyInfo(alias="triggerId")] diff --git a/src/mobilerun_sdk/types/workflows/flow_update_response.py b/src/mobilerun_sdk/types/workflows/flow_update_response.py new file mode 100644 index 0000000..8725080 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flow_update_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..flow import Flow +from ..._models import BaseModel + +__all__ = ["FlowUpdateResponse"] + + +class FlowUpdateResponse(BaseModel): + data: Flow diff --git a/src/mobilerun_sdk/types/workflows/flows/__init__.py b/src/mobilerun_sdk/types/workflows/flows/__init__.py index f8ee8b1..fa77a33 100644 --- a/src/mobilerun_sdk/types/workflows/flows/__init__.py +++ b/src/mobilerun_sdk/types/workflows/flows/__init__.py @@ -1,3 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .flow_action import FlowAction as FlowAction +from .action_add_params import ActionAddParams as ActionAddParams +from .action_add_response import ActionAddResponse as ActionAddResponse +from .action_list_response import ActionListResponse as ActionListResponse +from .action_replace_params import ActionReplaceParams as ActionReplaceParams +from .action_remove_response import ActionRemoveResponse as ActionRemoveResponse +from .action_replace_response import ActionReplaceResponse as ActionReplaceResponse diff --git a/src/mobilerun_sdk/types/workflows/flows/action_add_params.py b/src/mobilerun_sdk/types/workflows/flows/action_add_params.py new file mode 100644 index 0000000..749fab6 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flows/action_add_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo +from ..flow_action_overrides_param import FlowActionOverridesParam +from ..flow_child_action_input_param import FlowChildActionInputParam + +__all__ = ["ActionAddParams"] + + +class ActionAddParams(TypedDict, total=False): + action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] + + position: Required[int] + + children: Iterable[FlowChildActionInputParam] + + continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] + + name_override: Annotated[str, PropertyInfo(alias="nameOverride")] + + overrides: Optional[FlowActionOverridesParam] + + parent_flow_action_id: Annotated[Optional[str], PropertyInfo(alias="parentFlowActionId")] diff --git a/src/mobilerun_sdk/types/workflows/flows/action_add_response.py b/src/mobilerun_sdk/types/workflows/flows/action_add_response.py new file mode 100644 index 0000000..03d4e31 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flows/action_add_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel +from .flow_action import FlowAction + +__all__ = ["ActionAddResponse"] + + +class ActionAddResponse(BaseModel): + data: FlowAction diff --git a/src/mobilerun_sdk/types/workflows/flows/action_list_response.py b/src/mobilerun_sdk/types/workflows/flows/action_list_response.py new file mode 100644 index 0000000..7f6bd53 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flows/action_list_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .flow_action import FlowAction + +__all__ = ["ActionListResponse"] + + +class ActionListResponse(BaseModel): + data: List[FlowAction] diff --git a/src/mobilerun_sdk/types/workflows/flows/action_remove_response.py b/src/mobilerun_sdk/types/workflows/flows/action_remove_response.py new file mode 100644 index 0000000..a200db1 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flows/action_remove_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["ActionRemoveResponse"] + + +class ActionRemoveResponse(BaseModel): + message: str diff --git a/src/mobilerun_sdk/types/workflows/flows/action_replace_params.py b/src/mobilerun_sdk/types/workflows/flows/action_replace_params.py new file mode 100644 index 0000000..359f228 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flows/action_replace_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo +from ..flow_action_overrides_param import FlowActionOverridesParam +from ..flow_child_action_input_param import FlowChildActionInputParam + +__all__ = ["ActionReplaceParams", "Action"] + + +class ActionReplaceParams(TypedDict, total=False): + actions: Required[Iterable[Action]] + + +class Action(TypedDict, total=False): + action_id: Required[Annotated[str, PropertyInfo(alias="actionId")]] + + position: Required[int] + + children: Iterable[FlowChildActionInputParam] + + continue_on_error: Annotated[bool, PropertyInfo(alias="continueOnError")] + + name_override: Annotated[str, PropertyInfo(alias="nameOverride")] + + overrides: Optional[FlowActionOverridesParam] diff --git a/src/mobilerun_sdk/types/workflows/flows/action_replace_response.py b/src/mobilerun_sdk/types/workflows/flows/action_replace_response.py new file mode 100644 index 0000000..2914bfa --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flows/action_replace_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .flow_action import FlowAction + +__all__ = ["ActionReplaceResponse"] + + +class ActionReplaceResponse(BaseModel): + data: List[FlowAction] diff --git a/src/mobilerun_sdk/types/workflows/flows/flow_action.py b/src/mobilerun_sdk/types/workflows/flows/flow_action.py new file mode 100644 index 0000000..2ab9154 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/flows/flow_action.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["FlowAction", "Overrides"] + + +class Overrides(BaseModel): + params: Optional[Dict[str, Optional[object]]] = None + + +class FlowAction(BaseModel): + id: str + + action_id: str = FieldInfo(alias="actionId") + + continue_on_error: bool = FieldInfo(alias="continueOnError") + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + flow_id: str = FieldInfo(alias="flowId") + + name_override: Optional[str] = FieldInfo(alias="nameOverride", default=None) + + overrides: Optional[Overrides] = None + + parent_flow_action_id: Optional[str] = FieldInfo(alias="parentFlowActionId", default=None) + + position: int diff --git a/src/mobilerun_sdk/types/workflows/timezone_list_response.py b/src/mobilerun_sdk/types/workflows/timezone_list_response.py new file mode 100644 index 0000000..6e49c63 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/timezone_list_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["TimezoneListResponse"] + + +class TimezoneListResponse(BaseModel): + data: List[str] diff --git a/src/mobilerun_sdk/types/workflows/trigger_create_params.py b/src/mobilerun_sdk/types/workflows/trigger_create_params.py new file mode 100644 index 0000000..7d8c4b8 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_create_params.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TriggerCreateParams", "Conditions", "ScheduleRule"] + + +class TriggerCreateParams(TypedDict, total=False): + activation: Required[Literal["event", "schedule", "custom"]] + + name: Required[str] + + conditions: Conditions + + custom_payload_schema: Annotated[Dict[str, object], PropertyInfo(alias="customPayloadSchema")] + """Optional JSON Schema for validating payloads sent to this custom trigger""" + + description: str + + event_type: Annotated[str, PropertyInfo(alias="eventType")] + + schedule_rule: Annotated[ScheduleRule, PropertyInfo(alias="scheduleRule")] + + timezone: str + + +class Conditions(TypedDict, total=False): + all: Iterable[object] + + any: Iterable[object] + + +class ScheduleRule(TypedDict, total=False): + type: Required[Literal["once", "cron", "recurring"]] + + date_time: Annotated[str, PropertyInfo(alias="dateTime")] + """ISO 8601 datetime (for type=once)""" + + expression: str + """Cron expression (for type=cron)""" + + rrule: str + """RRULE string (for type=recurring)""" diff --git a/src/mobilerun_sdk/types/workflows/trigger_create_response.py b/src/mobilerun_sdk/types/workflows/trigger_create_response.py new file mode 100644 index 0000000..b2073b1 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_create_response.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TriggerCreateResponse", "Data", "DataScheduleRule"] + + +class DataScheduleRule(BaseModel): + type: Literal["once", "cron", "recurring"] + + date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) + """ISO 8601 datetime (for type=once)""" + + expression: Optional[str] = None + """Cron expression (for type=cron)""" + + rrule: Optional[str] = None + """RRULE string (for type=recurring)""" + + +class Data(BaseModel): + id: str + + activation: Literal["event", "schedule", "custom"] + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + custom_payload_schema: Optional[Dict[str, Optional[object]]] = FieldInfo(alias="customPayloadSchema", default=None) + + description: Optional[str] = None + + event_type: Optional[str] = FieldInfo(alias="eventType", default=None) + + name: str + + schedule_rule: DataScheduleRule = FieldInfo(alias="scheduleRule") + + timezone: Optional[str] = None + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + user_id: str = FieldInfo(alias="userId") + + conditions: Optional[object] = None + + next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) + + +class TriggerCreateResponse(BaseModel): + data: Data diff --git a/src/mobilerun_sdk/types/workflows/trigger_delete_response.py b/src/mobilerun_sdk/types/workflows/trigger_delete_response.py new file mode 100644 index 0000000..5a4cf92 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_delete_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["TriggerDeleteResponse"] + + +class TriggerDeleteResponse(BaseModel): + message: str diff --git a/src/mobilerun_sdk/types/workflows/trigger_fire_params.py b/src/mobilerun_sdk/types/workflows/trigger_fire_params.py new file mode 100644 index 0000000..03847b7 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_fire_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 import Dict +from typing_extensions import Required, TypedDict + +__all__ = ["TriggerFireParams"] + + +class TriggerFireParams(TypedDict, total=False): + payload: Required[Dict[str, object]] + """Arbitrary JSON object forwarded to every flow attached to this trigger. + + Validated against the trigger's customPayloadSchema when one is configured; + otherwise only "must be a JSON object" is enforced. + """ diff --git a/src/mobilerun_sdk/types/workflows/trigger_fire_response.py b/src/mobilerun_sdk/types/workflows/trigger_fire_response.py new file mode 100644 index 0000000..b0b4951 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_fire_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TriggerFireResponse"] + + +class TriggerFireResponse(BaseModel): + enqueued_count: int = FieldInfo(alias="enqueuedCount") + """Number of flow executions enqueued. + + May be 0 if no flows are attached to this trigger, or if all attached flows are + currently in cooldown. + """ + + invocation_id: str = FieldInfo(alias="invocationId") + """Unique ID for this fire invocation. + + Job IDs in the execution queue are derived from it (one per enqueued flow). + """ diff --git a/src/mobilerun_sdk/types/workflows/trigger_list_params.py b/src/mobilerun_sdk/types/workflows/trigger_list_params.py new file mode 100644 index 0000000..dad1a5f --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_list_params.py @@ -0,0 +1,25 @@ +# 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__ = ["TriggerListParams"] + + +class TriggerListParams(TypedDict, total=False): + activation: Literal["event", "schedule", "custom"] + + event_type: Annotated[str, PropertyInfo(alias="eventType")] + + order_by: Annotated[Literal["name", "createdAt", "updatedAt"], PropertyInfo(alias="orderBy")] + + order_by_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderByDirection")] + + page: int + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + search: str diff --git a/src/mobilerun_sdk/types/workflows/trigger_list_response.py b/src/mobilerun_sdk/types/workflows/trigger_list_response.py new file mode 100644 index 0000000..703fd4c --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_list_response.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from ..shared.pagination import Pagination + +__all__ = ["TriggerListResponse", "Item", "ItemScheduleRule"] + + +class ItemScheduleRule(BaseModel): + type: Literal["once", "cron", "recurring"] + + date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) + """ISO 8601 datetime (for type=once)""" + + expression: Optional[str] = None + """Cron expression (for type=cron)""" + + rrule: Optional[str] = None + """RRULE string (for type=recurring)""" + + +class Item(BaseModel): + id: str + + activation: Literal["event", "schedule", "custom"] + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) + + description: Optional[str] = None + + event_type: Optional[str] = FieldInfo(alias="eventType", default=None) + + name: str + + schedule_rule: Optional[ItemScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + + timezone: Optional[str] = None + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + user_id: str = FieldInfo(alias="userId") + + conditions: Optional[object] = None + + next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) + + +class TriggerListResponse(BaseModel): + items: List[Item] + + pagination: Pagination diff --git a/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py b/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py new file mode 100644 index 0000000..fc48aa4 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TriggerRetrieveResponse", "Data", "DataScheduleRule"] + + +class DataScheduleRule(BaseModel): + type: Literal["once", "cron", "recurring"] + + date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) + """ISO 8601 datetime (for type=once)""" + + expression: Optional[str] = None + """Cron expression (for type=cron)""" + + rrule: Optional[str] = None + """RRULE string (for type=recurring)""" + + +class Data(BaseModel): + id: str + + activation: Literal["event", "schedule", "custom"] + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) + + description: Optional[str] = None + + event_type: Optional[str] = FieldInfo(alias="eventType", default=None) + + name: str + + schedule_rule: Optional[DataScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + + timezone: Optional[str] = None + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + user_id: str = FieldInfo(alias="userId") + + conditions: Optional[object] = None + + next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) + + +class TriggerRetrieveResponse(BaseModel): + data: Data diff --git a/src/mobilerun_sdk/types/workflows/trigger_update_params.py b/src/mobilerun_sdk/types/workflows/trigger_update_params.py new file mode 100644 index 0000000..ecf86b7 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_update_params.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TriggerUpdateParams", "Conditions", "ScheduleRule"] + + +class TriggerUpdateParams(TypedDict, total=False): + activation: Literal["event", "schedule", "custom"] + + conditions: Conditions + + custom_payload_schema: Annotated[Optional[Dict[str, object]], PropertyInfo(alias="customPayloadSchema")] + """Optional JSON Schema for validating payloads sent to this custom trigger""" + + description: str + + event_type: Annotated[str, PropertyInfo(alias="eventType")] + + name: str + + schedule_rule: Annotated[ScheduleRule, PropertyInfo(alias="scheduleRule")] + + timezone: Optional[str] + + +class Conditions(TypedDict, total=False): + all: Iterable[object] + + any: Iterable[object] + + +class ScheduleRule(TypedDict, total=False): + type: Required[Literal["once", "cron", "recurring"]] + + date_time: Annotated[str, PropertyInfo(alias="dateTime")] + """ISO 8601 datetime (for type=once)""" + + expression: str + """Cron expression (for type=cron)""" + + rrule: str + """RRULE string (for type=recurring)""" diff --git a/src/mobilerun_sdk/types/workflows/trigger_update_response.py b/src/mobilerun_sdk/types/workflows/trigger_update_response.py new file mode 100644 index 0000000..a5a9418 --- /dev/null +++ b/src/mobilerun_sdk/types/workflows/trigger_update_response.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TriggerUpdateResponse", "Data", "DataScheduleRule"] + + +class DataScheduleRule(BaseModel): + type: Literal["once", "cron", "recurring"] + + date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) + """ISO 8601 datetime (for type=once)""" + + expression: Optional[str] = None + """Cron expression (for type=cron)""" + + rrule: Optional[str] = None + """RRULE string (for type=recurring)""" + + +class Data(BaseModel): + id: str + + activation: Literal["event", "schedule", "custom"] + + created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) + + custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) + + description: Optional[str] = None + + event_type: Optional[str] = FieldInfo(alias="eventType", default=None) + + name: str + + schedule_rule: Optional[DataScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + + timezone: Optional[str] = None + + updated_at: Optional[str] = FieldInfo(alias="updatedAt", default=None) + + user_id: str = FieldInfo(alias="userId") + + conditions: Optional[object] = None + + next_fire_time: Optional[str] = FieldInfo(alias="nextFireTime", default=None) + + +class TriggerUpdateResponse(BaseModel): + data: Data diff --git a/tests/api_resources/workflows/__init__.py b/tests/api_resources/workflows/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/workflows/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workflows/actions/__init__.py b/tests/api_resources/workflows/actions/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/workflows/actions/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workflows/actions/test_services.py b/tests/api_resources/workflows/actions/test_services.py new file mode 100644 index 0000000..442a3bd --- /dev/null +++ b/tests/api_resources/workflows/actions/test_services.py @@ -0,0 +1,164 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows.actions import ServiceListResponse, ServiceListMethodsResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestServices: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + service = client.workflows.actions.services.list() + assert_matches_type(ServiceListResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.actions.services.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service = response.parse() + assert_matches_type(ServiceListResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.actions.services.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service = response.parse() + assert_matches_type(ServiceListResponse, service, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_methods(self, client: Mobilerun) -> None: + service = client.workflows.actions.services.list_methods( + "x", + ) + assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list_methods(self, client: Mobilerun) -> None: + response = client.workflows.actions.services.with_raw_response.list_methods( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service = response.parse() + assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list_methods(self, client: Mobilerun) -> None: + with client.workflows.actions.services.with_streaming_response.list_methods( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service = response.parse() + assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_list_methods(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service` but received ''"): + client.workflows.actions.services.with_raw_response.list_methods( + "", + ) + + +class TestAsyncServices: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + service = await async_client.workflows.actions.services.list() + assert_matches_type(ServiceListResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.actions.services.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service = await response.parse() + assert_matches_type(ServiceListResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.actions.services.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service = await response.parse() + assert_matches_type(ServiceListResponse, service, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_methods(self, async_client: AsyncMobilerun) -> None: + service = await async_client.workflows.actions.services.list_methods( + "x", + ) + assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list_methods(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.actions.services.with_raw_response.list_methods( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service = await response.parse() + assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list_methods(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.actions.services.with_streaming_response.list_methods( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service = await response.parse() + assert_matches_type(ServiceListMethodsResponse, service, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_list_methods(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service` but received ''"): + await async_client.workflows.actions.services.with_raw_response.list_methods( + "", + ) diff --git a/tests/api_resources/workflows/flows/__init__.py b/tests/api_resources/workflows/flows/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/workflows/flows/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workflows/flows/test_actions.py b/tests/api_resources/workflows/flows/test_actions.py new file mode 100644 index 0000000..797f724 --- /dev/null +++ b/tests/api_resources/workflows/flows/test_actions.py @@ -0,0 +1,495 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows.flows import ( + ActionAddResponse, + ActionListResponse, + ActionRemoveResponse, + ActionReplaceResponse, +) + +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="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + action = client.workflows.flows.actions.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.flows.actions.with_raw_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.flows.actions.with_streaming_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): + client.workflows.flows.actions.with_raw_response.list( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_add(self, client: Mobilerun) -> None: + action = client.workflows.flows.actions.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) + assert_matches_type(ActionAddResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_add_with_all_params(self, client: Mobilerun) -> None: + action = client.workflows.flows.actions.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + children=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + "continue_on_error": True, + "name_override": "x", + "overrides": {"params": {"foo": "bar"}}, + } + ], + continue_on_error=True, + name_override="x", + overrides={"params": {"foo": "bar"}}, + parent_flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionAddResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_add(self, client: Mobilerun) -> None: + response = client.workflows.flows.actions.with_raw_response.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionAddResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_add(self, client: Mobilerun) -> None: + with client.workflows.flows.actions.with_streaming_response.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionAddResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_add(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + client.workflows.flows.actions.with_raw_response.add( + flow_id="", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_remove(self, client: Mobilerun) -> None: + action = client.workflows.flows.actions.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionRemoveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_remove(self, client: Mobilerun) -> None: + response = client.workflows.flows.actions.with_raw_response.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionRemoveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_remove(self, client: Mobilerun) -> None: + with client.workflows.flows.actions.with_streaming_response.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionRemoveResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_remove(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + client.workflows.flows.actions.with_raw_response.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_action_id` but received ''"): + client.workflows.flows.actions.with_raw_response.remove( + flow_action_id="", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_replace(self, client: Mobilerun) -> None: + action = client.workflows.flows.actions.replace( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) + assert_matches_type(ActionReplaceResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_replace(self, client: Mobilerun) -> None: + response = client.workflows.flows.actions.with_raw_response.replace( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionReplaceResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_replace(self, client: Mobilerun) -> None: + with client.workflows.flows.actions.with_streaming_response.replace( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionReplaceResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_replace(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + client.workflows.flows.actions.with_raw_response.replace( + flow_id="", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) + + +class TestAsyncActions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.flows.actions.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.actions.with_raw_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.actions.with_streaming_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): + await async_client.workflows.flows.actions.with_raw_response.list( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_add(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.flows.actions.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) + assert_matches_type(ActionAddResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_add_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.flows.actions.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + children=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + "continue_on_error": True, + "name_override": "x", + "overrides": {"params": {"foo": "bar"}}, + } + ], + continue_on_error=True, + name_override="x", + overrides={"params": {"foo": "bar"}}, + parent_flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionAddResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_add(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.actions.with_raw_response.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionAddResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_add(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.actions.with_streaming_response.add( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionAddResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_add(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + await async_client.workflows.flows.actions.with_raw_response.add( + flow_id="", + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + position=0, + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_remove(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.flows.actions.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionRemoveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_remove(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.actions.with_raw_response.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionRemoveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_remove(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.actions.with_streaming_response.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionRemoveResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_remove(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + await async_client.workflows.flows.actions.with_raw_response.remove( + flow_action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + flow_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_action_id` but received ''"): + await async_client.workflows.flows.actions.with_raw_response.remove( + flow_action_id="", + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_replace(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.flows.actions.replace( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) + assert_matches_type(ActionReplaceResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_replace(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.actions.with_raw_response.replace( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionReplaceResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.actions.with_streaming_response.replace( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionReplaceResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_replace(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + await async_client.workflows.flows.actions.with_raw_response.replace( + flow_id="", + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + ) diff --git a/tests/api_resources/workflows/test_action_catalog.py b/tests/api_resources/workflows/test_action_catalog.py new file mode 100644 index 0000000..9f228db --- /dev/null +++ b/tests/api_resources/workflows/test_action_catalog.py @@ -0,0 +1,187 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows import ( + ActionCatalogListResponse, + ActionCatalogRetrieveResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestActionCatalog: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + action_catalog = client.workflows.action_catalog.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.workflows.action_catalog.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action_catalog = response.parse() + assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.workflows.action_catalog.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action_catalog = response.parse() + assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `catalog_entry_id` but received ''"): + client.workflows.action_catalog.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + action_catalog = client.workflows.action_catalog.list() + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + action_catalog = client.workflows.action_catalog.list( + page=1, + page_size=1, + service="tasks_api", + ) + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.action_catalog.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action_catalog = response.parse() + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.action_catalog.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action_catalog = response.parse() + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncActionCatalog: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + action_catalog = await async_client.workflows.action_catalog.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.action_catalog.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action_catalog = await response.parse() + assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.action_catalog.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action_catalog = await response.parse() + assert_matches_type(ActionCatalogRetrieveResponse, action_catalog, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `catalog_entry_id` but received ''"): + await async_client.workflows.action_catalog.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + action_catalog = await async_client.workflows.action_catalog.list() + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + action_catalog = await async_client.workflows.action_catalog.list( + page=1, + page_size=1, + service="tasks_api", + ) + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.action_catalog.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action_catalog = await response.parse() + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.action_catalog.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action_catalog = await response.parse() + assert_matches_type(ActionCatalogListResponse, action_catalog, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_actions.py b/tests/api_resources/workflows/test_actions.py new file mode 100644 index 0000000..9533759 --- /dev/null +++ b/tests/api_resources/workflows/test_actions.py @@ -0,0 +1,482 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows import ( + ActionListResponse, + ActionCreateResponse, + ActionDeleteResponse, + ActionUpdateResponse, + ActionRetrieveResponse, +) + +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="Mock server tests are disabled") + @parametrize + def test_method_create(self, client: Mobilerun) -> None: + action = client.workflows.actions.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + ) + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Mobilerun) -> None: + action = client.workflows.actions.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + description="description", + params={"foo": "bar"}, + ) + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_create(self, client: Mobilerun) -> None: + response = client.workflows.actions.with_raw_response.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Mobilerun) -> None: + with client.workflows.actions.with_streaming_response.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + action = client.workflows.actions.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionRetrieveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.workflows.actions.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionRetrieveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.workflows.actions.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionRetrieveResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): + client.workflows.actions.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update(self, client: Mobilerun) -> None: + action = client.workflows.actions.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Mobilerun) -> None: + action = client.workflows.actions.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="description", + name="x", + params={"foo": "bar"}, + ) + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update(self, client: Mobilerun) -> None: + response = client.workflows.actions.with_raw_response.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Mobilerun) -> None: + with client.workflows.actions.with_streaming_response.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `action_id` but received ''"): + client.workflows.actions.with_raw_response.update( + action_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + action = client.workflows.actions.list() + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + action = client.workflows.actions.list( + order_by="name", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + service="tasks_api", + ) + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.actions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.actions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete(self, client: Mobilerun) -> None: + action = client.workflows.actions.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionDeleteResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Mobilerun) -> None: + response = client.workflows.actions.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionDeleteResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Mobilerun) -> None: + with client.workflows.actions.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionDeleteResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): + client.workflows.actions.with_raw_response.delete( + "", + ) + + +class TestAsyncActions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + ) + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + description="description", + params={"foo": "bar"}, + ) + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.actions.with_raw_response.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.actions.with_streaming_response.create( + catalog_entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionCreateResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionRetrieveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.actions.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionRetrieveResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.actions.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionRetrieveResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): + await async_client.workflows.actions.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="description", + name="x", + params={"foo": "bar"}, + ) + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.actions.with_raw_response.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.actions.with_streaming_response.update( + action_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionUpdateResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `action_id` but received ''"): + await async_client.workflows.actions.with_raw_response.update( + action_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.list() + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.list( + order_by="name", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + service="tasks_api", + ) + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.actions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.actions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionListResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncMobilerun) -> None: + action = await async_client.workflows.actions.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ActionDeleteResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.actions.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionDeleteResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.actions.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionDeleteResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `action_id` but received ''"): + await async_client.workflows.actions.with_raw_response.delete( + "", + ) diff --git a/tests/api_resources/workflows/test_events.py b/tests/api_resources/workflows/test_events.py new file mode 100644 index 0000000..8ca70fa --- /dev/null +++ b/tests/api_resources/workflows/test_events.py @@ -0,0 +1,203 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows import ( + EventDryRunResponse, + EventIngestResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEvents: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_dry_run(self, client: Mobilerun) -> None: + event = client.workflows.events.dry_run( + event_type="x", + ) + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_dry_run_with_all_params(self, client: Mobilerun) -> None: + event = client.workflows.events.dry_run( + event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_dry_run(self, client: Mobilerun) -> None: + response = client.workflows.events.with_raw_response.dry_run( + event_type="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = response.parse() + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_dry_run(self, client: Mobilerun) -> None: + with client.workflows.events.with_streaming_response.dry_run( + event_type="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = response.parse() + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_ingest(self, client: Mobilerun) -> None: + event = client.workflows.events.ingest( + event_type="x", + ) + assert_matches_type(EventIngestResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_ingest_with_all_params(self, client: Mobilerun) -> None: + event = client.workflows.events.ingest( + event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + assert_matches_type(EventIngestResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_ingest(self, client: Mobilerun) -> None: + response = client.workflows.events.with_raw_response.ingest( + event_type="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = response.parse() + assert_matches_type(EventIngestResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_ingest(self, client: Mobilerun) -> None: + with client.workflows.events.with_streaming_response.ingest( + event_type="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = response.parse() + assert_matches_type(EventIngestResponse, event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncEvents: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_dry_run(self, async_client: AsyncMobilerun) -> None: + event = await async_client.workflows.events.dry_run( + event_type="x", + ) + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_dry_run_with_all_params(self, async_client: AsyncMobilerun) -> None: + event = await async_client.workflows.events.dry_run( + event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_dry_run(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.events.with_raw_response.dry_run( + event_type="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = await response.parse() + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_dry_run(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.events.with_streaming_response.dry_run( + event_type="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = await response.parse() + assert_matches_type(EventDryRunResponse, event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_ingest(self, async_client: AsyncMobilerun) -> None: + event = await async_client.workflows.events.ingest( + event_type="x", + ) + assert_matches_type(EventIngestResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_ingest_with_all_params(self, async_client: AsyncMobilerun) -> None: + event = await async_client.workflows.events.ingest( + event_type="x", + device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + assert_matches_type(EventIngestResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_ingest(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.events.with_raw_response.ingest( + event_type="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = await response.parse() + assert_matches_type(EventIngestResponse, event, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_ingest(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.events.with_streaming_response.ingest( + event_type="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = await response.parse() + assert_matches_type(EventIngestResponse, event, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_executions.py b/tests/api_resources/workflows/test_executions.py new file mode 100644 index 0000000..891bd9b --- /dev/null +++ b/tests/api_resources/workflows/test_executions.py @@ -0,0 +1,280 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows import ( + ExecutionListResponse, + ExecutionRetrieveResponse, + ExecutionGetMetricsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestExecutions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + execution = client.workflows.executions.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.workflows.executions.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + execution = response.parse() + assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.workflows.executions.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + execution = response.parse() + assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `execution_id` but received ''"): + client.workflows.executions.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + execution = client.workflows.executions.list() + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + execution = client.workflows.executions.list( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + from_="from", + order_by="startedAt", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + status="pending", + to="to", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.executions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + execution = response.parse() + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.executions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + execution = response.parse() + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get_metrics(self, client: Mobilerun) -> None: + execution = client.workflows.executions.get_metrics() + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get_metrics_with_all_params(self, client: Mobilerun) -> None: + execution = client.workflows.executions.get_metrics( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + from_="from", + to="to", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_get_metrics(self, client: Mobilerun) -> None: + response = client.workflows.executions.with_raw_response.get_metrics() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + execution = response.parse() + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_get_metrics(self, client: Mobilerun) -> None: + with client.workflows.executions.with_streaming_response.get_metrics() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + execution = response.parse() + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncExecutions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + execution = await async_client.workflows.executions.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.executions.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + execution = await response.parse() + assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.executions.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + execution = await response.parse() + assert_matches_type(ExecutionRetrieveResponse, execution, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `execution_id` but received ''"): + await async_client.workflows.executions.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + execution = await async_client.workflows.executions.list() + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + execution = await async_client.workflows.executions.list( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + from_="from", + order_by="startedAt", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + status="pending", + to="to", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.executions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + execution = await response.parse() + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.executions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + execution = await response.parse() + assert_matches_type(ExecutionListResponse, execution, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get_metrics(self, async_client: AsyncMobilerun) -> None: + execution = await async_client.workflows.executions.get_metrics() + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get_metrics_with_all_params(self, async_client: AsyncMobilerun) -> None: + execution = await async_client.workflows.executions.get_metrics( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + from_="from", + to="to", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_get_metrics(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.executions.with_raw_response.get_metrics() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + execution = await response.parse() + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_get_metrics(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.executions.with_streaming_response.get_metrics() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + execution = await response.parse() + assert_matches_type(ExecutionGetMetricsResponse, execution, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_flows.py b/tests/api_resources/workflows/test_flows.py new file mode 100644 index 0000000..34eb5e5 --- /dev/null +++ b/tests/api_resources/workflows/test_flows.py @@ -0,0 +1,774 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows import ( + FlowListResponse, + FlowCloneResponse, + FlowCreateResponse, + FlowDeleteResponse, + FlowUpdateResponse, + FlowUnblockResponse, + FlowRetrieveResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlows: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create(self, client: Mobilerun) -> None: + flow = client.workflows.flows.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Mobilerun) -> None: + flow = client.workflows.flows.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + "children": [ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + "continue_on_error": True, + "name_override": "x", + "overrides": {"params": {"foo": "bar"}}, + } + ], + "continue_on_error": True, + "name_override": "x", + "overrides": {"params": {"foo": "bar"}}, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + cooldown_scope="flow", + cooldown_seconds=0, + description="description", + device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + enabled=True, + notify_on_failure=True, + notify_on_success=True, + notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_create(self, client: Mobilerun) -> None: + response = client.workflows.flows.with_raw_response.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = response.parse() + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Mobilerun) -> None: + with client.workflows.flows.with_streaming_response.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = response.parse() + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + flow = client.workflows.flows.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.workflows.flows.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = response.parse() + assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.workflows.flows.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = response.parse() + assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): + client.workflows.flows.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update(self, client: Mobilerun) -> None: + flow = client.workflows.flows.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Mobilerun) -> None: + flow = client.workflows.flows.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + cooldown_scope="flow", + cooldown_seconds=0, + description="description", + device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + enabled=True, + name="x", + notify_on_failure=True, + notify_on_success=True, + notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update(self, client: Mobilerun) -> None: + response = client.workflows.flows.with_raw_response.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = response.parse() + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Mobilerun) -> None: + with client.workflows.flows.with_streaming_response.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = response.parse() + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + client.workflows.flows.with_raw_response.update( + flow_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + flow = client.workflows.flows.list() + assert_matches_type(FlowListResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + flow = client.workflows.flows.list( + enabled=True, + order_by="name", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + status=["healthy"], + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowListResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.flows.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = response.parse() + assert_matches_type(FlowListResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.flows.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = response.parse() + assert_matches_type(FlowListResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete(self, client: Mobilerun) -> None: + flow = client.workflows.flows.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowDeleteResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Mobilerun) -> None: + response = client.workflows.flows.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = response.parse() + assert_matches_type(FlowDeleteResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Mobilerun) -> None: + with client.workflows.flows.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = response.parse() + assert_matches_type(FlowDeleteResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): + client.workflows.flows.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_clone(self, client: Mobilerun) -> None: + flow = client.workflows.flows.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_clone_with_all_params(self, client: Mobilerun) -> None: + flow = client.workflows.flows.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + name="x", + ) + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_clone(self, client: Mobilerun) -> None: + response = client.workflows.flows.with_raw_response.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = response.parse() + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_clone(self, client: Mobilerun) -> None: + with client.workflows.flows.with_streaming_response.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = response.parse() + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_clone(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + client.workflows.flows.with_raw_response.clone( + flow_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_unblock(self, client: Mobilerun) -> None: + flow = client.workflows.flows.unblock( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowUnblockResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_unblock(self, client: Mobilerun) -> None: + response = client.workflows.flows.with_raw_response.unblock( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = response.parse() + assert_matches_type(FlowUnblockResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_unblock(self, client: Mobilerun) -> None: + with client.workflows.flows.with_streaming_response.unblock( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = response.parse() + assert_matches_type(FlowUnblockResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_unblock(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + client.workflows.flows.with_raw_response.unblock( + "", + ) + + +class TestAsyncFlows: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + "children": [ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + "continue_on_error": True, + "name_override": "x", + "overrides": {"params": {"foo": "bar"}}, + } + ], + "continue_on_error": True, + "name_override": "x", + "overrides": {"params": {"foo": "bar"}}, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + cooldown_scope="flow", + cooldown_seconds=0, + description="description", + device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + enabled=True, + notify_on_failure=True, + notify_on_success=True, + notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.with_raw_response.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = await response.parse() + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.with_streaming_response.create( + actions=[ + { + "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "position": 0, + } + ], + name="x", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = await response.parse() + assert_matches_type(FlowCreateResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = await response.parse() + assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = await response.parse() + assert_matches_type(FlowRetrieveResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): + await async_client.workflows.flows.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + cooldown_scope="flow", + cooldown_seconds=0, + description="description", + device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + enabled=True, + name="x", + notify_on_failure=True, + notify_on_success=True, + notify_webhook_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.with_raw_response.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = await response.parse() + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.with_streaming_response.update( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = await response.parse() + assert_matches_type(FlowUpdateResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + await async_client.workflows.flows.with_raw_response.update( + flow_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.list() + assert_matches_type(FlowListResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.list( + enabled=True, + order_by="name", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + status=["healthy"], + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowListResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = await response.parse() + assert_matches_type(FlowListResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = await response.parse() + assert_matches_type(FlowListResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowDeleteResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = await response.parse() + assert_matches_type(FlowDeleteResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = await response.parse() + assert_matches_type(FlowDeleteResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `flow_id` but received ''"): + await async_client.workflows.flows.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_clone(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_clone_with_all_params(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + device_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + name="x", + ) + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_clone(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.with_raw_response.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = await response.parse() + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_clone(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.with_streaming_response.clone( + flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = await response.parse() + assert_matches_type(FlowCloneResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_clone(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + await async_client.workflows.flows.with_raw_response.clone( + flow_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_unblock(self, async_client: AsyncMobilerun) -> None: + flow = await async_client.workflows.flows.unblock( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(FlowUnblockResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_unblock(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.flows.with_raw_response.unblock( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flow = await response.parse() + assert_matches_type(FlowUnblockResponse, flow, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_unblock(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.flows.with_streaming_response.unblock( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flow = await response.parse() + assert_matches_type(FlowUnblockResponse, flow, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_unblock(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + await async_client.workflows.flows.with_raw_response.unblock( + "", + ) diff --git a/tests/api_resources/workflows/test_timezones.py b/tests/api_resources/workflows/test_timezones.py new file mode 100644 index 0000000..fab060b --- /dev/null +++ b/tests/api_resources/workflows/test_timezones.py @@ -0,0 +1,80 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows import TimezoneListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTimezones: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + timezone = client.workflows.timezones.list() + assert_matches_type(TimezoneListResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.timezones.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + timezone = response.parse() + assert_matches_type(TimezoneListResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.timezones.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + timezone = response.parse() + assert_matches_type(TimezoneListResponse, timezone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTimezones: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + timezone = await async_client.workflows.timezones.list() + assert_matches_type(TimezoneListResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.timezones.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + timezone = await response.parse() + assert_matches_type(TimezoneListResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.timezones.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + timezone = await response.parse() + assert_matches_type(TimezoneListResponse, timezone, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workflows/test_triggers.py b/tests/api_resources/workflows/test_triggers.py new file mode 100644 index 0000000..5f9b669 --- /dev/null +++ b/tests/api_resources/workflows/test_triggers.py @@ -0,0 +1,627 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.workflows import ( + TriggerFireResponse, + TriggerListResponse, + TriggerCreateResponse, + TriggerDeleteResponse, + TriggerUpdateResponse, + TriggerRetrieveResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTriggers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.create( + activation="event", + name="x", + ) + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.create( + activation="event", + name="x", + conditions={ + "all": [{}], + "any": [{}], + }, + custom_payload_schema={"foo": "bar"}, + description="description", + event_type="eventType", + schedule_rule={ + "type": "once", + "date_time": "dateTime", + "expression": "expression", + "rrule": "rrule", + }, + timezone="timezone", + ) + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_create(self, client: Mobilerun) -> None: + response = client.workflows.triggers.with_raw_response.create( + activation="event", + name="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = response.parse() + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Mobilerun) -> None: + with client.workflows.triggers.with_streaming_response.create( + activation="event", + name="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = response.parse() + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.workflows.triggers.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = response.parse() + assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.workflows.triggers.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = response.parse() + assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): + client.workflows.triggers.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + activation="event", + conditions={ + "all": [{}], + "any": [{}], + }, + custom_payload_schema={"foo": "bar"}, + description="description", + event_type="eventType", + name="x", + schedule_rule={ + "type": "once", + "date_time": "dateTime", + "expression": "expression", + "rrule": "rrule", + }, + timezone="timezone", + ) + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update(self, client: Mobilerun) -> None: + response = client.workflows.triggers.with_raw_response.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = response.parse() + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Mobilerun) -> None: + with client.workflows.triggers.with_streaming_response.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = response.parse() + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): + client.workflows.triggers.with_raw_response.update( + trigger_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.list() + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.list( + activation="event", + event_type="eventType", + order_by="name", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + ) + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.workflows.triggers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = response.parse() + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.workflows.triggers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = response.parse() + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Mobilerun) -> None: + response = client.workflows.triggers.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = response.parse() + assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Mobilerun) -> None: + with client.workflows.triggers.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = response.parse() + assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): + client.workflows.triggers.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_fire(self, client: Mobilerun) -> None: + trigger = client.workflows.triggers.fire( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + assert_matches_type(TriggerFireResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_fire(self, client: Mobilerun) -> None: + response = client.workflows.triggers.with_raw_response.fire( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = response.parse() + assert_matches_type(TriggerFireResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_fire(self, client: Mobilerun) -> None: + with client.workflows.triggers.with_streaming_response.fire( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = response.parse() + assert_matches_type(TriggerFireResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_fire(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): + client.workflows.triggers.with_raw_response.fire( + trigger_id="", + payload={"foo": "bar"}, + ) + + +class TestAsyncTriggers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.create( + activation="event", + name="x", + ) + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.create( + activation="event", + name="x", + conditions={ + "all": [{}], + "any": [{}], + }, + custom_payload_schema={"foo": "bar"}, + description="description", + event_type="eventType", + schedule_rule={ + "type": "once", + "date_time": "dateTime", + "expression": "expression", + "rrule": "rrule", + }, + timezone="timezone", + ) + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.triggers.with_raw_response.create( + activation="event", + name="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = await response.parse() + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.triggers.with_streaming_response.create( + activation="event", + name="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = await response.parse() + assert_matches_type(TriggerCreateResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.triggers.with_raw_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = await response.parse() + assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.triggers.with_streaming_response.retrieve( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = await response.parse() + assert_matches_type(TriggerRetrieveResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): + await async_client.workflows.triggers.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + activation="event", + conditions={ + "all": [{}], + "any": [{}], + }, + custom_payload_schema={"foo": "bar"}, + description="description", + event_type="eventType", + name="x", + schedule_rule={ + "type": "once", + "date_time": "dateTime", + "expression": "expression", + "rrule": "rrule", + }, + timezone="timezone", + ) + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.triggers.with_raw_response.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = await response.parse() + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.triggers.with_streaming_response.update( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = await response.parse() + assert_matches_type(TriggerUpdateResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): + await async_client.workflows.triggers.with_raw_response.update( + trigger_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.list() + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.list( + activation="event", + event_type="eventType", + order_by="name", + order_by_direction="asc", + page=1, + page_size=1, + search="search", + ) + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.triggers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = await response.parse() + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.triggers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = await response.parse() + assert_matches_type(TriggerListResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.triggers.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = await response.parse() + assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.triggers.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = await response.parse() + assert_matches_type(TriggerDeleteResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `trigger_id` but received ''"): + await async_client.workflows.triggers.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_fire(self, async_client: AsyncMobilerun) -> None: + trigger = await async_client.workflows.triggers.fire( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + assert_matches_type(TriggerFireResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_fire(self, async_client: AsyncMobilerun) -> None: + response = await async_client.workflows.triggers.with_raw_response.fire( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trigger = await response.parse() + assert_matches_type(TriggerFireResponse, trigger, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_fire(self, async_client: AsyncMobilerun) -> None: + async with async_client.workflows.triggers.with_streaming_response.fire( + trigger_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + payload={"foo": "bar"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trigger = await response.parse() + assert_matches_type(TriggerFireResponse, trigger, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_fire(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `trigger_id` but received ''"): + await async_client.workflows.triggers.with_raw_response.fire( + trigger_id="", + payload={"foo": "bar"}, + ) From 949f7d6d7ca33f2a817a0b7a357a36246173a1ce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 14:14:30 +0000 Subject: [PATCH 05/10] feat(api): api update --- .stats.yml | 4 +- .../resources/credentials/credentials.py | 8 +- .../packages/credentials/credentials.py | 20 ++-- .../packages/credentials/fields.py | 28 ++++-- .../credentials/packages/packages.py | 20 ++-- src/mobilerun_sdk/resources/proxies.py | 92 +++++++++++++------ 6 files changed, 122 insertions(+), 50 deletions(-) diff --git a/.stats.yml b/.stats.yml index 18785ef..6707b14 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 150 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-521a4a2c8ab8dd16173d533d8c851a057b04ff6d144bfa35a062103fbe417aef.yml -openapi_spec_hash: f3077f6c61aff5d5c4468a7968777041 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-e17da55a87b3b95dc9d185b807151e7e238c132afdd168618668ebe247afcec8.yml +openapi_spec_hash: 24a0c6dc866c41647c6a0039a46bffc6 config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/src/mobilerun_sdk/resources/credentials/credentials.py b/src/mobilerun_sdk/resources/credentials/credentials.py index 9276d9f..ab4f945 100644 --- a/src/mobilerun_sdk/resources/credentials/credentials.py +++ b/src/mobilerun_sdk/resources/credentials/credentials.py @@ -69,7 +69,9 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialListResponse: """ - List all credentials for the authenticated user + Returns a paginated list of all credentials belonging to the authenticated user + across every package. Accepts standard pagination query parameters and responds + with the credential items plus pagination metadata. Args: extra_headers: Send extra headers @@ -139,7 +141,9 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialListResponse: """ - List all credentials for the authenticated user + Returns a paginated list of all credentials belonging to the authenticated user + across every package. Accepts standard pagination query parameters and responds + with the credential items plus pagination metadata. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py b/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py index df12c15..51aefb3 100644 --- a/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py +++ b/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py @@ -74,7 +74,9 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialCreateResponse: """ - Create a credential with fields for a package + Creates a credential under the given package with a `credentialName` and at + least one field. Each field has a `fieldType` (email, username, password, + api_token, phone_number, two_factor_secret, or backup_codes) and a value. Args: extra_headers: Send extra headers @@ -115,7 +117,8 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialRetrieveResponse: """ - Get a specific credential with its fields + Fetches a single credential by `packageName` and `credentialName`, including all + of its stored fields. Returns not found if no matching credential exists. Args: extra_headers: Send extra headers @@ -155,7 +158,8 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialDeleteResponse: """ - Delete a credential and all its fields + Permanently deletes the credential identified by `packageName` and + `credentialName`, removing all of its fields. Returns the deleted credential. Args: extra_headers: Send extra headers @@ -224,7 +228,9 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialCreateResponse: """ - Create a credential with fields for a package + Creates a credential under the given package with a `credentialName` and at + least one field. Each field has a `fieldType` (email, username, password, + api_token, phone_number, two_factor_secret, or backup_codes) and a value. Args: extra_headers: Send extra headers @@ -265,7 +271,8 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialRetrieveResponse: """ - Get a specific credential with its fields + Fetches a single credential by `packageName` and `credentialName`, including all + of its stored fields. Returns not found if no matching credential exists. Args: extra_headers: Send extra headers @@ -305,7 +312,8 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CredentialDeleteResponse: """ - Delete a credential and all its fields + Permanently deletes the credential identified by `packageName` and + `credentialName`, removing all of its fields. Returns the deleted credential. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py b/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py index 38ebfd9..ace7489 100644 --- a/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py +++ b/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py @@ -63,8 +63,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FieldCreateResponse: - """ - Add a new field to an existing credential + """Adds a single field to an existing credential. + + The body specifies a `fieldType` + (one of the supported field types) and its value. Returns a conflict if a field + of that type already exists on the credential. Args: extra_headers: Send extra headers @@ -115,7 +118,9 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FieldUpdateResponse: """ - Update the value of a credential field + Updates the value of an existing field on a credential, identified by + `packageName`, `credentialName`, and `fieldType` in the path. The body carries + the new value and returns the updated credential. Args: extra_headers: Send extra headers @@ -162,7 +167,8 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FieldDeleteResponse: """ - Delete a field from a credential + Removes a single field of the given `fieldType` from the specified credential + while leaving the credential itself intact. Returns the updated credential. Args: extra_headers: Send extra headers @@ -231,8 +237,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FieldCreateResponse: - """ - Add a new field to an existing credential + """Adds a single field to an existing credential. + + The body specifies a `fieldType` + (one of the supported field types) and its value. Returns a conflict if a field + of that type already exists on the credential. Args: extra_headers: Send extra headers @@ -283,7 +292,9 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FieldUpdateResponse: """ - Update the value of a credential field + Updates the value of an existing field on a credential, identified by + `packageName`, `credentialName`, and `fieldType` in the path. The body carries + the new value and returns the updated credential. Args: extra_headers: Send extra headers @@ -330,7 +341,8 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FieldDeleteResponse: """ - Delete a field from a credential + Removes a single field of the given `fieldType` from the specified credential + while leaving the credential itself intact. Returns the updated credential. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/credentials/packages/packages.py b/src/mobilerun_sdk/resources/credentials/packages/packages.py index 135ccdd..d44a159 100644 --- a/src/mobilerun_sdk/resources/credentials/packages/packages.py +++ b/src/mobilerun_sdk/resources/credentials/packages/packages.py @@ -69,7 +69,9 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PackageCreateResponse: """ - Initialize a new package/app + Creates a new package (identified by `packageName`) under which credentials can + be grouped. Returns a conflict if a package with the same name already exists + for the user. Args: extra_headers: Send extra headers @@ -100,8 +102,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PackageListResponse: - """ - List credentials for a specific package + """Returns all credentials stored under the given `packageName`. + + Each credential + includes its name, secret path, and the list of fields it holds. Args: extra_headers: Send extra headers @@ -162,7 +166,9 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PackageCreateResponse: """ - Initialize a new package/app + Creates a new package (identified by `packageName`) under which credentials can + be grouped. Returns a conflict if a package with the same name already exists + for the user. Args: extra_headers: Send extra headers @@ -193,8 +199,10 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PackageListResponse: - """ - List credentials for a specific package + """Returns all credentials stored under the given `packageName`. + + Each credential + includes its name, secret path, and the list of fields it holds. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/proxies.py b/src/mobilerun_sdk/resources/proxies.py index 4abd363..bb15409 100644 --- a/src/mobilerun_sdk/resources/proxies.py +++ b/src/mobilerun_sdk/resources/proxies.py @@ -67,8 +67,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyCreateResponse: - """ - Create a new proxy config + """Creates a proxy config. + + The body is a discriminated union on `protocol`: + `socks5` requires name, host, port, user, and password, while `wireguard` + requires name and a config string. Returns the created config with its generated + `proxyId`. Args: extra_headers: Send extra headers @@ -95,8 +99,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyCreateResponse: - """ - Create a new proxy config + """Creates a proxy config. + + The body is a discriminated union on `protocol`: + `socks5` requires name, host, port, user, and password, while `wireguard` + requires name and a config string. Returns the created config with its generated + `proxyId`. Args: extra_headers: Send extra headers @@ -158,8 +166,11 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyRetrieveResponse: - """ - Get a specific proxy config + """Fetches a single proxy config by its `proxyId`. + + The response shape depends on + the proxy's `protocol` (socks5 or wireguard). Returns not found if no matching + config exists. Args: extra_headers: Send extra headers @@ -198,8 +209,11 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyUpdateResponse: - """ - Update a proxy config + """Replaces the proxy config identified by `proxyId` with the provided body. + + As + with creation, the body is a `protocol`-discriminated union of socks5 or + wireguard fields. Returns the updated config. Args: extra_headers: Send extra headers @@ -227,8 +241,11 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyUpdateResponse: - """ - Update a proxy config + """Replaces the proxy config identified by `proxyId` with the provided body. + + As + with creation, the body is a `protocol`-discriminated union of socks5 or + wireguard fields. Returns the updated config. Args: extra_headers: Send extra headers @@ -293,8 +310,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyListResponse: - """ - List all proxy configs for the authenticated user + """Returns all proxy configs for the authenticated user. + + An optional `protocol` + query parameter (`socks5` or `wireguard`) filters the results by proxy type. Args: extra_headers: Send extra headers @@ -329,7 +348,8 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyDeleteResponse: """ - Delete a proxy config + Permanently deletes the proxy config identified by `proxyId` and returns the + deleted config. Returns not found if no matching config exists. Args: extra_headers: Send extra headers @@ -424,8 +444,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyCreateResponse: - """ - Create a new proxy config + """Creates a proxy config. + + The body is a discriminated union on `protocol`: + `socks5` requires name, host, port, user, and password, while `wireguard` + requires name and a config string. Returns the created config with its generated + `proxyId`. Args: extra_headers: Send extra headers @@ -452,8 +476,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyCreateResponse: - """ - Create a new proxy config + """Creates a proxy config. + + The body is a discriminated union on `protocol`: + `socks5` requires name, host, port, user, and password, while `wireguard` + requires name and a config string. Returns the created config with its generated + `proxyId`. Args: extra_headers: Send extra headers @@ -515,8 +543,11 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyRetrieveResponse: - """ - Get a specific proxy config + """Fetches a single proxy config by its `proxyId`. + + The response shape depends on + the proxy's `protocol` (socks5 or wireguard). Returns not found if no matching + config exists. Args: extra_headers: Send extra headers @@ -555,8 +586,11 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyUpdateResponse: - """ - Update a proxy config + """Replaces the proxy config identified by `proxyId` with the provided body. + + As + with creation, the body is a `protocol`-discriminated union of socks5 or + wireguard fields. Returns the updated config. Args: extra_headers: Send extra headers @@ -584,8 +618,11 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyUpdateResponse: - """ - Update a proxy config + """Replaces the proxy config identified by `proxyId` with the provided body. + + As + with creation, the body is a `protocol`-discriminated union of socks5 or + wireguard fields. Returns the updated config. Args: extra_headers: Send extra headers @@ -650,8 +687,10 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyListResponse: - """ - List all proxy configs for the authenticated user + """Returns all proxy configs for the authenticated user. + + An optional `protocol` + query parameter (`socks5` or `wireguard`) filters the results by proxy type. Args: extra_headers: Send extra headers @@ -686,7 +725,8 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyDeleteResponse: """ - Delete a proxy config + Permanently deletes the proxy config identified by `proxyId` and returns the + deleted config. Returns not found if no matching config exists. Args: extra_headers: Send extra headers From a27ba34af6d90312d190b13d5acff3ad92516e2c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:14:25 +0000 Subject: [PATCH 06/10] feat(api): api update --- .stats.yml | 4 +-- src/mobilerun_sdk/_client.py | 30 ------------------- src/mobilerun_sdk/resources/apps.py | 4 --- src/mobilerun_sdk/resources/carriers.py | 4 --- .../resources/credentials/credentials.py | 10 ------- .../packages/credentials/credentials.py | 10 ------- .../packages/credentials/fields.py | 4 --- .../credentials/packages/packages.py | 10 ------- .../resources/devices/devices.py | 6 ---- src/mobilerun_sdk/resources/devices/tasks.py | 4 --- src/mobilerun_sdk/resources/models.py | 4 --- src/mobilerun_sdk/resources/proxies.py | 4 --- 12 files changed, 2 insertions(+), 92 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6707b14..51b40fb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 150 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-e17da55a87b3b95dc9d185b807151e7e238c132afdd168618668ebe247afcec8.yml -openapi_spec_hash: 24a0c6dc866c41647c6a0039a46bffc6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-70ad0f60e0422d84b4bdbd27bdd2a121173efdfae0f78c1dc9abcb23e58e3e8f.yml +openapi_spec_hash: a2d1156ad7d1032b6fffdd6fac29b76b config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/src/mobilerun_sdk/_client.py b/src/mobilerun_sdk/_client.py index 4f5c67e..2412224 100644 --- a/src/mobilerun_sdk/_client.py +++ b/src/mobilerun_sdk/_client.py @@ -135,21 +135,18 @@ def __init__( @cached_property def apps(self) -> AppsResource: - """App Management""" from .resources.apps import AppsResource return AppsResource(self) @cached_property def carriers(self) -> CarriersResource: - """Mobile Carriers""" from .resources.carriers import CarriersResource return CarriersResource(self) @cached_property def credentials(self) -> CredentialsResource: - """Vault & Secrets""" from .resources.credentials import CredentialsResource return CredentialsResource(self) @@ -162,7 +159,6 @@ def devices(self) -> DevicesResource: @cached_property def models(self) -> ModelsResource: - """LLM Models""" from .resources.models import ModelsResource return ModelsResource(self) @@ -175,7 +171,6 @@ def profiles(self) -> ProfilesResource: @cached_property def proxies(self) -> ProxiesResource: - """Network Proxies""" from .resources.proxies import ProxiesResource return ProxiesResource(self) @@ -391,21 +386,18 @@ def __init__( @cached_property def apps(self) -> AsyncAppsResource: - """App Management""" from .resources.apps import AsyncAppsResource return AsyncAppsResource(self) @cached_property def carriers(self) -> AsyncCarriersResource: - """Mobile Carriers""" from .resources.carriers import AsyncCarriersResource return AsyncCarriersResource(self) @cached_property def credentials(self) -> AsyncCredentialsResource: - """Vault & Secrets""" from .resources.credentials import AsyncCredentialsResource return AsyncCredentialsResource(self) @@ -418,7 +410,6 @@ def devices(self) -> AsyncDevicesResource: @cached_property def models(self) -> AsyncModelsResource: - """LLM Models""" from .resources.models import AsyncModelsResource return AsyncModelsResource(self) @@ -431,7 +422,6 @@ def profiles(self) -> AsyncProfilesResource: @cached_property def proxies(self) -> AsyncProxiesResource: - """Network Proxies""" from .resources.proxies import AsyncProxiesResource return AsyncProxiesResource(self) @@ -593,21 +583,18 @@ def __init__(self, client: Mobilerun) -> None: @cached_property def apps(self) -> apps.AppsResourceWithRawResponse: - """App Management""" from .resources.apps import AppsResourceWithRawResponse return AppsResourceWithRawResponse(self._client.apps) @cached_property def carriers(self) -> carriers.CarriersResourceWithRawResponse: - """Mobile Carriers""" from .resources.carriers import CarriersResourceWithRawResponse return CarriersResourceWithRawResponse(self._client.carriers) @cached_property def credentials(self) -> credentials.CredentialsResourceWithRawResponse: - """Vault & Secrets""" from .resources.credentials import CredentialsResourceWithRawResponse return CredentialsResourceWithRawResponse(self._client.credentials) @@ -620,7 +607,6 @@ def devices(self) -> devices.DevicesResourceWithRawResponse: @cached_property def models(self) -> models.ModelsResourceWithRawResponse: - """LLM Models""" from .resources.models import ModelsResourceWithRawResponse return ModelsResourceWithRawResponse(self._client.models) @@ -633,7 +619,6 @@ def profiles(self) -> profiles.ProfilesResourceWithRawResponse: @cached_property def proxies(self) -> proxies.ProxiesResourceWithRawResponse: - """Network Proxies""" from .resources.proxies import ProxiesResourceWithRawResponse return ProxiesResourceWithRawResponse(self._client.proxies) @@ -672,21 +657,18 @@ def __init__(self, client: AsyncMobilerun) -> None: @cached_property def apps(self) -> apps.AsyncAppsResourceWithRawResponse: - """App Management""" from .resources.apps import AsyncAppsResourceWithRawResponse return AsyncAppsResourceWithRawResponse(self._client.apps) @cached_property def carriers(self) -> carriers.AsyncCarriersResourceWithRawResponse: - """Mobile Carriers""" from .resources.carriers import AsyncCarriersResourceWithRawResponse return AsyncCarriersResourceWithRawResponse(self._client.carriers) @cached_property def credentials(self) -> credentials.AsyncCredentialsResourceWithRawResponse: - """Vault & Secrets""" from .resources.credentials import AsyncCredentialsResourceWithRawResponse return AsyncCredentialsResourceWithRawResponse(self._client.credentials) @@ -699,7 +681,6 @@ def devices(self) -> devices.AsyncDevicesResourceWithRawResponse: @cached_property def models(self) -> models.AsyncModelsResourceWithRawResponse: - """LLM Models""" from .resources.models import AsyncModelsResourceWithRawResponse return AsyncModelsResourceWithRawResponse(self._client.models) @@ -712,7 +693,6 @@ def profiles(self) -> profiles.AsyncProfilesResourceWithRawResponse: @cached_property def proxies(self) -> proxies.AsyncProxiesResourceWithRawResponse: - """Network Proxies""" from .resources.proxies import AsyncProxiesResourceWithRawResponse return AsyncProxiesResourceWithRawResponse(self._client.proxies) @@ -751,21 +731,18 @@ def __init__(self, client: Mobilerun) -> None: @cached_property def apps(self) -> apps.AppsResourceWithStreamingResponse: - """App Management""" from .resources.apps import AppsResourceWithStreamingResponse return AppsResourceWithStreamingResponse(self._client.apps) @cached_property def carriers(self) -> carriers.CarriersResourceWithStreamingResponse: - """Mobile Carriers""" from .resources.carriers import CarriersResourceWithStreamingResponse return CarriersResourceWithStreamingResponse(self._client.carriers) @cached_property def credentials(self) -> credentials.CredentialsResourceWithStreamingResponse: - """Vault & Secrets""" from .resources.credentials import CredentialsResourceWithStreamingResponse return CredentialsResourceWithStreamingResponse(self._client.credentials) @@ -778,7 +755,6 @@ def devices(self) -> devices.DevicesResourceWithStreamingResponse: @cached_property def models(self) -> models.ModelsResourceWithStreamingResponse: - """LLM Models""" from .resources.models import ModelsResourceWithStreamingResponse return ModelsResourceWithStreamingResponse(self._client.models) @@ -791,7 +767,6 @@ def profiles(self) -> profiles.ProfilesResourceWithStreamingResponse: @cached_property def proxies(self) -> proxies.ProxiesResourceWithStreamingResponse: - """Network Proxies""" from .resources.proxies import ProxiesResourceWithStreamingResponse return ProxiesResourceWithStreamingResponse(self._client.proxies) @@ -830,21 +805,18 @@ def __init__(self, client: AsyncMobilerun) -> None: @cached_property def apps(self) -> apps.AsyncAppsResourceWithStreamingResponse: - """App Management""" from .resources.apps import AsyncAppsResourceWithStreamingResponse return AsyncAppsResourceWithStreamingResponse(self._client.apps) @cached_property def carriers(self) -> carriers.AsyncCarriersResourceWithStreamingResponse: - """Mobile Carriers""" from .resources.carriers import AsyncCarriersResourceWithStreamingResponse return AsyncCarriersResourceWithStreamingResponse(self._client.carriers) @cached_property def credentials(self) -> credentials.AsyncCredentialsResourceWithStreamingResponse: - """Vault & Secrets""" from .resources.credentials import AsyncCredentialsResourceWithStreamingResponse return AsyncCredentialsResourceWithStreamingResponse(self._client.credentials) @@ -857,7 +829,6 @@ def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse: @cached_property def models(self) -> models.AsyncModelsResourceWithStreamingResponse: - """LLM Models""" from .resources.models import AsyncModelsResourceWithStreamingResponse return AsyncModelsResourceWithStreamingResponse(self._client.models) @@ -870,7 +841,6 @@ def profiles(self) -> profiles.AsyncProfilesResourceWithStreamingResponse: @cached_property def proxies(self) -> proxies.AsyncProxiesResourceWithStreamingResponse: - """Network Proxies""" from .resources.proxies import AsyncProxiesResourceWithStreamingResponse return AsyncProxiesResourceWithStreamingResponse(self._client.proxies) diff --git a/src/mobilerun_sdk/resources/apps.py b/src/mobilerun_sdk/resources/apps.py index 3e2bb8f..f9914fa 100644 --- a/src/mobilerun_sdk/resources/apps.py +++ b/src/mobilerun_sdk/resources/apps.py @@ -31,8 +31,6 @@ class AppsResource(SyncAPIResource): - """App Management""" - @cached_property def with_raw_response(self) -> AppsResourceWithRawResponse: """ @@ -336,8 +334,6 @@ def mark_failed( class AsyncAppsResource(AsyncAPIResource): - """App Management""" - @cached_property def with_raw_response(self) -> AsyncAppsResourceWithRawResponse: """ diff --git a/src/mobilerun_sdk/resources/carriers.py b/src/mobilerun_sdk/resources/carriers.py index d627159..a674b8f 100644 --- a/src/mobilerun_sdk/resources/carriers.py +++ b/src/mobilerun_sdk/resources/carriers.py @@ -29,8 +29,6 @@ class CarriersResource(SyncAPIResource): - """Mobile Carriers""" - @cached_property def with_raw_response(self) -> CarriersResourceWithRawResponse: """ @@ -419,8 +417,6 @@ def lookup( class AsyncCarriersResource(AsyncAPIResource): - """Mobile Carriers""" - @cached_property def with_raw_response(self) -> AsyncCarriersResourceWithRawResponse: """ diff --git a/src/mobilerun_sdk/resources/credentials/credentials.py b/src/mobilerun_sdk/resources/credentials/credentials.py index ab4f945..33a0594 100644 --- a/src/mobilerun_sdk/resources/credentials/credentials.py +++ b/src/mobilerun_sdk/resources/credentials/credentials.py @@ -30,11 +30,8 @@ class CredentialsResource(SyncAPIResource): - """Vault & Secrets""" - @cached_property def packages(self) -> PackagesResource: - """Vault & Secrets""" return PackagesResource(self._client) @cached_property @@ -102,11 +99,8 @@ def list( class AsyncCredentialsResource(AsyncAPIResource): - """Vault & Secrets""" - @cached_property def packages(self) -> AsyncPackagesResource: - """Vault & Secrets""" return AsyncPackagesResource(self._client) @cached_property @@ -183,7 +177,6 @@ def __init__(self, credentials: CredentialsResource) -> None: @cached_property def packages(self) -> PackagesResourceWithRawResponse: - """Vault & Secrets""" return PackagesResourceWithRawResponse(self._credentials.packages) @@ -197,7 +190,6 @@ def __init__(self, credentials: AsyncCredentialsResource) -> None: @cached_property def packages(self) -> AsyncPackagesResourceWithRawResponse: - """Vault & Secrets""" return AsyncPackagesResourceWithRawResponse(self._credentials.packages) @@ -211,7 +203,6 @@ def __init__(self, credentials: CredentialsResource) -> None: @cached_property def packages(self) -> PackagesResourceWithStreamingResponse: - """Vault & Secrets""" return PackagesResourceWithStreamingResponse(self._credentials.packages) @@ -225,5 +216,4 @@ def __init__(self, credentials: AsyncCredentialsResource) -> None: @cached_property def packages(self) -> AsyncPackagesResourceWithStreamingResponse: - """Vault & Secrets""" return AsyncPackagesResourceWithStreamingResponse(self._credentials.packages) diff --git a/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py b/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py index 51aefb3..afbe1bc 100644 --- a/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py +++ b/src/mobilerun_sdk/resources/credentials/packages/credentials/credentials.py @@ -34,11 +34,8 @@ class CredentialsResource(SyncAPIResource): - """Vault & Secrets""" - @cached_property def fields(self) -> FieldsResource: - """Vault & Secrets""" return FieldsResource(self._client) @cached_property @@ -188,11 +185,8 @@ def delete( class AsyncCredentialsResource(AsyncAPIResource): - """Vault & Secrets""" - @cached_property def fields(self) -> AsyncFieldsResource: - """Vault & Secrets""" return AsyncFieldsResource(self._client) @cached_property @@ -357,7 +351,6 @@ def __init__(self, credentials: CredentialsResource) -> None: @cached_property def fields(self) -> FieldsResourceWithRawResponse: - """Vault & Secrets""" return FieldsResourceWithRawResponse(self._credentials.fields) @@ -377,7 +370,6 @@ def __init__(self, credentials: AsyncCredentialsResource) -> None: @cached_property def fields(self) -> AsyncFieldsResourceWithRawResponse: - """Vault & Secrets""" return AsyncFieldsResourceWithRawResponse(self._credentials.fields) @@ -397,7 +389,6 @@ def __init__(self, credentials: CredentialsResource) -> None: @cached_property def fields(self) -> FieldsResourceWithStreamingResponse: - """Vault & Secrets""" return FieldsResourceWithStreamingResponse(self._credentials.fields) @@ -417,5 +408,4 @@ def __init__(self, credentials: AsyncCredentialsResource) -> None: @cached_property def fields(self) -> AsyncFieldsResourceWithStreamingResponse: - """Vault & Secrets""" return AsyncFieldsResourceWithStreamingResponse(self._credentials.fields) diff --git a/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py b/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py index ace7489..34acdff 100644 --- a/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py +++ b/src/mobilerun_sdk/resources/credentials/packages/credentials/fields.py @@ -26,8 +26,6 @@ class FieldsResource(SyncAPIResource): - """Vault & Secrets""" - @cached_property def with_raw_response(self) -> FieldsResourceWithRawResponse: """ @@ -200,8 +198,6 @@ def delete( class AsyncFieldsResource(AsyncAPIResource): - """Vault & Secrets""" - @cached_property def with_raw_response(self) -> AsyncFieldsResourceWithRawResponse: """ diff --git a/src/mobilerun_sdk/resources/credentials/packages/packages.py b/src/mobilerun_sdk/resources/credentials/packages/packages.py index d44a159..d82ed0e 100644 --- a/src/mobilerun_sdk/resources/credentials/packages/packages.py +++ b/src/mobilerun_sdk/resources/credentials/packages/packages.py @@ -31,11 +31,8 @@ class PackagesResource(SyncAPIResource): - """Vault & Secrets""" - @cached_property def credentials(self) -> CredentialsResource: - """Vault & Secrets""" return CredentialsResource(self._client) @cached_property @@ -128,11 +125,8 @@ def list( class AsyncPackagesResource(AsyncAPIResource): - """Vault & Secrets""" - @cached_property def credentials(self) -> AsyncCredentialsResource: - """Vault & Secrets""" return AsyncCredentialsResource(self._client) @cached_property @@ -237,7 +231,6 @@ def __init__(self, packages: PackagesResource) -> None: @cached_property def credentials(self) -> CredentialsResourceWithRawResponse: - """Vault & Secrets""" return CredentialsResourceWithRawResponse(self._packages.credentials) @@ -254,7 +247,6 @@ def __init__(self, packages: AsyncPackagesResource) -> None: @cached_property def credentials(self) -> AsyncCredentialsResourceWithRawResponse: - """Vault & Secrets""" return AsyncCredentialsResourceWithRawResponse(self._packages.credentials) @@ -271,7 +263,6 @@ def __init__(self, packages: PackagesResource) -> None: @cached_property def credentials(self) -> CredentialsResourceWithStreamingResponse: - """Vault & Secrets""" return CredentialsResourceWithStreamingResponse(self._packages.credentials) @@ -288,5 +279,4 @@ def __init__(self, packages: AsyncPackagesResource) -> None: @cached_property def credentials(self) -> AsyncCredentialsResourceWithStreamingResponse: - """Vault & Secrets""" return AsyncCredentialsResourceWithStreamingResponse(self._packages.credentials) diff --git a/src/mobilerun_sdk/resources/devices/devices.py b/src/mobilerun_sdk/resources/devices/devices.py index 9837a6f..866f29c 100644 --- a/src/mobilerun_sdk/resources/devices/devices.py +++ b/src/mobilerun_sdk/resources/devices/devices.py @@ -178,7 +178,6 @@ def state(self) -> StateResource: @cached_property def tasks(self) -> TasksResource: - """Device Management""" return TasksResource(self._client) @cached_property @@ -672,7 +671,6 @@ def state(self) -> AsyncStateResource: @cached_property def tasks(self) -> AsyncTasksResource: - """Device Management""" return AsyncTasksResource(self._client) @cached_property @@ -1200,7 +1198,6 @@ def state(self) -> StateResourceWithRawResponse: @cached_property def tasks(self) -> TasksResourceWithRawResponse: - """Device Management""" return TasksResourceWithRawResponse(self._devices.tasks) @cached_property @@ -1289,7 +1286,6 @@ def state(self) -> AsyncStateResourceWithRawResponse: @cached_property def tasks(self) -> AsyncTasksResourceWithRawResponse: - """Device Management""" return AsyncTasksResourceWithRawResponse(self._devices.tasks) @cached_property @@ -1378,7 +1374,6 @@ def state(self) -> StateResourceWithStreamingResponse: @cached_property def tasks(self) -> TasksResourceWithStreamingResponse: - """Device Management""" return TasksResourceWithStreamingResponse(self._devices.tasks) @cached_property @@ -1467,7 +1462,6 @@ def state(self) -> AsyncStateResourceWithStreamingResponse: @cached_property def tasks(self) -> AsyncTasksResourceWithStreamingResponse: - """Device Management""" return AsyncTasksResourceWithStreamingResponse(self._devices.tasks) @cached_property diff --git a/src/mobilerun_sdk/resources/devices/tasks.py b/src/mobilerun_sdk/resources/devices/tasks.py index 061d2ca..62c8d6f 100644 --- a/src/mobilerun_sdk/resources/devices/tasks.py +++ b/src/mobilerun_sdk/resources/devices/tasks.py @@ -24,8 +24,6 @@ class TasksResource(SyncAPIResource): - """Device Management""" - @cached_property def with_raw_response(self) -> TasksResourceWithRawResponse: """ @@ -96,8 +94,6 @@ def list( class AsyncTasksResource(AsyncAPIResource): - """Device Management""" - @cached_property def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: """ diff --git a/src/mobilerun_sdk/resources/models.py b/src/mobilerun_sdk/resources/models.py index 4bb2764..d1edbdd 100644 --- a/src/mobilerun_sdk/resources/models.py +++ b/src/mobilerun_sdk/resources/models.py @@ -20,8 +20,6 @@ class ModelsResource(SyncAPIResource): - """LLM Models""" - @cached_property def with_raw_response(self) -> ModelsResourceWithRawResponse: """ @@ -62,8 +60,6 @@ def list( class AsyncModelsResource(AsyncAPIResource): - """LLM Models""" - @cached_property def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: """ diff --git a/src/mobilerun_sdk/resources/proxies.py b/src/mobilerun_sdk/resources/proxies.py index bb15409..45a990d 100644 --- a/src/mobilerun_sdk/resources/proxies.py +++ b/src/mobilerun_sdk/resources/proxies.py @@ -29,8 +29,6 @@ class ProxiesResource(SyncAPIResource): - """Network Proxies""" - @cached_property def with_raw_response(self) -> ProxiesResourceWithRawResponse: """ @@ -406,8 +404,6 @@ def lookup( class AsyncProxiesResource(AsyncAPIResource): - """Network Proxies""" - @cached_property def with_raw_response(self) -> AsyncProxiesResourceWithRawResponse: """ From e6f7facbcedbc95d47024b3b4d36851a4c292337 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 17:14:22 +0000 Subject: [PATCH 07/10] feat(api): api update --- .stats.yml | 4 +- src/mobilerun_sdk/_client.py | 6 ++ src/mobilerun_sdk/resources/models.py | 4 + .../resources/webhooks/deliveries.py | 36 ++++++-- .../resources/webhooks/webhooks.py | 82 ++++++++++++++----- .../resources/workflows/action_catalog.py | 14 +++- .../resources/workflows/actions/actions.py | 52 +++++++----- .../resources/workflows/actions/services.py | 20 ++++- .../resources/workflows/events.py | 10 +-- .../resources/workflows/executions.py | 28 +++++-- .../resources/workflows/flows/actions.py | 38 ++++++--- .../resources/workflows/flows/flows.py | 64 +++++++++++---- .../resources/workflows/triggers.py | 60 +++++++++----- .../types/workflows/action_create_params.py | 4 +- .../types/workflows/action_update_params.py | 4 +- .../types/workflows/event_dry_run_params.py | 4 +- .../types/workflows/event_dry_run_response.py | 20 +---- .../types/workflows/event_ingest_params.py | 4 +- .../workflows/flow_action_overrides_param.py | 4 +- .../types/workflows/flows/flow_action.py | 2 +- .../workflows/trigger_create_response.py | 2 +- .../types/workflows/trigger_list_response.py | 17 +--- .../workflows/trigger_retrieve_response.py | 17 +--- .../types/workflows/trigger_update_params.py | 3 +- .../workflows/trigger_update_response.py | 17 +--- 25 files changed, 320 insertions(+), 196 deletions(-) diff --git a/.stats.yml b/.stats.yml index 51b40fb..5fb7cdf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 150 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-70ad0f60e0422d84b4bdbd27bdd2a121173efdfae0f78c1dc9abcb23e58e3e8f.yml -openapi_spec_hash: a2d1156ad7d1032b6fffdd6fac29b76b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-22153e7538d36d4d095f497846427b58e83d4fd16e104cbe0c315d90eed2a1d4.yml +openapi_spec_hash: 5ee2c119ab7425fb55941fcf7ff1211d config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/src/mobilerun_sdk/_client.py b/src/mobilerun_sdk/_client.py index 2412224..2ac5304 100644 --- a/src/mobilerun_sdk/_client.py +++ b/src/mobilerun_sdk/_client.py @@ -159,6 +159,7 @@ def devices(self) -> DevicesResource: @cached_property def models(self) -> ModelsResource: + """LLM Models""" from .resources.models import ModelsResource return ModelsResource(self) @@ -410,6 +411,7 @@ def devices(self) -> AsyncDevicesResource: @cached_property def models(self) -> AsyncModelsResource: + """LLM Models""" from .resources.models import AsyncModelsResource return AsyncModelsResource(self) @@ -607,6 +609,7 @@ def devices(self) -> devices.DevicesResourceWithRawResponse: @cached_property def models(self) -> models.ModelsResourceWithRawResponse: + """LLM Models""" from .resources.models import ModelsResourceWithRawResponse return ModelsResourceWithRawResponse(self._client.models) @@ -681,6 +684,7 @@ def devices(self) -> devices.AsyncDevicesResourceWithRawResponse: @cached_property def models(self) -> models.AsyncModelsResourceWithRawResponse: + """LLM Models""" from .resources.models import AsyncModelsResourceWithRawResponse return AsyncModelsResourceWithRawResponse(self._client.models) @@ -755,6 +759,7 @@ def devices(self) -> devices.DevicesResourceWithStreamingResponse: @cached_property def models(self) -> models.ModelsResourceWithStreamingResponse: + """LLM Models""" from .resources.models import ModelsResourceWithStreamingResponse return ModelsResourceWithStreamingResponse(self._client.models) @@ -829,6 +834,7 @@ def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse: @cached_property def models(self) -> models.AsyncModelsResourceWithStreamingResponse: + """LLM Models""" from .resources.models import AsyncModelsResourceWithStreamingResponse return AsyncModelsResourceWithStreamingResponse(self._client.models) diff --git a/src/mobilerun_sdk/resources/models.py b/src/mobilerun_sdk/resources/models.py index d1edbdd..4bb2764 100644 --- a/src/mobilerun_sdk/resources/models.py +++ b/src/mobilerun_sdk/resources/models.py @@ -20,6 +20,8 @@ class ModelsResource(SyncAPIResource): + """LLM Models""" + @cached_property def with_raw_response(self) -> ModelsResourceWithRawResponse: """ @@ -60,6 +62,8 @@ def list( class AsyncModelsResource(AsyncAPIResource): + """LLM Models""" + @cached_property def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: """ diff --git a/src/mobilerun_sdk/resources/webhooks/deliveries.py b/src/mobilerun_sdk/resources/webhooks/deliveries.py index 6f0e6a3..8ad45fa 100644 --- a/src/mobilerun_sdk/resources/webhooks/deliveries.py +++ b/src/mobilerun_sdk/resources/webhooks/deliveries.py @@ -63,7 +63,10 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryListResponse: """ - List deliveries across all your webhooks + Returns a paginated feed of webhook deliveries across all of your subscriptions, + with the originating endpoint URL included on each record. Results can be + filtered by delivery status (pending, success, skipped, or dead) and by a + `since` timestamp. Args: extra_headers: Send extra headers @@ -108,7 +111,9 @@ def list_for_webhook( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryListForWebhookResponse: """ - List deliveries for a webhook + Returns a paginated list of deliveries for a single webhook subscription, + identified by its id. Each record reports the event, delivery status, attempt + count, and the last response code or error. Args: extra_headers: Send extra headers @@ -152,7 +157,9 @@ def retrieve_attempts( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryRetrieveAttemptsResponse: """ - Get a delivery with its attempts + Returns a single delivery for a webhook subscription along with the full list of + captured attempt records. Each attempt includes the request URL, method, headers + and body, whether it was signed, and the response status, headers, and snippet. Args: extra_headers: Send extra headers @@ -187,7 +194,10 @@ def stats( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryStatsResponse: """ - Aggregate delivery statistics (excludes test sends) + Returns aggregate delivery statistics across all of your webhooks, including the + total count, a breakdown by status (pending, success, skipped, dead), and the + overall success rate. An optional `since` timestamp narrows the reporting + window. Args: extra_headers: Send extra headers @@ -246,7 +256,10 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryListResponse: """ - List deliveries across all your webhooks + Returns a paginated feed of webhook deliveries across all of your subscriptions, + with the originating endpoint URL included on each record. Results can be + filtered by delivery status (pending, success, skipped, or dead) and by a + `since` timestamp. Args: extra_headers: Send extra headers @@ -291,7 +304,9 @@ async def list_for_webhook( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryListForWebhookResponse: """ - List deliveries for a webhook + Returns a paginated list of deliveries for a single webhook subscription, + identified by its id. Each record reports the event, delivery status, attempt + count, and the last response code or error. Args: extra_headers: Send extra headers @@ -335,7 +350,9 @@ async def retrieve_attempts( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryRetrieveAttemptsResponse: """ - Get a delivery with its attempts + Returns a single delivery for a webhook subscription along with the full list of + captured attempt records. Each attempt includes the request URL, method, headers + and body, whether it was signed, and the response status, headers, and snippet. Args: extra_headers: Send extra headers @@ -370,7 +387,10 @@ async def stats( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeliveryStatsResponse: """ - Aggregate delivery statistics (excludes test sends) + Returns aggregate delivery statistics across all of your webhooks, including the + total count, a breakdown by status (pending, success, skipped, dead), and the + overall success rate. An optional `since` timestamp narrows the reporting + window. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/webhooks/webhooks.py b/src/mobilerun_sdk/resources/webhooks/webhooks.py index 259c19b..524a188 100644 --- a/src/mobilerun_sdk/resources/webhooks/webhooks.py +++ b/src/mobilerun_sdk/resources/webhooks/webhooks.py @@ -76,7 +76,10 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookCreateResponse: """ - Register a webhook subscription + Creates a webhook subscription with a delivery URL and an optional list of event + types to subscribe to (defaults to all when omitted). The response includes the + generated signing secret, which is returned only once at creation time and + cannot be retrieved later. Args: extra_headers: Send extra headers @@ -115,7 +118,9 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookRetrieveResponse: """ - Get a webhook subscription + Returns a single webhook subscription by id, including its URL, subscribed event + types, state, and system-observed delivery health. The signing secret is never + included. Args: extra_headers: Send extra headers @@ -150,8 +155,12 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookUpdateResponse: - """ - Update a webhook subscription + """Updates a webhook subscription. + + Any combination of the subscribed event types, + state (ACTIVE or DISABLED), and description may be changed, and at least one + field must be supplied. Setting state to ACTIVE re-enables a subscription that + was auto-blocked after sustained delivery failures. Args: extra_headers: Send extra headers @@ -194,7 +203,9 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookListResponse: """ - List your webhook subscriptions + Returns a paginated list of your webhook subscriptions, optionally filtered by + status (active, failing, blocked, or disabled). The response also includes + per-status counts across all of your subscriptions. Args: extra_headers: Send extra headers @@ -235,8 +246,10 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """ - Delete a webhook subscription + """Deletes a webhook subscription so it stops receiving deliveries. + + Returns 204 No + Content on success. Args: extra_headers: Send extra headers @@ -268,7 +281,11 @@ def event_types( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookEventTypesResponse: - """List subscribable event types per source""" + """ + Returns the catalog of event types that webhook subscriptions can subscribe to, + grouped by source. Use the returned type identifiers as the `eventTypes` values + when creating or updating a webhook. + """ return self._get( "/event-types", options=make_request_options( @@ -289,7 +306,9 @@ def rotate_secret( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookRotateSecretResponse: """ - Rotate the signing secret (returned once) + Generates a new signing secret for the webhook subscription and returns it once + in the response. The previous secret is replaced immediately, so any signature + verification on your endpoint must be updated to use the new value. Args: extra_headers: Send extra headers @@ -322,7 +341,9 @@ def test_delivery( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookTestDeliveryResponse: """ - Send a one-shot test delivery + Sends a single test payload to the webhook subscription URL to verify + connectivity. The response reports whether the attempt succeeded along with the + returned HTTP status code or error, if any. Args: extra_headers: Send extra headers @@ -382,7 +403,10 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookCreateResponse: """ - Register a webhook subscription + Creates a webhook subscription with a delivery URL and an optional list of event + types to subscribe to (defaults to all when omitted). The response includes the + generated signing secret, which is returned only once at creation time and + cannot be retrieved later. Args: extra_headers: Send extra headers @@ -421,7 +445,9 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookRetrieveResponse: """ - Get a webhook subscription + Returns a single webhook subscription by id, including its URL, subscribed event + types, state, and system-observed delivery health. The signing secret is never + included. Args: extra_headers: Send extra headers @@ -456,8 +482,12 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookUpdateResponse: - """ - Update a webhook subscription + """Updates a webhook subscription. + + Any combination of the subscribed event types, + state (ACTIVE or DISABLED), and description may be changed, and at least one + field must be supplied. Setting state to ACTIVE re-enables a subscription that + was auto-blocked after sustained delivery failures. Args: extra_headers: Send extra headers @@ -500,7 +530,9 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookListResponse: """ - List your webhook subscriptions + Returns a paginated list of your webhook subscriptions, optionally filtered by + status (active, failing, blocked, or disabled). The response also includes + per-status counts across all of your subscriptions. Args: extra_headers: Send extra headers @@ -541,8 +573,10 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """ - Delete a webhook subscription + """Deletes a webhook subscription so it stops receiving deliveries. + + Returns 204 No + Content on success. Args: extra_headers: Send extra headers @@ -574,7 +608,11 @@ async def event_types( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookEventTypesResponse: - """List subscribable event types per source""" + """ + Returns the catalog of event types that webhook subscriptions can subscribe to, + grouped by source. Use the returned type identifiers as the `eventTypes` values + when creating or updating a webhook. + """ return await self._get( "/event-types", options=make_request_options( @@ -595,7 +633,9 @@ async def rotate_secret( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookRotateSecretResponse: """ - Rotate the signing secret (returned once) + Generates a new signing secret for the webhook subscription and returns it once + in the response. The previous secret is replaced immediately, so any signature + verification on your endpoint must be updated to use the new value. Args: extra_headers: Send extra headers @@ -628,7 +668,9 @@ async def test_delivery( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookTestDeliveryResponse: """ - Send a one-shot test delivery + Sends a single test payload to the webhook subscription URL to verify + connectivity. The response reports whether the attempt succeeded along with the + returned HTTP status code or error, if any. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/workflows/action_catalog.py b/src/mobilerun_sdk/resources/workflows/action_catalog.py index b637dd4..da75896 100644 --- a/src/mobilerun_sdk/resources/workflows/action_catalog.py +++ b/src/mobilerun_sdk/resources/workflows/action_catalog.py @@ -56,7 +56,8 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionCatalogRetrieveResponse: """ - Get a catalog entry + Fetch a single action catalog entry by its ID, including its service, method, + and parameter schema. Returns 404 if no entry matches. Args: extra_headers: Send extra headers @@ -91,7 +92,9 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionCatalogListResponse: """ - List action catalog entries + Return a paginated list of catalog entries — the service/method templates that + actions are created from, each carrying its parameter schema. Supports filtering + by `service`. Args: extra_headers: Send extra headers @@ -154,7 +157,8 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionCatalogRetrieveResponse: """ - Get a catalog entry + Fetch a single action catalog entry by its ID, including its service, method, + and parameter schema. Returns 404 if no entry matches. Args: extra_headers: Send extra headers @@ -189,7 +193,9 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionCatalogListResponse: """ - List action catalog entries + Return a paginated list of catalog entries — the service/method templates that + actions are created from, each carrying its parameter schema. Supports filtering + by `service`. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/workflows/actions/actions.py b/src/mobilerun_sdk/resources/workflows/actions/actions.py index 2b4723a..d99bbf4 100644 --- a/src/mobilerun_sdk/resources/workflows/actions/actions.py +++ b/src/mobilerun_sdk/resources/workflows/actions/actions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import Literal import httpx @@ -66,7 +66,7 @@ def create( catalog_entry_id: str, name: str, description: str | Omit = omit, - params: Dict[str, Optional[object]] | Omit = omit, + params: Dict[str, object] | 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, @@ -75,7 +75,9 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionCreateResponse: """ - Create an action + Create a reusable action from a catalog entry (`catalogEntryId`), with an + optional `params` object supplying the values for that entry's service method. + Returns 400 if the params are invalid for the chosen catalog entry. Args: extra_headers: Send extra headers @@ -115,7 +117,8 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionRetrieveResponse: """ - Get an action + Fetch a single action by its ID, including its configured service, method, and + params. Returns 404 if no action matches. Args: extra_headers: Send extra headers @@ -142,7 +145,7 @@ def update( *, description: str | Omit = omit, name: str | Omit = omit, - params: Dict[str, Optional[object]] | Omit = omit, + params: Dict[str, object] | 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, @@ -151,7 +154,8 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionUpdateResponse: """ - Update an action + Partially update an action's name, description, or params; all fields are + optional. Returns 404 if the action does not exist. Args: extra_headers: Send extra headers @@ -196,8 +200,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionListResponse: - """ - List actions + """Return a paginated list of actions. + + Supports filtering by `service`, free-text + `search`, and ordering by name, createdAt, or updatedAt. Args: extra_headers: Send extra headers @@ -241,8 +247,9 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionDeleteResponse: - """ - Delete an action + """Delete an action by its ID. + + Returns 404 if no action matches. Args: extra_headers: Send extra headers @@ -294,7 +301,7 @@ async def create( catalog_entry_id: str, name: str, description: str | Omit = omit, - params: Dict[str, Optional[object]] | Omit = omit, + params: Dict[str, object] | 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, @@ -303,7 +310,9 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionCreateResponse: """ - Create an action + Create a reusable action from a catalog entry (`catalogEntryId`), with an + optional `params` object supplying the values for that entry's service method. + Returns 400 if the params are invalid for the chosen catalog entry. Args: extra_headers: Send extra headers @@ -343,7 +352,8 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionRetrieveResponse: """ - Get an action + Fetch a single action by its ID, including its configured service, method, and + params. Returns 404 if no action matches. Args: extra_headers: Send extra headers @@ -370,7 +380,7 @@ async def update( *, description: str | Omit = omit, name: str | Omit = omit, - params: Dict[str, Optional[object]] | Omit = omit, + params: Dict[str, object] | 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, @@ -379,7 +389,8 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionUpdateResponse: """ - Update an action + Partially update an action's name, description, or params; all fields are + optional. Returns 404 if the action does not exist. Args: extra_headers: Send extra headers @@ -424,8 +435,10 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionListResponse: - """ - List actions + """Return a paginated list of actions. + + Supports filtering by `service`, free-text + `search`, and ordering by name, createdAt, or updatedAt. Args: extra_headers: Send extra headers @@ -469,8 +482,9 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionDeleteResponse: - """ - Delete an action + """Delete an action by its ID. + + Returns 404 if no action matches. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/workflows/actions/services.py b/src/mobilerun_sdk/resources/workflows/actions/services.py index fd46c48..c96a5ba 100644 --- a/src/mobilerun_sdk/resources/workflows/actions/services.py +++ b/src/mobilerun_sdk/resources/workflows/actions/services.py @@ -51,7 +51,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ServiceListResponse: - """List available services""" + """Return the names of the services that actions can be built against. + + Use these + values to look up each service's allowed methods. + """ return self._get( "/actions/services", options=make_request_options( @@ -72,7 +76,9 @@ def list_methods( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ServiceListMethodsResponse: """ - List allowed methods for a service + Return the methods allowed for the given service, each with its parameter + definitions (name, type, whether required, description, and optional + default/example). Returns 404 if the service is unknown. Args: extra_headers: Send extra headers @@ -124,7 +130,11 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ServiceListResponse: - """List available services""" + """Return the names of the services that actions can be built against. + + Use these + values to look up each service's allowed methods. + """ return await self._get( "/actions/services", options=make_request_options( @@ -145,7 +155,9 @@ async def list_methods( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ServiceListMethodsResponse: """ - List allowed methods for a service + Return the methods allowed for the given service, each with its parameter + definitions (name, type, whether required, description, and optional + default/example). Returns 404 if the service is unknown. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/workflows/events.py b/src/mobilerun_sdk/resources/workflows/events.py index 34c5350..b585ec6 100644 --- a/src/mobilerun_sdk/resources/workflows/events.py +++ b/src/mobilerun_sdk/resources/workflows/events.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict import httpx @@ -49,7 +49,7 @@ def dry_run( *, event_type: str, device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | Omit = omit, + payload: Dict[str, object] | 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, @@ -92,7 +92,7 @@ def ingest( *, event_type: str, device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | Omit = omit, + payload: Dict[str, object] | 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, @@ -155,7 +155,7 @@ async def dry_run( *, event_type: str, device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | Omit = omit, + payload: Dict[str, object] | 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, @@ -198,7 +198,7 @@ async def ingest( *, event_type: str, device_id: str | Omit = omit, - payload: Dict[str, Optional[object]] | Omit = omit, + payload: Dict[str, object] | 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, diff --git a/src/mobilerun_sdk/resources/workflows/executions.py b/src/mobilerun_sdk/resources/workflows/executions.py index 4d12f2d..c8a4840 100644 --- a/src/mobilerun_sdk/resources/workflows/executions.py +++ b/src/mobilerun_sdk/resources/workflows/executions.py @@ -58,7 +58,8 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExecutionRetrieveResponse: """ - Get execution details + Fetch a single flow execution by its ID, including its status, kind, result or + error, and start/finish timestamps. Returns 404 if no execution matches. Args: extra_headers: Send extra headers @@ -99,8 +100,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExecutionListResponse: - """ - List flow executions + """Return a paginated history of flow executions. + + Supports filtering by `flowId`, + `triggerId`, `status`, and a `from`/`to` time range, plus free-text `search` and + ordering by startedAt, finishedAt, or status. Args: extra_headers: Send extra headers @@ -152,7 +156,9 @@ def get_metrics( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExecutionGetMetricsResponse: """ - Get execution metrics + Return aggregate execution metrics — total count, counts by status, average + duration, and the last execution time. Can be scoped by `flowId`, `triggerId`, + and a `from`/`to` time range. Args: extra_headers: Send extra headers @@ -216,7 +222,8 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExecutionRetrieveResponse: """ - Get execution details + Fetch a single flow execution by its ID, including its status, kind, result or + error, and start/finish timestamps. Returns 404 if no execution matches. Args: extra_headers: Send extra headers @@ -257,8 +264,11 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExecutionListResponse: - """ - List flow executions + """Return a paginated history of flow executions. + + Supports filtering by `flowId`, + `triggerId`, `status`, and a `from`/`to` time range, plus free-text `search` and + ordering by startedAt, finishedAt, or status. Args: extra_headers: Send extra headers @@ -310,7 +320,9 @@ async def get_metrics( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExecutionGetMetricsResponse: """ - Get execution metrics + Return aggregate execution metrics — total count, counts by status, average + duration, and the last execution time. Can be scoped by `flowId`, `triggerId`, + and a `from`/`to` time range. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/workflows/flows/actions.py b/src/mobilerun_sdk/resources/workflows/flows/actions.py index 06e3278..cec5aa4 100644 --- a/src/mobilerun_sdk/resources/workflows/flows/actions.py +++ b/src/mobilerun_sdk/resources/workflows/flows/actions.py @@ -60,7 +60,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionListResponse: """ - List actions for a flow + Return the ordered list of actions attached to a flow, including any nested + child actions. Returns 404 if the flow does not exist. Args: extra_headers: Send extra headers @@ -100,7 +101,10 @@ def add( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionAddResponse: """ - Add an action to a flow + Append a single action to a flow at the given `position`, optionally nesting it + under a `parentFlowActionId` or supplying its own `children`. Supports a + `nameOverride`, param `overrides`, and `continueOnError`. Returns 404 if the + flow does not exist. Args: extra_headers: Send extra headers @@ -145,8 +149,10 @@ def remove( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionRemoveResponse: - """ - Remove an action from a flow + """Remove a single action from a flow by its `flowActionId`. + + Returns 404 if the + flow or flow action does not exist. Args: extra_headers: Send extra headers @@ -182,7 +188,10 @@ def replace( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionReplaceResponse: """ - Replace all actions for a flow + Replace a flow's entire action list with the supplied set (at least one + required). Each action references an `actionId` and a unique `position`, and may + include nested `children`, a `nameOverride`, param `overrides`, and a + `continueOnError` flag. Returns 404 if the flow does not exist. Args: extra_headers: Send extra headers @@ -237,7 +246,8 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionListResponse: """ - List actions for a flow + Return the ordered list of actions attached to a flow, including any nested + child actions. Returns 404 if the flow does not exist. Args: extra_headers: Send extra headers @@ -277,7 +287,10 @@ async def add( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionAddResponse: """ - Add an action to a flow + Append a single action to a flow at the given `position`, optionally nesting it + under a `parentFlowActionId` or supplying its own `children`. Supports a + `nameOverride`, param `overrides`, and `continueOnError`. Returns 404 if the + flow does not exist. Args: extra_headers: Send extra headers @@ -322,8 +335,10 @@ async def remove( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionRemoveResponse: - """ - Remove an action from a flow + """Remove a single action from a flow by its `flowActionId`. + + Returns 404 if the + flow or flow action does not exist. Args: extra_headers: Send extra headers @@ -359,7 +374,10 @@ async def replace( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ActionReplaceResponse: """ - Replace all actions for a flow + Replace a flow's entire action list with the supplied set (at least one + required). Each action references an `actionId` and a unique `position`, and may + include nested `children`, a `nameOverride`, param `overrides`, and a + `continueOnError` flag. Returns 404 if the flow does not exist. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/workflows/flows/flows.py b/src/mobilerun_sdk/resources/workflows/flows/flows.py index c1acea9..9129d93 100644 --- a/src/mobilerun_sdk/resources/workflows/flows/flows.py +++ b/src/mobilerun_sdk/resources/workflows/flows/flows.py @@ -84,7 +84,10 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowCreateResponse: """ - Create a flow + Create a flow that binds a trigger (`triggerId`) to an ordered list of actions, + with at least one action required. Optional settings include target `deviceIds`, + a cooldown (`cooldownSeconds`/`cooldownScope`), and webhook notifications on + success or failure. Args: extra_headers: Send extra headers @@ -131,7 +134,8 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowRetrieveResponse: """ - Get a flow + Fetch a single flow by its ID, including its trigger binding, configuration, and + current status. Returns 404 if no flow matches. Args: extra_headers: Send extra headers @@ -174,7 +178,10 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowUpdateResponse: """ - Update a flow + Partially update a flow's settings — name, trigger binding, enabled state, + target devices, cooldown, or notifications; all fields are optional. Actions are + managed through the flow-actions endpoints, not here. Returns 404 if the flow + does not exist. Args: extra_headers: Send extra headers @@ -228,8 +235,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowListResponse: - """ - List flows + """Return a paginated list of flows. + + Supports filtering by `triggerId`, `enabled`, + and one or more health `status` values (healthy, failing, blocked), plus + free-text `search` and ordering. Args: extra_headers: Send extra headers @@ -275,8 +285,9 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowDeleteResponse: - """ - Delete a flow + """Delete a flow by its ID. + + Returns 404 if no flow matches. Args: extra_headers: Send extra headers @@ -310,8 +321,11 @@ def clone( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowCloneResponse: - """ - Clone a flow + """Create a copy of an existing flow, including its actions and settings. + + The + optional body can override the new flow's `name` and target `deviceIds`. Returns + 404 if the source flow does not exist. Args: extra_headers: Send extra headers @@ -421,7 +435,10 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowCreateResponse: """ - Create a flow + Create a flow that binds a trigger (`triggerId`) to an ordered list of actions, + with at least one action required. Optional settings include target `deviceIds`, + a cooldown (`cooldownSeconds`/`cooldownScope`), and webhook notifications on + success or failure. Args: extra_headers: Send extra headers @@ -468,7 +485,8 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowRetrieveResponse: """ - Get a flow + Fetch a single flow by its ID, including its trigger binding, configuration, and + current status. Returns 404 if no flow matches. Args: extra_headers: Send extra headers @@ -511,7 +529,10 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowUpdateResponse: """ - Update a flow + Partially update a flow's settings — name, trigger binding, enabled state, + target devices, cooldown, or notifications; all fields are optional. Actions are + managed through the flow-actions endpoints, not here. Returns 404 if the flow + does not exist. Args: extra_headers: Send extra headers @@ -565,8 +586,11 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowListResponse: - """ - List flows + """Return a paginated list of flows. + + Supports filtering by `triggerId`, `enabled`, + and one or more health `status` values (healthy, failing, blocked), plus + free-text `search` and ordering. Args: extra_headers: Send extra headers @@ -612,8 +636,9 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowDeleteResponse: - """ - Delete a flow + """Delete a flow by its ID. + + Returns 404 if no flow matches. Args: extra_headers: Send extra headers @@ -647,8 +672,11 @@ async def clone( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FlowCloneResponse: - """ - Clone a flow + """Create a copy of an existing flow, including its actions and settings. + + The + optional body can override the new flow's `name` and target `deviceIds`. Returns + 404 if the source flow does not exist. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/resources/workflows/triggers.py b/src/mobilerun_sdk/resources/workflows/triggers.py index b6a1b4c..ea8794e 100644 --- a/src/mobilerun_sdk/resources/workflows/triggers.py +++ b/src/mobilerun_sdk/resources/workflows/triggers.py @@ -68,7 +68,10 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerCreateResponse: """ - Create a trigger + Create a trigger with an activation type of `event`, `schedule`, or `custom`. + Each type requires its own fields (e.g. `eventType` and optional `conditions` + for events, `scheduleRule` and `timezone` for schedules, `customPayloadSchema` + for custom triggers); mismatched fields are rejected. Args: custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger @@ -114,7 +117,8 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerRetrieveResponse: """ - Get a trigger + Fetch a single trigger by its ID, including its activation type and + type-specific configuration. Returns 404 if no trigger matches. Args: extra_headers: Send extra headers @@ -141,7 +145,7 @@ def update( *, activation: Literal["event", "schedule", "custom"] | Omit = omit, conditions: trigger_update_params.Conditions | Omit = omit, - custom_payload_schema: Optional[Dict[str, object]] | Omit = omit, + custom_payload_schema: Dict[str, object] | Omit = omit, description: str | Omit = omit, event_type: str | Omit = omit, name: str | Omit = omit, @@ -154,12 +158,13 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerUpdateResponse: - """ - Update a trigger + """Partially update a trigger; all fields are optional. - Args: - custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger + When `activation` is + changed, the type-specific field rules are re-validated. Returns 404 if the + trigger does not exist. + Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -208,8 +213,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerListResponse: - """ - List triggers + """Return a paginated list of triggers. + + Supports filtering by `activation` and + `eventType`, free-text `search`, and ordering by name, createdAt, or updatedAt. Args: extra_headers: Send extra headers @@ -254,8 +261,9 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerDeleteResponse: - """ - Delete a trigger + """Delete a trigger by its ID. + + Returns 404 if no trigger matches. Args: extra_headers: Send extra headers @@ -371,7 +379,10 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerCreateResponse: """ - Create a trigger + Create a trigger with an activation type of `event`, `schedule`, or `custom`. + Each type requires its own fields (e.g. `eventType` and optional `conditions` + for events, `scheduleRule` and `timezone` for schedules, `customPayloadSchema` + for custom triggers); mismatched fields are rejected. Args: custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger @@ -417,7 +428,8 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerRetrieveResponse: """ - Get a trigger + Fetch a single trigger by its ID, including its activation type and + type-specific configuration. Returns 404 if no trigger matches. Args: extra_headers: Send extra headers @@ -444,7 +456,7 @@ async def update( *, activation: Literal["event", "schedule", "custom"] | Omit = omit, conditions: trigger_update_params.Conditions | Omit = omit, - custom_payload_schema: Optional[Dict[str, object]] | Omit = omit, + custom_payload_schema: Dict[str, object] | Omit = omit, description: str | Omit = omit, event_type: str | Omit = omit, name: str | Omit = omit, @@ -457,12 +469,13 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerUpdateResponse: - """ - Update a trigger + """Partially update a trigger; all fields are optional. - Args: - custom_payload_schema: Optional JSON Schema for validating payloads sent to this custom trigger + When `activation` is + changed, the type-specific field rules are re-validated. Returns 404 if the + trigger does not exist. + Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -511,8 +524,10 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerListResponse: - """ - List triggers + """Return a paginated list of triggers. + + Supports filtering by `activation` and + `eventType`, free-text `search`, and ordering by name, createdAt, or updatedAt. Args: extra_headers: Send extra headers @@ -557,8 +572,9 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TriggerDeleteResponse: - """ - Delete a trigger + """Delete a trigger by its ID. + + Returns 404 if no trigger matches. Args: extra_headers: Send extra headers diff --git a/src/mobilerun_sdk/types/workflows/action_create_params.py b/src/mobilerun_sdk/types/workflows/action_create_params.py index b85ffed..eafc44e 100644 --- a/src/mobilerun_sdk/types/workflows/action_create_params.py +++ b/src/mobilerun_sdk/types/workflows/action_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo @@ -17,4 +17,4 @@ class ActionCreateParams(TypedDict, total=False): description: str - params: Dict[str, Optional[object]] + params: Dict[str, object] diff --git a/src/mobilerun_sdk/types/workflows/action_update_params.py b/src/mobilerun_sdk/types/workflows/action_update_params.py index 4644bac..f495468 100644 --- a/src/mobilerun_sdk/types/workflows/action_update_params.py +++ b/src/mobilerun_sdk/types/workflows/action_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import TypedDict __all__ = ["ActionUpdateParams"] @@ -13,4 +13,4 @@ class ActionUpdateParams(TypedDict, total=False): name: str - params: Dict[str, Optional[object]] + params: Dict[str, object] diff --git a/src/mobilerun_sdk/types/workflows/event_dry_run_params.py b/src/mobilerun_sdk/types/workflows/event_dry_run_params.py index c55498e..bd92f63 100644 --- a/src/mobilerun_sdk/types/workflows/event_dry_run_params.py +++ b/src/mobilerun_sdk/types/workflows/event_dry_run_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo @@ -15,4 +15,4 @@ class EventDryRunParams(TypedDict, total=False): device_id: Annotated[str, PropertyInfo(alias="deviceId")] - payload: Dict[str, Optional[object]] + payload: Dict[str, object] diff --git a/src/mobilerun_sdk/types/workflows/event_dry_run_response.py b/src/mobilerun_sdk/types/workflows/event_dry_run_response.py index b1c8264..e687124 100644 --- a/src/mobilerun_sdk/types/workflows/event_dry_run_response.py +++ b/src/mobilerun_sdk/types/workflows/event_dry_run_response.py @@ -15,7 +15,6 @@ "DataMatchedFlowAction", "DataMatchedFlowGates", "DataMatchedFlowTrigger", - "DataMatchedFlowTriggerScheduleRule", "DataValidation", "DataValidationError", ] @@ -30,13 +29,13 @@ class DataMatchedFlowAction(BaseModel): service: Literal["tasks_api", "devices_api", "agents_api", "webhooks"] - children: Optional[List[Optional[object]]] = None + children: Optional[List[object]] = None """ Nested child actions (loop/branch bodies), each the same shape as a ResolvedAction. """ - params: Optional[Dict[str, Optional[object]]] = None + params: Optional[Dict[str, object]] = None class DataMatchedFlowGates(BaseModel): @@ -51,19 +50,6 @@ class DataMatchedFlowGates(BaseModel): enabled: bool -class DataMatchedFlowTriggerScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" - - class DataMatchedFlowTrigger(BaseModel): id: str @@ -79,7 +65,7 @@ class DataMatchedFlowTrigger(BaseModel): name: str - schedule_rule: Optional[DataMatchedFlowTriggerScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + schedule_rule: object = FieldInfo(alias="scheduleRule") timezone: Optional[str] = None diff --git a/src/mobilerun_sdk/types/workflows/event_ingest_params.py b/src/mobilerun_sdk/types/workflows/event_ingest_params.py index d8edf19..02f2a31 100644 --- a/src/mobilerun_sdk/types/workflows/event_ingest_params.py +++ b/src/mobilerun_sdk/types/workflows/event_ingest_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo @@ -15,4 +15,4 @@ class EventIngestParams(TypedDict, total=False): device_id: Annotated[str, PropertyInfo(alias="deviceId")] - payload: Dict[str, Optional[object]] + payload: Dict[str, object] diff --git a/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py b/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py index 5f03d3a..6f74d3f 100644 --- a/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py +++ b/src/mobilerun_sdk/types/workflows/flow_action_overrides_param.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import TypedDict __all__ = ["FlowActionOverridesParam"] class FlowActionOverridesParam(TypedDict, total=False): - params: Dict[str, Optional[object]] + params: Dict[str, object] diff --git a/src/mobilerun_sdk/types/workflows/flows/flow_action.py b/src/mobilerun_sdk/types/workflows/flows/flow_action.py index 2ab9154..e273170 100644 --- a/src/mobilerun_sdk/types/workflows/flows/flow_action.py +++ b/src/mobilerun_sdk/types/workflows/flows/flow_action.py @@ -10,7 +10,7 @@ class Overrides(BaseModel): - params: Optional[Dict[str, Optional[object]]] = None + params: Optional[Dict[str, object]] = None class FlowAction(BaseModel): diff --git a/src/mobilerun_sdk/types/workflows/trigger_create_response.py b/src/mobilerun_sdk/types/workflows/trigger_create_response.py index b2073b1..afe6fc2 100644 --- a/src/mobilerun_sdk/types/workflows/trigger_create_response.py +++ b/src/mobilerun_sdk/types/workflows/trigger_create_response.py @@ -30,7 +30,7 @@ class Data(BaseModel): created_at: Optional[str] = FieldInfo(alias="createdAt", default=None) - custom_payload_schema: Optional[Dict[str, Optional[object]]] = FieldInfo(alias="customPayloadSchema", default=None) + custom_payload_schema: Optional[Dict[str, object]] = FieldInfo(alias="customPayloadSchema", default=None) description: Optional[str] = None diff --git a/src/mobilerun_sdk/types/workflows/trigger_list_response.py b/src/mobilerun_sdk/types/workflows/trigger_list_response.py index 703fd4c..b21d12a 100644 --- a/src/mobilerun_sdk/types/workflows/trigger_list_response.py +++ b/src/mobilerun_sdk/types/workflows/trigger_list_response.py @@ -8,20 +8,7 @@ from ..._models import BaseModel from ..shared.pagination import Pagination -__all__ = ["TriggerListResponse", "Item", "ItemScheduleRule"] - - -class ItemScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" +__all__ = ["TriggerListResponse", "Item"] class Item(BaseModel): @@ -39,7 +26,7 @@ class Item(BaseModel): name: str - schedule_rule: Optional[ItemScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + schedule_rule: object = FieldInfo(alias="scheduleRule") timezone: Optional[str] = None diff --git a/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py b/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py index fc48aa4..2296e33 100644 --- a/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py +++ b/src/mobilerun_sdk/types/workflows/trigger_retrieve_response.py @@ -7,20 +7,7 @@ from ..._models import BaseModel -__all__ = ["TriggerRetrieveResponse", "Data", "DataScheduleRule"] - - -class DataScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" +__all__ = ["TriggerRetrieveResponse", "Data"] class Data(BaseModel): @@ -38,7 +25,7 @@ class Data(BaseModel): name: str - schedule_rule: Optional[DataScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + schedule_rule: object = FieldInfo(alias="scheduleRule") timezone: Optional[str] = None diff --git a/src/mobilerun_sdk/types/workflows/trigger_update_params.py b/src/mobilerun_sdk/types/workflows/trigger_update_params.py index ecf86b7..6d8706f 100644 --- a/src/mobilerun_sdk/types/workflows/trigger_update_params.py +++ b/src/mobilerun_sdk/types/workflows/trigger_update_params.py @@ -15,8 +15,7 @@ class TriggerUpdateParams(TypedDict, total=False): conditions: Conditions - custom_payload_schema: Annotated[Optional[Dict[str, object]], PropertyInfo(alias="customPayloadSchema")] - """Optional JSON Schema for validating payloads sent to this custom trigger""" + custom_payload_schema: Annotated[Dict[str, object], PropertyInfo(alias="customPayloadSchema")] description: str diff --git a/src/mobilerun_sdk/types/workflows/trigger_update_response.py b/src/mobilerun_sdk/types/workflows/trigger_update_response.py index a5a9418..af2c3cf 100644 --- a/src/mobilerun_sdk/types/workflows/trigger_update_response.py +++ b/src/mobilerun_sdk/types/workflows/trigger_update_response.py @@ -7,20 +7,7 @@ from ..._models import BaseModel -__all__ = ["TriggerUpdateResponse", "Data", "DataScheduleRule"] - - -class DataScheduleRule(BaseModel): - type: Literal["once", "cron", "recurring"] - - date_time: Optional[str] = FieldInfo(alias="dateTime", default=None) - """ISO 8601 datetime (for type=once)""" - - expression: Optional[str] = None - """Cron expression (for type=cron)""" - - rrule: Optional[str] = None - """RRULE string (for type=recurring)""" +__all__ = ["TriggerUpdateResponse", "Data"] class Data(BaseModel): @@ -38,7 +25,7 @@ class Data(BaseModel): name: str - schedule_rule: Optional[DataScheduleRule] = FieldInfo(alias="scheduleRule", default=None) + schedule_rule: object = FieldInfo(alias="scheduleRule") timezone: Optional[str] = None From 8b875445c5e1220f17702ec1cef0d38d960848d7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 18:14:35 +0000 Subject: [PATCH 08/10] feat(api): api update --- .stats.yml | 6 +- README.md | 34 +- api.md | 247 +-- src/mobilerun_sdk/_client.py | 125 +- src/mobilerun_sdk/_files.py | 2 +- src/mobilerun_sdk/resources/__init__.py | 42 - src/mobilerun_sdk/resources/carriers.py | 900 ---------- .../resources/devices/__init__.py | 201 --- .../resources/devices/actions.py | 630 ------- src/mobilerun_sdk/resources/devices/apps.py | 744 --------- .../resources/devices/devices.py | 1473 ----------------- src/mobilerun_sdk/resources/devices/esim.py | 510 ------ src/mobilerun_sdk/resources/devices/files.py | 520 ------ .../resources/devices/keyboard.py | 412 ----- .../resources/devices/language.py | 303 ---- .../resources/devices/location.py | 291 ---- .../resources/devices/packages.py | 205 --- .../resources/devices/profile.py | 188 --- src/mobilerun_sdk/resources/devices/proxy.py | 413 ----- src/mobilerun_sdk/resources/devices/state.py | 385 ----- src/mobilerun_sdk/resources/devices/tasks.py | 199 --- .../resources/devices/timezone.py | 277 ---- src/mobilerun_sdk/resources/profiles.py | 558 ------- src/mobilerun_sdk/resources/proxies.py | 83 +- src/mobilerun_sdk/types/__init__.py | 51 +- .../types/carrier_create_params.py | 57 - .../types/carrier_create_response.py | 51 - .../types/carrier_delete_response.py | 16 - .../types/carrier_list_params.py | 31 - .../types/carrier_list_response.py | 61 - .../types/carrier_lookup_params.py | 15 - .../types/carrier_lookup_response.py | 51 - .../types/carrier_retrieve_response.py | 51 - .../types/carrier_update_params.py | 51 - .../types/carrier_update_response.py | 51 - src/mobilerun_sdk/types/device.py | 45 - .../types/device_count_response.py | 8 - .../types/device_create_params.py | 61 - .../types/device_fingerprint_response.py | 48 - src/mobilerun_sdk/types/device_list_params.py | 44 - .../types/device_list_response.py | 20 - .../types/device_set_name_params.py | 11 - .../types/device_terminate_params.py | 17 - src/mobilerun_sdk/types/devices/__init__.py | 44 - src/mobilerun_sdk/types/devices/a11_y_node.py | 57 - .../types/devices/action_global_params.py | 15 - .../action_overlay_visible_response.py | 16 - .../action_set_overlay_visible_params.py | 15 - .../types/devices/action_swipe_params.py | 26 - .../types/devices/action_tap_params.py | 19 - .../types/devices/app_install_params.py | 33 - .../types/devices/app_list_params.py | 17 - .../types/devices/app_list_response.py | 25 - .../types/devices/app_start_params.py | 17 - .../types/devices/app_stop_params.py | 18 - .../types/devices/esim_activate_params.py | 26 - .../types/devices/esim_activate_response.py | 28 - .../types/devices/esim_enable_params.py | 15 - .../types/devices/esim_list_response.py | 32 - .../types/devices/esim_remove_params.py | 15 - .../types/devices/file_delete_params.py | 15 - .../types/devices/file_download_params.py | 15 - .../types/devices/file_download_response.py | 7 - src/mobilerun_sdk/types/devices/file_info.py | 51 - .../types/devices/file_list_params.py | 15 - .../types/devices/file_list_response.py | 21 - .../types/devices/file_upload_params.py | 18 - .../types/devices/keyboard_key_params.py | 15 - .../types/devices/keyboard_write_params.py | 25 - .../types/devices/language_get_response.py | 16 - .../types/devices/language_set_params.py | 25 - .../types/devices/location_set_params.py | 17 - .../types/devices/package_list_params.py | 17 - .../types/devices/package_list_response.py | 8 - .../types/devices/profile_update_params.py | 16 - .../types/devices/proxy_connect_params.py | 41 - .../types/devices/proxy_status_response.py | 22 - src/mobilerun_sdk/types/devices/rect.py | 11 - .../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 | 83 - .../types/devices/task_list_params.py | 19 - .../types/devices/task_list_response.py | 28 - .../types/devices/timezone_get_response.py | 16 - .../types/devices/timezone_set_params.py | 15 - src/mobilerun_sdk/types/profile.py | 28 - .../types/profile_create_params.py | 17 - .../types/profile_delete_response.py | 16 - .../types/profile_list_params.py | 21 - .../types/profile_list_response.py | 20 - .../types/profile_update_params.py | 17 - .../types/proxy_lookup_params.py | 24 - .../types/proxy_lookup_response.py | 57 - src/mobilerun_sdk/types/shared/__init__.py | 7 - .../types/shared/device_carrier.py | 21 - .../types/shared/device_identifiers.py | 39 - src/mobilerun_sdk/types/shared/device_spec.py | 48 - src/mobilerun_sdk/types/shared/location.py | 18 - src/mobilerun_sdk/types/shared/meta.py | 21 - .../types/shared/permission_set.py | 13 - src/mobilerun_sdk/types/shared/socks5.py | 15 - .../types/shared_params/__init__.py | 7 - .../types/shared_params/device_carrier.py | 23 - .../types/shared_params/device_identifiers.py | 41 - .../types/shared_params/device_spec.py | 47 - .../types/shared_params/location.py | 13 - .../types/shared_params/socks5.py | 17 - tests/api_resources/devices/__init__.py | 1 - tests/api_resources/devices/test_actions.py | 630 ------- tests/api_resources/devices/test_apps.py | 736 -------- tests/api_resources/devices/test_esim.py | 479 ------ tests/api_resources/devices/test_files.py | 484 ------ tests/api_resources/devices/test_keyboard.py | 356 ---- tests/api_resources/devices/test_language.py | 240 --- tests/api_resources/devices/test_location.py | 248 --- tests/api_resources/devices/test_packages.py | 130 -- tests/api_resources/devices/test_profile.py | 134 -- tests/api_resources/devices/test_proxy.py | 354 ---- tests/api_resources/devices/test_state.py | 336 ---- tests/api_resources/devices/test_tasks.py | 132 -- tests/api_resources/devices/test_timezone.py | 238 --- tests/api_resources/test_carriers.py | 567 ------- tests/api_resources/test_devices.py | 976 ----------- tests/api_resources/test_profiles.py | 676 -------- tests/api_resources/test_proxies.py | 113 -- 127 files changed, 13 insertions(+), 17813 deletions(-) delete mode 100644 src/mobilerun_sdk/resources/carriers.py delete mode 100644 src/mobilerun_sdk/resources/devices/__init__.py delete mode 100644 src/mobilerun_sdk/resources/devices/actions.py delete mode 100644 src/mobilerun_sdk/resources/devices/apps.py delete mode 100644 src/mobilerun_sdk/resources/devices/devices.py delete mode 100644 src/mobilerun_sdk/resources/devices/esim.py delete mode 100644 src/mobilerun_sdk/resources/devices/files.py delete mode 100644 src/mobilerun_sdk/resources/devices/keyboard.py delete mode 100644 src/mobilerun_sdk/resources/devices/language.py delete mode 100644 src/mobilerun_sdk/resources/devices/location.py delete mode 100644 src/mobilerun_sdk/resources/devices/packages.py delete mode 100644 src/mobilerun_sdk/resources/devices/profile.py delete mode 100644 src/mobilerun_sdk/resources/devices/proxy.py delete mode 100644 src/mobilerun_sdk/resources/devices/state.py delete mode 100644 src/mobilerun_sdk/resources/devices/tasks.py delete mode 100644 src/mobilerun_sdk/resources/devices/timezone.py delete mode 100644 src/mobilerun_sdk/resources/profiles.py delete mode 100644 src/mobilerun_sdk/types/carrier_create_params.py delete mode 100644 src/mobilerun_sdk/types/carrier_create_response.py delete mode 100644 src/mobilerun_sdk/types/carrier_delete_response.py delete mode 100644 src/mobilerun_sdk/types/carrier_list_params.py delete mode 100644 src/mobilerun_sdk/types/carrier_list_response.py delete mode 100644 src/mobilerun_sdk/types/carrier_lookup_params.py delete mode 100644 src/mobilerun_sdk/types/carrier_lookup_response.py delete mode 100644 src/mobilerun_sdk/types/carrier_retrieve_response.py delete mode 100644 src/mobilerun_sdk/types/carrier_update_params.py delete mode 100644 src/mobilerun_sdk/types/carrier_update_response.py delete mode 100644 src/mobilerun_sdk/types/device.py delete mode 100644 src/mobilerun_sdk/types/device_count_response.py delete mode 100644 src/mobilerun_sdk/types/device_create_params.py delete mode 100644 src/mobilerun_sdk/types/device_fingerprint_response.py delete mode 100644 src/mobilerun_sdk/types/device_list_params.py delete mode 100644 src/mobilerun_sdk/types/device_list_response.py delete mode 100644 src/mobilerun_sdk/types/device_set_name_params.py delete mode 100644 src/mobilerun_sdk/types/device_terminate_params.py delete mode 100644 src/mobilerun_sdk/types/devices/a11_y_node.py delete mode 100644 src/mobilerun_sdk/types/devices/action_global_params.py delete mode 100644 src/mobilerun_sdk/types/devices/action_overlay_visible_response.py delete mode 100644 src/mobilerun_sdk/types/devices/action_set_overlay_visible_params.py delete mode 100644 src/mobilerun_sdk/types/devices/action_swipe_params.py delete mode 100644 src/mobilerun_sdk/types/devices/action_tap_params.py delete mode 100644 src/mobilerun_sdk/types/devices/app_install_params.py delete mode 100644 src/mobilerun_sdk/types/devices/app_list_params.py delete mode 100644 src/mobilerun_sdk/types/devices/app_list_response.py delete mode 100644 src/mobilerun_sdk/types/devices/app_start_params.py delete mode 100644 src/mobilerun_sdk/types/devices/app_stop_params.py delete mode 100644 src/mobilerun_sdk/types/devices/esim_activate_params.py delete mode 100644 src/mobilerun_sdk/types/devices/esim_activate_response.py delete mode 100644 src/mobilerun_sdk/types/devices/esim_enable_params.py delete mode 100644 src/mobilerun_sdk/types/devices/esim_list_response.py delete mode 100644 src/mobilerun_sdk/types/devices/esim_remove_params.py delete mode 100644 src/mobilerun_sdk/types/devices/file_delete_params.py delete mode 100644 src/mobilerun_sdk/types/devices/file_download_params.py delete mode 100644 src/mobilerun_sdk/types/devices/file_download_response.py delete mode 100644 src/mobilerun_sdk/types/devices/file_info.py delete mode 100644 src/mobilerun_sdk/types/devices/file_list_params.py delete mode 100644 src/mobilerun_sdk/types/devices/file_list_response.py delete mode 100644 src/mobilerun_sdk/types/devices/file_upload_params.py delete mode 100644 src/mobilerun_sdk/types/devices/keyboard_key_params.py delete mode 100644 src/mobilerun_sdk/types/devices/keyboard_write_params.py delete mode 100644 src/mobilerun_sdk/types/devices/language_get_response.py delete mode 100644 src/mobilerun_sdk/types/devices/language_set_params.py delete mode 100644 src/mobilerun_sdk/types/devices/location_set_params.py delete mode 100644 src/mobilerun_sdk/types/devices/package_list_params.py delete mode 100644 src/mobilerun_sdk/types/devices/package_list_response.py delete mode 100644 src/mobilerun_sdk/types/devices/profile_update_params.py delete mode 100644 src/mobilerun_sdk/types/devices/proxy_connect_params.py delete mode 100644 src/mobilerun_sdk/types/devices/proxy_status_response.py delete mode 100644 src/mobilerun_sdk/types/devices/rect.py delete mode 100644 src/mobilerun_sdk/types/devices/state_screenshot_params.py delete mode 100644 src/mobilerun_sdk/types/devices/state_screenshot_response.py delete mode 100644 src/mobilerun_sdk/types/devices/state_time_response.py delete mode 100644 src/mobilerun_sdk/types/devices/state_ui_params.py delete mode 100644 src/mobilerun_sdk/types/devices/state_ui_response.py delete mode 100644 src/mobilerun_sdk/types/devices/task_list_params.py delete mode 100644 src/mobilerun_sdk/types/devices/task_list_response.py delete mode 100644 src/mobilerun_sdk/types/devices/timezone_get_response.py delete mode 100644 src/mobilerun_sdk/types/devices/timezone_set_params.py delete mode 100644 src/mobilerun_sdk/types/profile.py delete mode 100644 src/mobilerun_sdk/types/profile_create_params.py delete mode 100644 src/mobilerun_sdk/types/profile_delete_response.py delete mode 100644 src/mobilerun_sdk/types/profile_list_params.py delete mode 100644 src/mobilerun_sdk/types/profile_list_response.py delete mode 100644 src/mobilerun_sdk/types/profile_update_params.py delete mode 100644 src/mobilerun_sdk/types/proxy_lookup_params.py delete mode 100644 src/mobilerun_sdk/types/proxy_lookup_response.py delete mode 100644 src/mobilerun_sdk/types/shared/device_carrier.py delete mode 100644 src/mobilerun_sdk/types/shared/device_identifiers.py delete mode 100644 src/mobilerun_sdk/types/shared/device_spec.py delete mode 100644 src/mobilerun_sdk/types/shared/location.py delete mode 100644 src/mobilerun_sdk/types/shared/meta.py delete mode 100644 src/mobilerun_sdk/types/shared/permission_set.py delete mode 100644 src/mobilerun_sdk/types/shared/socks5.py delete mode 100644 src/mobilerun_sdk/types/shared_params/__init__.py delete mode 100644 src/mobilerun_sdk/types/shared_params/device_carrier.py delete mode 100644 src/mobilerun_sdk/types/shared_params/device_identifiers.py delete mode 100644 src/mobilerun_sdk/types/shared_params/device_spec.py delete mode 100644 src/mobilerun_sdk/types/shared_params/location.py delete mode 100644 src/mobilerun_sdk/types/shared_params/socks5.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_esim.py delete mode 100644 tests/api_resources/devices/test_files.py delete mode 100644 tests/api_resources/devices/test_keyboard.py delete mode 100644 tests/api_resources/devices/test_language.py delete mode 100644 tests/api_resources/devices/test_location.py delete mode 100644 tests/api_resources/devices/test_packages.py delete mode 100644 tests/api_resources/devices/test_profile.py delete mode 100644 tests/api_resources/devices/test_proxy.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/devices/test_timezone.py delete mode 100644 tests/api_resources/test_carriers.py delete mode 100644 tests/api_resources/test_devices.py delete mode 100644 tests/api_resources/test_profiles.py diff --git a/.stats.yml b/.stats.yml index 5fb7cdf..2efae16 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 150 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-22153e7538d36d4d095f497846427b58e83d4fd16e104cbe0c315d90eed2a1d4.yml -openapi_spec_hash: 5ee2c119ab7425fb55941fcf7ff1211d +configured_endpoints: 92 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-b9a26a687db7906dc76ce8e009567a1aefd65135a98b7784125f700e4ec76f2b.yml +openapi_spec_hash: c7fc0ba62410db6d5d1b8aeed9ca8b2a config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/README.md b/README.md index 73b8b1d..36403bb 100644 --- a/README.md +++ b/README.md @@ -124,38 +124,14 @@ from mobilerun_sdk import Mobilerun client = Mobilerun() -device = client.devices.create( - carrier={ - "gsm_operator_alpha": "GsmOperatorAlpha", - "gsm_operator_numeric": 0, - "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", - "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", - "gsm_sim_operator_numeric": 0, - "persist_sys_timezone": "PersistSysTimezone", - }, +trigger = client.workflows.triggers.create( + activation="event", + name="x", + conditions={}, ) -print(device.carrier) +print(trigger.conditions) ``` -## File uploads - -Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. - -```python -from pathlib import Path -from mobilerun_sdk import Mobilerun - -client = Mobilerun() - -client.devices.files.upload( - device_id="deviceId", - path="path", - file=Path("/path/to/file"), -) -``` - -The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically. - ## 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_sdk.APIConnectionError` is raised. diff --git a/api.md b/api.md index 1a26682..e3f09f0 100644 --- a/api.md +++ b/api.md @@ -1,17 +1,7 @@ # Shared Types ```python -from mobilerun_sdk.types import ( - DeviceCarrier, - DeviceIdentifiers, - DeviceSpec, - Location, - Meta, - Pagination, - PaginationMeta, - PermissionSet, - Socks5, -) +from mobilerun_sdk.types import Pagination, PaginationMeta ``` # Apps @@ -40,30 +30,6 @@ Methods: - client.apps.list_versions(id) -> AppListVersionsResponse - client.apps.mark_failed(id) -> AppMarkFailedResponse -# Carriers - -Types: - -```python -from mobilerun_sdk.types import ( - CarrierCreateResponse, - CarrierRetrieveResponse, - CarrierUpdateResponse, - CarrierListResponse, - CarrierDeleteResponse, - CarrierLookupResponse, -) -``` - -Methods: - -- client.carriers.create(\*\*params) -> CarrierCreateResponse -- client.carriers.retrieve(carrier_id) -> CarrierRetrieveResponse -- client.carriers.update(carrier_id, \*\*params) -> CarrierUpdateResponse -- client.carriers.list(\*\*params) -> CarrierListResponse -- client.carriers.delete(carrier_id) -> CarrierDeleteResponse -- client.carriers.lookup(\*\*params) -> CarrierLookupResponse - # Credentials Types: @@ -126,199 +92,6 @@ Methods: - client.credentials.packages.credentials.fields.update(field_type, \*, package_name, credential_name, \*\*params) -> FieldUpdateResponse - client.credentials.packages.credentials.fields.delete(field_type, \*, package_name, credential_name) -> FieldDeleteResponse -# Devices - -Types: - -```python -from mobilerun_sdk.types import ( - Device, - DeviceListResponse, - DeviceCountResponse, - DeviceFingerprintResponse, -) -``` - -Methods: - -- client.devices.create(\*\*params) -> Device -- client.devices.retrieve(device_id) -> Device -- client.devices.list(\*\*params) -> DeviceListResponse -- client.devices.count() -> DeviceCountResponse -- client.devices.fingerprint(device_id) -> DeviceFingerprintResponse -- client.devices.reboot(device_id) -> None -- client.devices.reset(device_id) -> None -- client.devices.set_name(device_id, \*\*params) -> Device -- client.devices.terminate(device_id, \*\*params) -> None -- client.devices.wait_ready(device_id) -> Device - -## Actions - -Types: - -```python -from mobilerun_sdk.types.devices import ActionOverlayVisibleResponse -``` - -Methods: - -- client.devices.actions.global\_(device_id, \*\*params) -> None -- client.devices.actions.overlay_visible(device_id) -> ActionOverlayVisibleResponse -- client.devices.actions.set_overlay_visible(device_id, \*\*params) -> None -- client.devices.actions.swipe(device_id, \*\*params) -> None -- client.devices.actions.tap(device_id, \*\*params) -> None - -## Apps - -Types: - -```python -from mobilerun_sdk.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 -- client.devices.apps.stop(package_name, \*, device_id, \*\*params) -> None - -## Esim - -Types: - -```python -from mobilerun_sdk.types.devices import EsimListResponse, EsimActivateResponse -``` - -Methods: - -- client.devices.esim.list(device_id) -> Optional[EsimListResponse] -- client.devices.esim.activate(device_id, \*\*params) -> EsimActivateResponse -- client.devices.esim.enable(device_id, \*\*params) -> None -- client.devices.esim.remove(device_id, \*\*params) -> None - -## Files - -Types: - -```python -from mobilerun_sdk.types.devices import FileInfo, FileListResponse, FileDownloadResponse -``` - -Methods: - -- client.devices.files.list(device_id, \*\*params) -> FileListResponse -- client.devices.files.delete(device_id, \*\*params) -> None -- client.devices.files.download(device_id, \*\*params) -> str -- client.devices.files.upload(device_id, \*\*params) -> None - -## 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 - -## Location - -Methods: - -- client.devices.location.get(device_id) -> Location -- client.devices.location.set(device_id, \*\*params) -> None - -## Packages - -Types: - -```python -from mobilerun_sdk.types.devices import PackageListResponse -``` - -Methods: - -- client.devices.packages.list(device_id, \*\*params) -> Optional[PackageListResponse] - -## Profile - -Methods: - -- client.devices.profile.update(device_id, \*\*params) -> None - -## Proxy - -Types: - -```python -from mobilerun_sdk.types.devices import ProxyStatusResponse -``` - -Methods: - -- client.devices.proxy.connect(device_id, \*\*params) -> None -- client.devices.proxy.disconnect(device_id) -> None -- client.devices.proxy.status(device_id) -> ProxyStatusResponse - -## State - -Types: - -```python -from mobilerun_sdk.types.devices import ( - A11YNode, - Rect, - 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 - -## Tasks - -Types: - -```python -from mobilerun_sdk.types.devices import TaskListResponse -``` - -Methods: - -- client.devices.tasks.list(device_id, \*\*params) -> TaskListResponse - -## Timezone - -Types: - -```python -from mobilerun_sdk.types.devices import TimezoneGetResponse -``` - -Methods: - -- client.devices.timezone.get(device_id) -> TimezoneGetResponse -- client.devices.timezone.set(device_id, \*\*params) -> None - -## Language - -Types: - -```python -from mobilerun_sdk.types.devices import LanguageGetResponse -``` - -Methods: - -- client.devices.language.get(device_id) -> LanguageGetResponse -- client.devices.language.set(device_id, \*\*params) -> None - # Models Types: @@ -331,22 +104,6 @@ Methods: - client.models.list() -> ModelListResponse -# Profiles - -Types: - -```python -from mobilerun_sdk.types import Profile, ProfileListResponse, ProfileDeleteResponse -``` - -Methods: - -- client.profiles.create(\*\*params) -> Profile -- client.profiles.retrieve(profile_id) -> Profile -- client.profiles.update(profile_id, \*\*params) -> Profile -- client.profiles.list(\*\*params) -> ProfileListResponse -- client.profiles.delete(profile_id) -> ProfileDeleteResponse - # Proxies Types: @@ -359,7 +116,6 @@ from mobilerun_sdk.types import ( ProxyUpdateResponse, ProxyListResponse, ProxyDeleteResponse, - ProxyLookupResponse, ) ``` @@ -370,7 +126,6 @@ Methods: - client.proxies.update(proxy_id, \*\*params) -> ProxyUpdateResponse - client.proxies.list(\*\*params) -> ProxyListResponse - client.proxies.delete(proxy_id) -> ProxyDeleteResponse -- client.proxies.lookup(\*\*params) -> ProxyLookupResponse # Connect diff --git a/src/mobilerun_sdk/_client.py b/src/mobilerun_sdk/_client.py index 2ac5304..281499a 100644 --- a/src/mobilerun_sdk/_client.py +++ b/src/mobilerun_sdk/_client.py @@ -36,27 +36,12 @@ ) if TYPE_CHECKING: - from .resources import ( - apps, - tasks, - models, - connect, - devices, - proxies, - carriers, - profiles, - webhooks, - workflows, - credentials, - ) + from .resources import apps, tasks, models, connect, proxies, webhooks, workflows, credentials from .resources.apps import AppsResource, AsyncAppsResource from .resources.models import ModelsResource, AsyncModelsResource from .resources.proxies import ProxiesResource, AsyncProxiesResource - from .resources.carriers import CarriersResource, AsyncCarriersResource - from .resources.profiles import ProfilesResource, AsyncProfilesResource from .resources.tasks.tasks import TasksResource, AsyncTasksResource from .resources.connect.connect import ConnectResource, AsyncConnectResource - from .resources.devices.devices import DevicesResource, AsyncDevicesResource from .resources.webhooks.webhooks import WebhooksResource, AsyncWebhooksResource from .resources.workflows.workflows import WorkflowsResource, AsyncWorkflowsResource from .resources.credentials.credentials import CredentialsResource, AsyncCredentialsResource @@ -139,24 +124,12 @@ def apps(self) -> AppsResource: return AppsResource(self) - @cached_property - def carriers(self) -> CarriersResource: - from .resources.carriers import CarriersResource - - return CarriersResource(self) - @cached_property def credentials(self) -> CredentialsResource: from .resources.credentials import CredentialsResource return CredentialsResource(self) - @cached_property - def devices(self) -> DevicesResource: - from .resources.devices import DevicesResource - - return DevicesResource(self) - @cached_property def models(self) -> ModelsResource: """LLM Models""" @@ -164,12 +137,6 @@ def models(self) -> ModelsResource: return ModelsResource(self) - @cached_property - def profiles(self) -> ProfilesResource: - from .resources.profiles import ProfilesResource - - return ProfilesResource(self) - @cached_property def proxies(self) -> ProxiesResource: from .resources.proxies import ProxiesResource @@ -391,24 +358,12 @@ def apps(self) -> AsyncAppsResource: return AsyncAppsResource(self) - @cached_property - def carriers(self) -> AsyncCarriersResource: - from .resources.carriers import AsyncCarriersResource - - return AsyncCarriersResource(self) - @cached_property def credentials(self) -> AsyncCredentialsResource: from .resources.credentials import AsyncCredentialsResource return AsyncCredentialsResource(self) - @cached_property - def devices(self) -> AsyncDevicesResource: - from .resources.devices import AsyncDevicesResource - - return AsyncDevicesResource(self) - @cached_property def models(self) -> AsyncModelsResource: """LLM Models""" @@ -416,12 +371,6 @@ def models(self) -> AsyncModelsResource: return AsyncModelsResource(self) - @cached_property - def profiles(self) -> AsyncProfilesResource: - from .resources.profiles import AsyncProfilesResource - - return AsyncProfilesResource(self) - @cached_property def proxies(self) -> AsyncProxiesResource: from .resources.proxies import AsyncProxiesResource @@ -589,24 +538,12 @@ def apps(self) -> apps.AppsResourceWithRawResponse: return AppsResourceWithRawResponse(self._client.apps) - @cached_property - def carriers(self) -> carriers.CarriersResourceWithRawResponse: - from .resources.carriers import CarriersResourceWithRawResponse - - return CarriersResourceWithRawResponse(self._client.carriers) - @cached_property def credentials(self) -> credentials.CredentialsResourceWithRawResponse: from .resources.credentials import CredentialsResourceWithRawResponse return CredentialsResourceWithRawResponse(self._client.credentials) - @cached_property - def devices(self) -> devices.DevicesResourceWithRawResponse: - from .resources.devices import DevicesResourceWithRawResponse - - return DevicesResourceWithRawResponse(self._client.devices) - @cached_property def models(self) -> models.ModelsResourceWithRawResponse: """LLM Models""" @@ -614,12 +551,6 @@ def models(self) -> models.ModelsResourceWithRawResponse: return ModelsResourceWithRawResponse(self._client.models) - @cached_property - def profiles(self) -> profiles.ProfilesResourceWithRawResponse: - from .resources.profiles import ProfilesResourceWithRawResponse - - return ProfilesResourceWithRawResponse(self._client.profiles) - @cached_property def proxies(self) -> proxies.ProxiesResourceWithRawResponse: from .resources.proxies import ProxiesResourceWithRawResponse @@ -664,24 +595,12 @@ def apps(self) -> apps.AsyncAppsResourceWithRawResponse: return AsyncAppsResourceWithRawResponse(self._client.apps) - @cached_property - def carriers(self) -> carriers.AsyncCarriersResourceWithRawResponse: - from .resources.carriers import AsyncCarriersResourceWithRawResponse - - return AsyncCarriersResourceWithRawResponse(self._client.carriers) - @cached_property def credentials(self) -> credentials.AsyncCredentialsResourceWithRawResponse: from .resources.credentials import AsyncCredentialsResourceWithRawResponse return AsyncCredentialsResourceWithRawResponse(self._client.credentials) - @cached_property - def devices(self) -> devices.AsyncDevicesResourceWithRawResponse: - from .resources.devices import AsyncDevicesResourceWithRawResponse - - return AsyncDevicesResourceWithRawResponse(self._client.devices) - @cached_property def models(self) -> models.AsyncModelsResourceWithRawResponse: """LLM Models""" @@ -689,12 +608,6 @@ def models(self) -> models.AsyncModelsResourceWithRawResponse: return AsyncModelsResourceWithRawResponse(self._client.models) - @cached_property - def profiles(self) -> profiles.AsyncProfilesResourceWithRawResponse: - from .resources.profiles import AsyncProfilesResourceWithRawResponse - - return AsyncProfilesResourceWithRawResponse(self._client.profiles) - @cached_property def proxies(self) -> proxies.AsyncProxiesResourceWithRawResponse: from .resources.proxies import AsyncProxiesResourceWithRawResponse @@ -739,24 +652,12 @@ def apps(self) -> apps.AppsResourceWithStreamingResponse: return AppsResourceWithStreamingResponse(self._client.apps) - @cached_property - def carriers(self) -> carriers.CarriersResourceWithStreamingResponse: - from .resources.carriers import CarriersResourceWithStreamingResponse - - return CarriersResourceWithStreamingResponse(self._client.carriers) - @cached_property def credentials(self) -> credentials.CredentialsResourceWithStreamingResponse: from .resources.credentials import CredentialsResourceWithStreamingResponse return CredentialsResourceWithStreamingResponse(self._client.credentials) - @cached_property - def devices(self) -> devices.DevicesResourceWithStreamingResponse: - from .resources.devices import DevicesResourceWithStreamingResponse - - return DevicesResourceWithStreamingResponse(self._client.devices) - @cached_property def models(self) -> models.ModelsResourceWithStreamingResponse: """LLM Models""" @@ -764,12 +665,6 @@ def models(self) -> models.ModelsResourceWithStreamingResponse: return ModelsResourceWithStreamingResponse(self._client.models) - @cached_property - def profiles(self) -> profiles.ProfilesResourceWithStreamingResponse: - from .resources.profiles import ProfilesResourceWithStreamingResponse - - return ProfilesResourceWithStreamingResponse(self._client.profiles) - @cached_property def proxies(self) -> proxies.ProxiesResourceWithStreamingResponse: from .resources.proxies import ProxiesResourceWithStreamingResponse @@ -814,24 +709,12 @@ def apps(self) -> apps.AsyncAppsResourceWithStreamingResponse: return AsyncAppsResourceWithStreamingResponse(self._client.apps) - @cached_property - def carriers(self) -> carriers.AsyncCarriersResourceWithStreamingResponse: - from .resources.carriers import AsyncCarriersResourceWithStreamingResponse - - return AsyncCarriersResourceWithStreamingResponse(self._client.carriers) - @cached_property def credentials(self) -> credentials.AsyncCredentialsResourceWithStreamingResponse: from .resources.credentials import AsyncCredentialsResourceWithStreamingResponse return AsyncCredentialsResourceWithStreamingResponse(self._client.credentials) - @cached_property - def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse: - from .resources.devices import AsyncDevicesResourceWithStreamingResponse - - return AsyncDevicesResourceWithStreamingResponse(self._client.devices) - @cached_property def models(self) -> models.AsyncModelsResourceWithStreamingResponse: """LLM Models""" @@ -839,12 +722,6 @@ def models(self) -> models.AsyncModelsResourceWithStreamingResponse: return AsyncModelsResourceWithStreamingResponse(self._client.models) - @cached_property - def profiles(self) -> profiles.AsyncProfilesResourceWithStreamingResponse: - from .resources.profiles import AsyncProfilesResourceWithStreamingResponse - - return AsyncProfilesResourceWithStreamingResponse(self._client.profiles) - @cached_property def proxies(self) -> proxies.AsyncProxiesResourceWithStreamingResponse: from .resources.proxies import AsyncProxiesResourceWithStreamingResponse diff --git a/src/mobilerun_sdk/_files.py b/src/mobilerun_sdk/_files.py index 22855ba..76da9e0 100644 --- a/src/mobilerun_sdk/_files.py +++ b/src/mobilerun_sdk/_files.py @@ -36,7 +36,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: if not is_file_content(obj): prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" raise RuntimeError( - f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/droidrun/mobilerun-sdk-python/tree/main#file-uploads" + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead." ) from None diff --git a/src/mobilerun_sdk/resources/__init__.py b/src/mobilerun_sdk/resources/__init__.py index be9be40..bf17686 100644 --- a/src/mobilerun_sdk/resources/__init__.py +++ b/src/mobilerun_sdk/resources/__init__.py @@ -32,14 +32,6 @@ ConnectResourceWithStreamingResponse, AsyncConnectResourceWithStreamingResponse, ) -from .devices import ( - DevicesResource, - AsyncDevicesResource, - DevicesResourceWithRawResponse, - AsyncDevicesResourceWithRawResponse, - DevicesResourceWithStreamingResponse, - AsyncDevicesResourceWithStreamingResponse, -) from .proxies import ( ProxiesResource, AsyncProxiesResource, @@ -48,22 +40,6 @@ ProxiesResourceWithStreamingResponse, AsyncProxiesResourceWithStreamingResponse, ) -from .carriers import ( - CarriersResource, - AsyncCarriersResource, - CarriersResourceWithRawResponse, - AsyncCarriersResourceWithRawResponse, - CarriersResourceWithStreamingResponse, - AsyncCarriersResourceWithStreamingResponse, -) -from .profiles import ( - ProfilesResource, - AsyncProfilesResource, - ProfilesResourceWithRawResponse, - AsyncProfilesResourceWithRawResponse, - ProfilesResourceWithStreamingResponse, - AsyncProfilesResourceWithStreamingResponse, -) from .webhooks import ( WebhooksResource, AsyncWebhooksResource, @@ -96,36 +72,18 @@ "AsyncAppsResourceWithRawResponse", "AppsResourceWithStreamingResponse", "AsyncAppsResourceWithStreamingResponse", - "CarriersResource", - "AsyncCarriersResource", - "CarriersResourceWithRawResponse", - "AsyncCarriersResourceWithRawResponse", - "CarriersResourceWithStreamingResponse", - "AsyncCarriersResourceWithStreamingResponse", "CredentialsResource", "AsyncCredentialsResource", "CredentialsResourceWithRawResponse", "AsyncCredentialsResourceWithRawResponse", "CredentialsResourceWithStreamingResponse", "AsyncCredentialsResourceWithStreamingResponse", - "DevicesResource", - "AsyncDevicesResource", - "DevicesResourceWithRawResponse", - "AsyncDevicesResourceWithRawResponse", - "DevicesResourceWithStreamingResponse", - "AsyncDevicesResourceWithStreamingResponse", "ModelsResource", "AsyncModelsResource", "ModelsResourceWithRawResponse", "AsyncModelsResourceWithRawResponse", "ModelsResourceWithStreamingResponse", "AsyncModelsResourceWithStreamingResponse", - "ProfilesResource", - "AsyncProfilesResource", - "ProfilesResourceWithRawResponse", - "AsyncProfilesResourceWithRawResponse", - "ProfilesResourceWithStreamingResponse", - "AsyncProfilesResourceWithStreamingResponse", "ProxiesResource", "AsyncProxiesResource", "ProxiesResourceWithRawResponse", diff --git a/src/mobilerun_sdk/resources/carriers.py b/src/mobilerun_sdk/resources/carriers.py deleted file mode 100644 index a674b8f..0000000 --- a/src/mobilerun_sdk/resources/carriers.py +++ /dev/null @@ -1,900 +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 carrier_list_params, carrier_create_params, carrier_lookup_params, carrier_update_params -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import path_template, 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.carrier_list_response import CarrierListResponse -from ..types.carrier_create_response import CarrierCreateResponse -from ..types.carrier_delete_response import CarrierDeleteResponse -from ..types.carrier_lookup_response import CarrierLookupResponse -from ..types.carrier_update_response import CarrierUpdateResponse -from ..types.carrier_retrieve_response import CarrierRetrieveResponse - -__all__ = ["CarriersResource", "AsyncCarriersResource"] - - -class CarriersResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CarriersResourceWithRawResponse: - """ - 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 CarriersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CarriersResourceWithStreamingResponse: - """ - 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 CarriersResourceWithStreamingResponse(self) - - def create( - self, - *, - country: str, - mcc: str, - mnc: str, - operator: str, - company: str | Omit = omit, - country_code: str | Omit = omit, - country_iso: str | Omit = omit, - detail_url: str | Omit = omit, - gsm_bands: str | Omit = omit, - lte_bands: str | Omit = omit, - mobile_prefix: str | Omit = omit, - nsn_size: str | Omit = omit, - number_format: str | Omit = omit, - protocols: str | Omit = omit, - umts_bands: str | Omit = omit, - website: str | 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, - ) -> CarrierCreateResponse: - """ - Create a new carrier - - Args: - country: Country name - - mcc: Mobile Country Code - - mnc: Mobile Network Code - - operator: Operator name - - company: Company name - - country_code: Country dialing code (e.g., +1) - - country_iso: ISO country code - - detail_url: URL to carrier details page - - gsm_bands: Supported GSM bands - - lte_bands: Supported LTE bands - - mobile_prefix: Mobile number prefix - - nsn_size: National Significant Number size - - number_format: Phone number format - - protocols: Supported protocols (comma-separated) - - umts_bands: Supported UMTS bands - - website: Company website - - 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( - "/carriers", - body=maybe_transform( - { - "country": country, - "mcc": mcc, - "mnc": mnc, - "operator": operator, - "company": company, - "country_code": country_code, - "country_iso": country_iso, - "detail_url": detail_url, - "gsm_bands": gsm_bands, - "lte_bands": lte_bands, - "mobile_prefix": mobile_prefix, - "nsn_size": nsn_size, - "number_format": number_format, - "protocols": protocols, - "umts_bands": umts_bands, - "website": website, - }, - carrier_create_params.CarrierCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierCreateResponse, - ) - - def retrieve( - self, - carrier_id: int, - *, - # 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, - ) -> CarrierRetrieveResponse: - """ - Get carrier by ID - - Args: - carrier_id: Carrier ID - - 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( - path_template("/carriers/{carrier_id}", carrier_id=carrier_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierRetrieveResponse, - ) - - def update( - self, - carrier_id: int, - *, - company: str | Omit = omit, - country: str | Omit = omit, - country_code: str | Omit = omit, - country_iso: str | Omit = omit, - detail_url: str | Omit = omit, - gsm_bands: str | Omit = omit, - lte_bands: str | Omit = omit, - mobile_prefix: str | Omit = omit, - nsn_size: str | Omit = omit, - number_format: str | Omit = omit, - operator: str | Omit = omit, - protocols: str | Omit = omit, - umts_bands: str | Omit = omit, - website: str | 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, - ) -> CarrierUpdateResponse: - """ - Update a carrier - - Args: - carrier_id: Carrier ID - - company: Company name - - country: Country name - - country_code: Country dialing code - - country_iso: ISO country code - - detail_url: URL to carrier details - - gsm_bands: Supported GSM bands - - lte_bands: Supported LTE bands - - mobile_prefix: Mobile number prefix - - nsn_size: NSN size - - number_format: Phone number format - - operator: Operator name - - protocols: Supported protocols - - umts_bands: Supported UMTS bands - - website: Company website - - 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._patch( - path_template("/carriers/{carrier_id}", carrier_id=carrier_id), - body=maybe_transform( - { - "company": company, - "country": country, - "country_code": country_code, - "country_iso": country_iso, - "detail_url": detail_url, - "gsm_bands": gsm_bands, - "lte_bands": lte_bands, - "mobile_prefix": mobile_prefix, - "nsn_size": nsn_size, - "number_format": number_format, - "operator": operator, - "protocols": protocols, - "umts_bands": umts_bands, - "website": website, - }, - carrier_update_params.CarrierUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierUpdateResponse, - ) - - def list( - self, - *, - country: str | Omit = omit, - country_iso: str | Omit = omit, - order_by: Literal["id", "mcc", "mnc", "operator", "country", "country_iso"] | Omit = omit, - order_dir: 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, - ) -> CarrierListResponse: - """ - List carriers with pagination - - Args: - country: Filter by country name - - country_iso: Filter by country ISO code - - order_by: Field to order by - - order_dir: Order direction - - page: Page number - - page_size: Items per page - - 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( - "/carriers", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "country": country, - "country_iso": country_iso, - "order_by": order_by, - "order_dir": order_dir, - "page": page, - "page_size": page_size, - }, - carrier_list_params.CarrierListParams, - ), - ), - cast_to=CarrierListResponse, - ) - - def delete( - self, - carrier_id: int, - *, - # 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, - ) -> CarrierDeleteResponse: - """ - Delete a carrier - - Args: - carrier_id: Carrier ID - - 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._delete( - path_template("/carriers/{carrier_id}", carrier_id=carrier_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierDeleteResponse, - ) - - def lookup( - self, - *, - mcc: str, - mnc: 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, - ) -> CarrierLookupResponse: - """ - Get carrier by MCC and MNC - - Args: - mcc: Mobile Country Code - - mnc: Mobile Network Code - - 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( - "/carriers/lookup", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "mcc": mcc, - "mnc": mnc, - }, - carrier_lookup_params.CarrierLookupParams, - ), - ), - cast_to=CarrierLookupResponse, - ) - - -class AsyncCarriersResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCarriersResourceWithRawResponse: - """ - 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 AsyncCarriersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCarriersResourceWithStreamingResponse: - """ - 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 AsyncCarriersResourceWithStreamingResponse(self) - - async def create( - self, - *, - country: str, - mcc: str, - mnc: str, - operator: str, - company: str | Omit = omit, - country_code: str | Omit = omit, - country_iso: str | Omit = omit, - detail_url: str | Omit = omit, - gsm_bands: str | Omit = omit, - lte_bands: str | Omit = omit, - mobile_prefix: str | Omit = omit, - nsn_size: str | Omit = omit, - number_format: str | Omit = omit, - protocols: str | Omit = omit, - umts_bands: str | Omit = omit, - website: str | 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, - ) -> CarrierCreateResponse: - """ - Create a new carrier - - Args: - country: Country name - - mcc: Mobile Country Code - - mnc: Mobile Network Code - - operator: Operator name - - company: Company name - - country_code: Country dialing code (e.g., +1) - - country_iso: ISO country code - - detail_url: URL to carrier details page - - gsm_bands: Supported GSM bands - - lte_bands: Supported LTE bands - - mobile_prefix: Mobile number prefix - - nsn_size: National Significant Number size - - number_format: Phone number format - - protocols: Supported protocols (comma-separated) - - umts_bands: Supported UMTS bands - - website: Company website - - 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( - "/carriers", - body=await async_maybe_transform( - { - "country": country, - "mcc": mcc, - "mnc": mnc, - "operator": operator, - "company": company, - "country_code": country_code, - "country_iso": country_iso, - "detail_url": detail_url, - "gsm_bands": gsm_bands, - "lte_bands": lte_bands, - "mobile_prefix": mobile_prefix, - "nsn_size": nsn_size, - "number_format": number_format, - "protocols": protocols, - "umts_bands": umts_bands, - "website": website, - }, - carrier_create_params.CarrierCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierCreateResponse, - ) - - async def retrieve( - self, - carrier_id: int, - *, - # 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, - ) -> CarrierRetrieveResponse: - """ - Get carrier by ID - - Args: - carrier_id: Carrier ID - - 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( - path_template("/carriers/{carrier_id}", carrier_id=carrier_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierRetrieveResponse, - ) - - async def update( - self, - carrier_id: int, - *, - company: str | Omit = omit, - country: str | Omit = omit, - country_code: str | Omit = omit, - country_iso: str | Omit = omit, - detail_url: str | Omit = omit, - gsm_bands: str | Omit = omit, - lte_bands: str | Omit = omit, - mobile_prefix: str | Omit = omit, - nsn_size: str | Omit = omit, - number_format: str | Omit = omit, - operator: str | Omit = omit, - protocols: str | Omit = omit, - umts_bands: str | Omit = omit, - website: str | 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, - ) -> CarrierUpdateResponse: - """ - Update a carrier - - Args: - carrier_id: Carrier ID - - company: Company name - - country: Country name - - country_code: Country dialing code - - country_iso: ISO country code - - detail_url: URL to carrier details - - gsm_bands: Supported GSM bands - - lte_bands: Supported LTE bands - - mobile_prefix: Mobile number prefix - - nsn_size: NSN size - - number_format: Phone number format - - operator: Operator name - - protocols: Supported protocols - - umts_bands: Supported UMTS bands - - website: Company website - - 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._patch( - path_template("/carriers/{carrier_id}", carrier_id=carrier_id), - body=await async_maybe_transform( - { - "company": company, - "country": country, - "country_code": country_code, - "country_iso": country_iso, - "detail_url": detail_url, - "gsm_bands": gsm_bands, - "lte_bands": lte_bands, - "mobile_prefix": mobile_prefix, - "nsn_size": nsn_size, - "number_format": number_format, - "operator": operator, - "protocols": protocols, - "umts_bands": umts_bands, - "website": website, - }, - carrier_update_params.CarrierUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierUpdateResponse, - ) - - async def list( - self, - *, - country: str | Omit = omit, - country_iso: str | Omit = omit, - order_by: Literal["id", "mcc", "mnc", "operator", "country", "country_iso"] | Omit = omit, - order_dir: 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, - ) -> CarrierListResponse: - """ - List carriers with pagination - - Args: - country: Filter by country name - - country_iso: Filter by country ISO code - - order_by: Field to order by - - order_dir: Order direction - - page: Page number - - page_size: Items per page - - 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( - "/carriers", - 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, - "country_iso": country_iso, - "order_by": order_by, - "order_dir": order_dir, - "page": page, - "page_size": page_size, - }, - carrier_list_params.CarrierListParams, - ), - ), - cast_to=CarrierListResponse, - ) - - async def delete( - self, - carrier_id: int, - *, - # 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, - ) -> CarrierDeleteResponse: - """ - Delete a carrier - - Args: - carrier_id: Carrier ID - - 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._delete( - path_template("/carriers/{carrier_id}", carrier_id=carrier_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CarrierDeleteResponse, - ) - - async def lookup( - self, - *, - mcc: str, - mnc: 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, - ) -> CarrierLookupResponse: - """ - Get carrier by MCC and MNC - - Args: - mcc: Mobile Country Code - - mnc: Mobile Network Code - - 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( - "/carriers/lookup", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "mcc": mcc, - "mnc": mnc, - }, - carrier_lookup_params.CarrierLookupParams, - ), - ), - cast_to=CarrierLookupResponse, - ) - - -class CarriersResourceWithRawResponse: - def __init__(self, carriers: CarriersResource) -> None: - self._carriers = carriers - - self.create = to_raw_response_wrapper( - carriers.create, - ) - self.retrieve = to_raw_response_wrapper( - carriers.retrieve, - ) - self.update = to_raw_response_wrapper( - carriers.update, - ) - self.list = to_raw_response_wrapper( - carriers.list, - ) - self.delete = to_raw_response_wrapper( - carriers.delete, - ) - self.lookup = to_raw_response_wrapper( - carriers.lookup, - ) - - -class AsyncCarriersResourceWithRawResponse: - def __init__(self, carriers: AsyncCarriersResource) -> None: - self._carriers = carriers - - self.create = async_to_raw_response_wrapper( - carriers.create, - ) - self.retrieve = async_to_raw_response_wrapper( - carriers.retrieve, - ) - self.update = async_to_raw_response_wrapper( - carriers.update, - ) - self.list = async_to_raw_response_wrapper( - carriers.list, - ) - self.delete = async_to_raw_response_wrapper( - carriers.delete, - ) - self.lookup = async_to_raw_response_wrapper( - carriers.lookup, - ) - - -class CarriersResourceWithStreamingResponse: - def __init__(self, carriers: CarriersResource) -> None: - self._carriers = carriers - - self.create = to_streamed_response_wrapper( - carriers.create, - ) - self.retrieve = to_streamed_response_wrapper( - carriers.retrieve, - ) - self.update = to_streamed_response_wrapper( - carriers.update, - ) - self.list = to_streamed_response_wrapper( - carriers.list, - ) - self.delete = to_streamed_response_wrapper( - carriers.delete, - ) - self.lookup = to_streamed_response_wrapper( - carriers.lookup, - ) - - -class AsyncCarriersResourceWithStreamingResponse: - def __init__(self, carriers: AsyncCarriersResource) -> None: - self._carriers = carriers - - self.create = async_to_streamed_response_wrapper( - carriers.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - carriers.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - carriers.update, - ) - self.list = async_to_streamed_response_wrapper( - carriers.list, - ) - self.delete = async_to_streamed_response_wrapper( - carriers.delete, - ) - self.lookup = async_to_streamed_response_wrapper( - carriers.lookup, - ) diff --git a/src/mobilerun_sdk/resources/devices/__init__.py b/src/mobilerun_sdk/resources/devices/__init__.py deleted file mode 100644 index 77ef45e..0000000 --- a/src/mobilerun_sdk/resources/devices/__init__.py +++ /dev/null @@ -1,201 +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 .esim import ( - EsimResource, - AsyncEsimResource, - EsimResourceWithRawResponse, - AsyncEsimResourceWithRawResponse, - EsimResourceWithStreamingResponse, - AsyncEsimResourceWithStreamingResponse, -) -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from .proxy import ( - ProxyResource, - AsyncProxyResource, - ProxyResourceWithRawResponse, - AsyncProxyResourceWithRawResponse, - ProxyResourceWithStreamingResponse, - AsyncProxyResourceWithStreamingResponse, -) -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 .profile import ( - ProfileResource, - AsyncProfileResource, - ProfileResourceWithRawResponse, - AsyncProfileResourceWithRawResponse, - ProfileResourceWithStreamingResponse, - AsyncProfileResourceWithStreamingResponse, -) -from .keyboard import ( - KeyboardResource, - AsyncKeyboardResource, - KeyboardResourceWithRawResponse, - AsyncKeyboardResourceWithRawResponse, - KeyboardResourceWithStreamingResponse, - AsyncKeyboardResourceWithStreamingResponse, -) -from .language import ( - LanguageResource, - AsyncLanguageResource, - LanguageResourceWithRawResponse, - AsyncLanguageResourceWithRawResponse, - LanguageResourceWithStreamingResponse, - AsyncLanguageResourceWithStreamingResponse, -) -from .location import ( - LocationResource, - AsyncLocationResource, - LocationResourceWithRawResponse, - AsyncLocationResourceWithRawResponse, - LocationResourceWithStreamingResponse, - AsyncLocationResourceWithStreamingResponse, -) -from .packages import ( - PackagesResource, - AsyncPackagesResource, - PackagesResourceWithRawResponse, - AsyncPackagesResourceWithRawResponse, - PackagesResourceWithStreamingResponse, - AsyncPackagesResourceWithStreamingResponse, -) -from .timezone import ( - TimezoneResource, - AsyncTimezoneResource, - TimezoneResourceWithRawResponse, - AsyncTimezoneResourceWithRawResponse, - TimezoneResourceWithStreamingResponse, - AsyncTimezoneResourceWithStreamingResponse, -) - -__all__ = [ - "ActionsResource", - "AsyncActionsResource", - "ActionsResourceWithRawResponse", - "AsyncActionsResourceWithRawResponse", - "ActionsResourceWithStreamingResponse", - "AsyncActionsResourceWithStreamingResponse", - "AppsResource", - "AsyncAppsResource", - "AppsResourceWithRawResponse", - "AsyncAppsResourceWithRawResponse", - "AppsResourceWithStreamingResponse", - "AsyncAppsResourceWithStreamingResponse", - "EsimResource", - "AsyncEsimResource", - "EsimResourceWithRawResponse", - "AsyncEsimResourceWithRawResponse", - "EsimResourceWithStreamingResponse", - "AsyncEsimResourceWithStreamingResponse", - "FilesResource", - "AsyncFilesResource", - "FilesResourceWithRawResponse", - "AsyncFilesResourceWithRawResponse", - "FilesResourceWithStreamingResponse", - "AsyncFilesResourceWithStreamingResponse", - "KeyboardResource", - "AsyncKeyboardResource", - "KeyboardResourceWithRawResponse", - "AsyncKeyboardResourceWithRawResponse", - "KeyboardResourceWithStreamingResponse", - "AsyncKeyboardResourceWithStreamingResponse", - "LocationResource", - "AsyncLocationResource", - "LocationResourceWithRawResponse", - "AsyncLocationResourceWithRawResponse", - "LocationResourceWithStreamingResponse", - "AsyncLocationResourceWithStreamingResponse", - "PackagesResource", - "AsyncPackagesResource", - "PackagesResourceWithRawResponse", - "AsyncPackagesResourceWithRawResponse", - "PackagesResourceWithStreamingResponse", - "AsyncPackagesResourceWithStreamingResponse", - "ProfileResource", - "AsyncProfileResource", - "ProfileResourceWithRawResponse", - "AsyncProfileResourceWithRawResponse", - "ProfileResourceWithStreamingResponse", - "AsyncProfileResourceWithStreamingResponse", - "ProxyResource", - "AsyncProxyResource", - "ProxyResourceWithRawResponse", - "AsyncProxyResourceWithRawResponse", - "ProxyResourceWithStreamingResponse", - "AsyncProxyResourceWithStreamingResponse", - "StateResource", - "AsyncStateResource", - "StateResourceWithRawResponse", - "AsyncStateResourceWithRawResponse", - "StateResourceWithStreamingResponse", - "AsyncStateResourceWithStreamingResponse", - "TasksResource", - "AsyncTasksResource", - "TasksResourceWithRawResponse", - "AsyncTasksResourceWithRawResponse", - "TasksResourceWithStreamingResponse", - "AsyncTasksResourceWithStreamingResponse", - "TimezoneResource", - "AsyncTimezoneResource", - "TimezoneResourceWithRawResponse", - "AsyncTimezoneResourceWithRawResponse", - "TimezoneResourceWithStreamingResponse", - "AsyncTimezoneResourceWithStreamingResponse", - "LanguageResource", - "AsyncLanguageResource", - "LanguageResourceWithRawResponse", - "AsyncLanguageResourceWithRawResponse", - "LanguageResourceWithStreamingResponse", - "AsyncLanguageResourceWithStreamingResponse", - "DevicesResource", - "AsyncDevicesResource", - "DevicesResourceWithRawResponse", - "AsyncDevicesResourceWithRawResponse", - "DevicesResourceWithStreamingResponse", - "AsyncDevicesResourceWithStreamingResponse", -] diff --git a/src/mobilerun_sdk/resources/devices/actions.py b/src/mobilerun_sdk/resources/devices/actions.py deleted file mode 100644 index fa65c7e..0000000 --- a/src/mobilerun_sdk/resources/devices/actions.py +++ /dev/null @@ -1,630 +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, path_template, 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, - action_set_overlay_visible_params, -) -from ...types.devices.action_overlay_visible_response import ActionOverlayVisibleResponse - -__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( - path_template("/devices/{device_id}/global", device_id=device_id), - 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 overlay_visible( - 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, - ) -> ActionOverlayVisibleResponse: - """ - Check if overlay is visible - - 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( - path_template("/devices/{device_id}/overlay", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionOverlayVisibleResponse, - ) - - def set_overlay_visible( - self, - device_id: str, - *, - visible: bool, - 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: - """ - Set overlay visibility - - 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( - path_template("/devices/{device_id}/overlay", device_id=device_id), - body=maybe_transform({"visible": visible}, action_set_overlay_visible_params.ActionSetOverlayVisibleParams), - 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, - stealth: 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, - ) -> 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( - path_template("/devices/{device_id}/swipe", device_id=device_id), - body=maybe_transform( - { - "duration": duration, - "end_x": end_x, - "end_y": end_y, - "start_x": start_x, - "start_y": start_y, - "stealth": stealth, - }, - 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, - stealth: 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, - ) -> 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( - path_template("/devices/{device_id}/tap", device_id=device_id), - body=maybe_transform( - { - "x": x, - "y": y, - "stealth": stealth, - }, - 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( - path_template("/devices/{device_id}/global", device_id=device_id), - 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 overlay_visible( - 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, - ) -> ActionOverlayVisibleResponse: - """ - Check if overlay is visible - - 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( - path_template("/devices/{device_id}/overlay", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ActionOverlayVisibleResponse, - ) - - async def set_overlay_visible( - self, - device_id: str, - *, - visible: bool, - 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: - """ - Set overlay visibility - - 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( - path_template("/devices/{device_id}/overlay", device_id=device_id), - body=await async_maybe_transform( - {"visible": visible}, action_set_overlay_visible_params.ActionSetOverlayVisibleParams - ), - 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, - stealth: 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, - ) -> 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( - path_template("/devices/{device_id}/swipe", device_id=device_id), - body=await async_maybe_transform( - { - "duration": duration, - "end_x": end_x, - "end_y": end_y, - "start_x": start_x, - "start_y": start_y, - "stealth": stealth, - }, - 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, - stealth: 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, - ) -> 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( - path_template("/devices/{device_id}/tap", device_id=device_id), - body=await async_maybe_transform( - { - "x": x, - "y": y, - "stealth": stealth, - }, - 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.overlay_visible = to_raw_response_wrapper( - actions.overlay_visible, - ) - self.set_overlay_visible = to_raw_response_wrapper( - actions.set_overlay_visible, - ) - 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.overlay_visible = async_to_raw_response_wrapper( - actions.overlay_visible, - ) - self.set_overlay_visible = async_to_raw_response_wrapper( - actions.set_overlay_visible, - ) - 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.overlay_visible = to_streamed_response_wrapper( - actions.overlay_visible, - ) - self.set_overlay_visible = to_streamed_response_wrapper( - actions.set_overlay_visible, - ) - 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.overlay_visible = async_to_streamed_response_wrapper( - actions.overlay_visible, - ) - self.set_overlay_visible = async_to_streamed_response_wrapper( - actions.set_overlay_visible, - ) - self.swipe = async_to_streamed_response_wrapper( - actions.swipe, - ) - self.tap = async_to_streamed_response_wrapper( - actions.tap, - ) diff --git a/src/mobilerun_sdk/resources/devices/apps.py b/src/mobilerun_sdk/resources/devices/apps.py deleted file mode 100644 index 8798aeb..0000000 --- a/src/mobilerun_sdk/resources/devices/apps.py +++ /dev/null @@ -1,744 +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 overload - -import httpx - -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import is_given, path_template, required_args, 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_stop_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_protected_apps: bool | Omit = omit, - 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( - path_template("/devices/{device_id}/apps", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_protected_apps": include_protected_apps, - "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( - path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - @overload - def install( - self, - device_id: str, - *, - bundle_id: str, - package_name: 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: - """Install app - - Args: - bundle_id: iOS bundle identifier (e.g. - - com.example.app) - - package_name: Android package name (e.g. com.example.app) - - 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 - """ - ... - - @overload - def install( - self, - device_id: str, - *, - package_name: str, - bundle_id: 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: - """Install app - - Args: - package_name: Android package name (e.g. - - com.example.app) - - bundle_id: iOS bundle identifier (e.g. com.example.app) - - 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 - """ - ... - - @required_args(["bundle_id"], ["package_name"]) - def install( - self, - device_id: str, - *, - bundle_id: str | Omit = omit, - package_name: 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: - 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( - path_template("/devices/{device_id}/apps", device_id=device_id), - body=maybe_transform( - { - "bundle_id": bundle_id, - "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( - path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=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, - ) - - def stop( - self, - package_name: str, - *, - device_id: str, - clear_data: 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, - ) -> None: - """ - Stop app - - Args: - clear_data: If true, clears all app data (pm clear) in addition to stopping the app. - - 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._patch( - path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), - body=maybe_transform({"clear_data": clear_data}, app_stop_params.AppStopParams), - 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_protected_apps: bool | Omit = omit, - 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( - path_template("/devices/{device_id}/apps", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_protected_apps": include_protected_apps, - "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( - path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - @overload - async def install( - self, - device_id: str, - *, - bundle_id: str, - package_name: 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: - """Install app - - Args: - bundle_id: iOS bundle identifier (e.g. - - com.example.app) - - package_name: Android package name (e.g. com.example.app) - - 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 - """ - ... - - @overload - async def install( - self, - device_id: str, - *, - package_name: str, - bundle_id: 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: - """Install app - - Args: - package_name: Android package name (e.g. - - com.example.app) - - bundle_id: iOS bundle identifier (e.g. com.example.app) - - 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 - """ - ... - - @required_args(["bundle_id"], ["package_name"]) - async def install( - self, - device_id: str, - *, - bundle_id: str | Omit = omit, - package_name: 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: - 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( - path_template("/devices/{device_id}/apps", device_id=device_id), - body=await async_maybe_transform( - { - "bundle_id": bundle_id, - "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( - path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=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, - ) - - async def stop( - self, - package_name: str, - *, - device_id: str, - clear_data: 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, - ) -> None: - """ - Stop app - - Args: - clear_data: If true, clears all app data (pm clear) in addition to stopping the app. - - 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._patch( - path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), - body=await async_maybe_transform({"clear_data": clear_data}, app_stop_params.AppStopParams), - 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, - ) - self.stop = to_raw_response_wrapper( - apps.stop, - ) - - -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, - ) - self.stop = async_to_raw_response_wrapper( - apps.stop, - ) - - -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, - ) - self.stop = to_streamed_response_wrapper( - apps.stop, - ) - - -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, - ) - self.stop = async_to_streamed_response_wrapper( - apps.stop, - ) diff --git a/src/mobilerun_sdk/resources/devices/devices.py b/src/mobilerun_sdk/resources/devices/devices.py deleted file mode 100644 index 866f29c..0000000 --- a/src/mobilerun_sdk/resources/devices/devices.py +++ /dev/null @@ -1,1473 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal - -import httpx - -from .apps import ( - AppsResource, - AsyncAppsResource, - AppsResourceWithRawResponse, - AsyncAppsResourceWithRawResponse, - AppsResourceWithStreamingResponse, - AsyncAppsResourceWithStreamingResponse, -) -from .esim import ( - EsimResource, - AsyncEsimResource, - EsimResourceWithRawResponse, - AsyncEsimResourceWithRawResponse, - EsimResourceWithStreamingResponse, - AsyncEsimResourceWithStreamingResponse, -) -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from .proxy import ( - ProxyResource, - AsyncProxyResource, - ProxyResourceWithRawResponse, - AsyncProxyResourceWithRawResponse, - ProxyResourceWithStreamingResponse, - AsyncProxyResourceWithStreamingResponse, -) -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, device_set_name_params, device_terminate_params -from .actions import ( - ActionsResource, - AsyncActionsResource, - ActionsResourceWithRawResponse, - AsyncActionsResourceWithRawResponse, - ActionsResourceWithStreamingResponse, - AsyncActionsResourceWithStreamingResponse, -) -from .profile import ( - ProfileResource, - AsyncProfileResource, - ProfileResourceWithRawResponse, - AsyncProfileResourceWithRawResponse, - ProfileResourceWithStreamingResponse, - AsyncProfileResourceWithStreamingResponse, -) -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given -from ..._utils import is_given, path_template, maybe_transform, strip_not_given, async_maybe_transform -from .keyboard import ( - KeyboardResource, - AsyncKeyboardResource, - KeyboardResourceWithRawResponse, - AsyncKeyboardResourceWithRawResponse, - KeyboardResourceWithStreamingResponse, - AsyncKeyboardResourceWithStreamingResponse, -) -from .language import ( - LanguageResource, - AsyncLanguageResource, - LanguageResourceWithRawResponse, - AsyncLanguageResourceWithRawResponse, - LanguageResourceWithStreamingResponse, - AsyncLanguageResourceWithStreamingResponse, -) -from .location import ( - LocationResource, - AsyncLocationResource, - LocationResourceWithRawResponse, - AsyncLocationResourceWithRawResponse, - LocationResourceWithStreamingResponse, - AsyncLocationResourceWithStreamingResponse, -) -from .packages import ( - PackagesResource, - AsyncPackagesResource, - PackagesResourceWithRawResponse, - AsyncPackagesResourceWithRawResponse, - PackagesResourceWithStreamingResponse, - AsyncPackagesResourceWithStreamingResponse, -) -from .timezone import ( - TimezoneResource, - AsyncTimezoneResource, - TimezoneResourceWithRawResponse, - AsyncTimezoneResourceWithRawResponse, - TimezoneResourceWithStreamingResponse, - AsyncTimezoneResourceWithStreamingResponse, -) -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 -from ...types.shared_params.location import Location -from ...types.device_fingerprint_response import DeviceFingerprintResponse -from ...types.shared_params.device_carrier import DeviceCarrier -from ...types.shared_params.device_identifiers import DeviceIdentifiers - -__all__ = ["DevicesResource", "AsyncDevicesResource"] - - -class DevicesResource(SyncAPIResource): - @cached_property - def actions(self) -> ActionsResource: - return ActionsResource(self._client) - - @cached_property - def apps(self) -> AppsResource: - return AppsResource(self._client) - - @cached_property - def esim(self) -> EsimResource: - return EsimResource(self._client) - - @cached_property - def files(self) -> FilesResource: - return FilesResource(self._client) - - @cached_property - def keyboard(self) -> KeyboardResource: - return KeyboardResource(self._client) - - @cached_property - def location(self) -> LocationResource: - return LocationResource(self._client) - - @cached_property - def packages(self) -> PackagesResource: - return PackagesResource(self._client) - - @cached_property - def profile(self) -> ProfileResource: - return ProfileResource(self._client) - - @cached_property - def proxy(self) -> ProxyResource: - return ProxyResource(self._client) - - @cached_property - def state(self) -> StateResource: - return StateResource(self._client) - - @cached_property - def tasks(self) -> TasksResource: - return TasksResource(self._client) - - @cached_property - def timezone(self) -> TimezoneResource: - return TimezoneResource(self._client) - - @cached_property - def language(self) -> LanguageResource: - return LanguageResource(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, - *, - query_country: str | Omit = omit, - device_type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device"] - | Omit = omit, - profile_id: str | Omit = omit, - android_version: int | Omit = omit, - apps: Optional[SequenceNotStr[str]] | Omit = omit, - carrier: DeviceCarrier | Omit = omit, - body_country: str | Omit = omit, - files: Optional[SequenceNotStr[str]] | Omit = omit, - identifiers: DeviceIdentifiers | Omit = omit, - locale: str | Omit = omit, - location: Location | Omit = omit, - name: str | Omit = omit, - proxy: device_create_params.Proxy | Omit = omit, - timezone: str | 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: - query_country: ISO 3166-1 alpha-2 country code. - - If omitted the system picks the country with - the most availability. - - profile_id: Profile ID to use as device spec - - 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( - { - "android_version": android_version, - "apps": apps, - "carrier": carrier, - "body_country": body_country, - "files": files, - "identifiers": identifiers, - "locale": locale, - "location": location, - "name": name, - "proxy": proxy, - "timezone": timezone, - }, - 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( - { - "query_country": query_country, - "device_type": device_type, - "profile_id": profile_id, - }, - 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( - path_template("/devices/{device_id}", device_id=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_id: str | Omit = omit, - state: Optional[ - List[ - Literal[ - "creating", - "assigned", - "ready", - "rebooting", - "migrating", - "resetting", - "terminated", - "maintenance", - "unknown", - ] - ] - ] - | Omit = omit, - type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_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_id": provider_id, - "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 fingerprint( - 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, - ) -> DeviceFingerprintResponse: - """ - Device fingerprint snapshot - - 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( - path_template("/devices/{device_id}/fingerprint", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DeviceFingerprintResponse, - ) - - def reboot( - 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: - """ - Reboot 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._post( - path_template("/devices/{device_id}/reboot", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def reset( - 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: - """ - Reset a device to a fresh 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 = {"Accept": "*/*", **(extra_headers or {})} - return self._post( - path_template("/devices/{device_id}/reset", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def set_name( - self, - device_id: str, - *, - name: 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: - """ - Update device name - - 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._put( - path_template("/devices/{device_id}/name", device_id=device_id), - body=maybe_transform({"name": name}, device_set_name_params.DeviceSetNameParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Device, - ) - - def terminate( - self, - device_id: str, - *, - previous_device_id: str | Omit = omit, - terminate_at: Union[str, datetime] | 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: - """ - 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( - path_template("/devices/{device_id}", device_id=device_id), - body=maybe_transform( - { - "previous_device_id": previous_device_id, - "terminate_at": terminate_at, - }, - device_terminate_params.DeviceTerminateParams, - ), - 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( - path_template("/devices/{device_id}/wait", device_id=device_id), - 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 apps(self) -> AsyncAppsResource: - return AsyncAppsResource(self._client) - - @cached_property - def esim(self) -> AsyncEsimResource: - return AsyncEsimResource(self._client) - - @cached_property - def files(self) -> AsyncFilesResource: - return AsyncFilesResource(self._client) - - @cached_property - def keyboard(self) -> AsyncKeyboardResource: - return AsyncKeyboardResource(self._client) - - @cached_property - def location(self) -> AsyncLocationResource: - return AsyncLocationResource(self._client) - - @cached_property - def packages(self) -> AsyncPackagesResource: - return AsyncPackagesResource(self._client) - - @cached_property - def profile(self) -> AsyncProfileResource: - return AsyncProfileResource(self._client) - - @cached_property - def proxy(self) -> AsyncProxyResource: - return AsyncProxyResource(self._client) - - @cached_property - def state(self) -> AsyncStateResource: - return AsyncStateResource(self._client) - - @cached_property - def tasks(self) -> AsyncTasksResource: - return AsyncTasksResource(self._client) - - @cached_property - def timezone(self) -> AsyncTimezoneResource: - return AsyncTimezoneResource(self._client) - - @cached_property - def language(self) -> AsyncLanguageResource: - return AsyncLanguageResource(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, - *, - query_country: str | Omit = omit, - device_type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device"] - | Omit = omit, - profile_id: str | Omit = omit, - android_version: int | Omit = omit, - apps: Optional[SequenceNotStr[str]] | Omit = omit, - carrier: DeviceCarrier | Omit = omit, - body_country: str | Omit = omit, - files: Optional[SequenceNotStr[str]] | Omit = omit, - identifiers: DeviceIdentifiers | Omit = omit, - locale: str | Omit = omit, - location: Location | Omit = omit, - name: str | Omit = omit, - proxy: device_create_params.Proxy | Omit = omit, - timezone: str | 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: - query_country: ISO 3166-1 alpha-2 country code. - - If omitted the system picks the country with - the most availability. - - profile_id: Profile ID to use as device spec - - 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( - { - "android_version": android_version, - "apps": apps, - "carrier": carrier, - "body_country": body_country, - "files": files, - "identifiers": identifiers, - "locale": locale, - "location": location, - "name": name, - "proxy": proxy, - "timezone": timezone, - }, - 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( - { - "query_country": query_country, - "device_type": device_type, - "profile_id": profile_id, - }, - 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( - path_template("/devices/{device_id}", device_id=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_id: str | Omit = omit, - state: Optional[ - List[ - Literal[ - "creating", - "assigned", - "ready", - "rebooting", - "migrating", - "resetting", - "terminated", - "maintenance", - "unknown", - ] - ] - ] - | Omit = omit, - type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_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_id": provider_id, - "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 fingerprint( - 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, - ) -> DeviceFingerprintResponse: - """ - Device fingerprint snapshot - - 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( - path_template("/devices/{device_id}/fingerprint", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DeviceFingerprintResponse, - ) - - async def reboot( - 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: - """ - Reboot 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._post( - path_template("/devices/{device_id}/reboot", device_id=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 reset( - 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: - """ - Reset a device to a fresh 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 = {"Accept": "*/*", **(extra_headers or {})} - return await self._post( - path_template("/devices/{device_id}/reset", device_id=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 set_name( - self, - device_id: str, - *, - name: 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: - """ - Update device name - - 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._put( - path_template("/devices/{device_id}/name", device_id=device_id), - body=await async_maybe_transform({"name": name}, device_set_name_params.DeviceSetNameParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Device, - ) - - async def terminate( - self, - device_id: str, - *, - previous_device_id: str | Omit = omit, - terminate_at: Union[str, datetime] | 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: - """ - 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( - path_template("/devices/{device_id}", device_id=device_id), - body=await async_maybe_transform( - { - "previous_device_id": previous_device_id, - "terminate_at": terminate_at, - }, - device_terminate_params.DeviceTerminateParams, - ), - 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( - path_template("/devices/{device_id}/wait", device_id=device_id), - 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.fingerprint = to_raw_response_wrapper( - devices.fingerprint, - ) - self.reboot = to_raw_response_wrapper( - devices.reboot, - ) - self.reset = to_raw_response_wrapper( - devices.reset, - ) - self.set_name = to_raw_response_wrapper( - devices.set_name, - ) - 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 apps(self) -> AppsResourceWithRawResponse: - return AppsResourceWithRawResponse(self._devices.apps) - - @cached_property - def esim(self) -> EsimResourceWithRawResponse: - return EsimResourceWithRawResponse(self._devices.esim) - - @cached_property - def files(self) -> FilesResourceWithRawResponse: - return FilesResourceWithRawResponse(self._devices.files) - - @cached_property - def keyboard(self) -> KeyboardResourceWithRawResponse: - return KeyboardResourceWithRawResponse(self._devices.keyboard) - - @cached_property - def location(self) -> LocationResourceWithRawResponse: - return LocationResourceWithRawResponse(self._devices.location) - - @cached_property - def packages(self) -> PackagesResourceWithRawResponse: - return PackagesResourceWithRawResponse(self._devices.packages) - - @cached_property - def profile(self) -> ProfileResourceWithRawResponse: - return ProfileResourceWithRawResponse(self._devices.profile) - - @cached_property - def proxy(self) -> ProxyResourceWithRawResponse: - return ProxyResourceWithRawResponse(self._devices.proxy) - - @cached_property - def state(self) -> StateResourceWithRawResponse: - return StateResourceWithRawResponse(self._devices.state) - - @cached_property - def tasks(self) -> TasksResourceWithRawResponse: - return TasksResourceWithRawResponse(self._devices.tasks) - - @cached_property - def timezone(self) -> TimezoneResourceWithRawResponse: - return TimezoneResourceWithRawResponse(self._devices.timezone) - - @cached_property - def language(self) -> LanguageResourceWithRawResponse: - return LanguageResourceWithRawResponse(self._devices.language) - - -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.fingerprint = async_to_raw_response_wrapper( - devices.fingerprint, - ) - self.reboot = async_to_raw_response_wrapper( - devices.reboot, - ) - self.reset = async_to_raw_response_wrapper( - devices.reset, - ) - self.set_name = async_to_raw_response_wrapper( - devices.set_name, - ) - 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 apps(self) -> AsyncAppsResourceWithRawResponse: - return AsyncAppsResourceWithRawResponse(self._devices.apps) - - @cached_property - def esim(self) -> AsyncEsimResourceWithRawResponse: - return AsyncEsimResourceWithRawResponse(self._devices.esim) - - @cached_property - def files(self) -> AsyncFilesResourceWithRawResponse: - return AsyncFilesResourceWithRawResponse(self._devices.files) - - @cached_property - def keyboard(self) -> AsyncKeyboardResourceWithRawResponse: - return AsyncKeyboardResourceWithRawResponse(self._devices.keyboard) - - @cached_property - def location(self) -> AsyncLocationResourceWithRawResponse: - return AsyncLocationResourceWithRawResponse(self._devices.location) - - @cached_property - def packages(self) -> AsyncPackagesResourceWithRawResponse: - return AsyncPackagesResourceWithRawResponse(self._devices.packages) - - @cached_property - def profile(self) -> AsyncProfileResourceWithRawResponse: - return AsyncProfileResourceWithRawResponse(self._devices.profile) - - @cached_property - def proxy(self) -> AsyncProxyResourceWithRawResponse: - return AsyncProxyResourceWithRawResponse(self._devices.proxy) - - @cached_property - def state(self) -> AsyncStateResourceWithRawResponse: - return AsyncStateResourceWithRawResponse(self._devices.state) - - @cached_property - def tasks(self) -> AsyncTasksResourceWithRawResponse: - return AsyncTasksResourceWithRawResponse(self._devices.tasks) - - @cached_property - def timezone(self) -> AsyncTimezoneResourceWithRawResponse: - return AsyncTimezoneResourceWithRawResponse(self._devices.timezone) - - @cached_property - def language(self) -> AsyncLanguageResourceWithRawResponse: - return AsyncLanguageResourceWithRawResponse(self._devices.language) - - -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.fingerprint = to_streamed_response_wrapper( - devices.fingerprint, - ) - self.reboot = to_streamed_response_wrapper( - devices.reboot, - ) - self.reset = to_streamed_response_wrapper( - devices.reset, - ) - self.set_name = to_streamed_response_wrapper( - devices.set_name, - ) - 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 apps(self) -> AppsResourceWithStreamingResponse: - return AppsResourceWithStreamingResponse(self._devices.apps) - - @cached_property - def esim(self) -> EsimResourceWithStreamingResponse: - return EsimResourceWithStreamingResponse(self._devices.esim) - - @cached_property - def files(self) -> FilesResourceWithStreamingResponse: - return FilesResourceWithStreamingResponse(self._devices.files) - - @cached_property - def keyboard(self) -> KeyboardResourceWithStreamingResponse: - return KeyboardResourceWithStreamingResponse(self._devices.keyboard) - - @cached_property - def location(self) -> LocationResourceWithStreamingResponse: - return LocationResourceWithStreamingResponse(self._devices.location) - - @cached_property - def packages(self) -> PackagesResourceWithStreamingResponse: - return PackagesResourceWithStreamingResponse(self._devices.packages) - - @cached_property - def profile(self) -> ProfileResourceWithStreamingResponse: - return ProfileResourceWithStreamingResponse(self._devices.profile) - - @cached_property - def proxy(self) -> ProxyResourceWithStreamingResponse: - return ProxyResourceWithStreamingResponse(self._devices.proxy) - - @cached_property - def state(self) -> StateResourceWithStreamingResponse: - return StateResourceWithStreamingResponse(self._devices.state) - - @cached_property - def tasks(self) -> TasksResourceWithStreamingResponse: - return TasksResourceWithStreamingResponse(self._devices.tasks) - - @cached_property - def timezone(self) -> TimezoneResourceWithStreamingResponse: - return TimezoneResourceWithStreamingResponse(self._devices.timezone) - - @cached_property - def language(self) -> LanguageResourceWithStreamingResponse: - return LanguageResourceWithStreamingResponse(self._devices.language) - - -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.fingerprint = async_to_streamed_response_wrapper( - devices.fingerprint, - ) - self.reboot = async_to_streamed_response_wrapper( - devices.reboot, - ) - self.reset = async_to_streamed_response_wrapper( - devices.reset, - ) - self.set_name = async_to_streamed_response_wrapper( - devices.set_name, - ) - 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 apps(self) -> AsyncAppsResourceWithStreamingResponse: - return AsyncAppsResourceWithStreamingResponse(self._devices.apps) - - @cached_property - def esim(self) -> AsyncEsimResourceWithStreamingResponse: - return AsyncEsimResourceWithStreamingResponse(self._devices.esim) - - @cached_property - def files(self) -> AsyncFilesResourceWithStreamingResponse: - return AsyncFilesResourceWithStreamingResponse(self._devices.files) - - @cached_property - def keyboard(self) -> AsyncKeyboardResourceWithStreamingResponse: - return AsyncKeyboardResourceWithStreamingResponse(self._devices.keyboard) - - @cached_property - def location(self) -> AsyncLocationResourceWithStreamingResponse: - return AsyncLocationResourceWithStreamingResponse(self._devices.location) - - @cached_property - def packages(self) -> AsyncPackagesResourceWithStreamingResponse: - return AsyncPackagesResourceWithStreamingResponse(self._devices.packages) - - @cached_property - def profile(self) -> AsyncProfileResourceWithStreamingResponse: - return AsyncProfileResourceWithStreamingResponse(self._devices.profile) - - @cached_property - def proxy(self) -> AsyncProxyResourceWithStreamingResponse: - return AsyncProxyResourceWithStreamingResponse(self._devices.proxy) - - @cached_property - def state(self) -> AsyncStateResourceWithStreamingResponse: - return AsyncStateResourceWithStreamingResponse(self._devices.state) - - @cached_property - def tasks(self) -> AsyncTasksResourceWithStreamingResponse: - return AsyncTasksResourceWithStreamingResponse(self._devices.tasks) - - @cached_property - def timezone(self) -> AsyncTimezoneResourceWithStreamingResponse: - return AsyncTimezoneResourceWithStreamingResponse(self._devices.timezone) - - @cached_property - def language(self) -> AsyncLanguageResourceWithStreamingResponse: - return AsyncLanguageResourceWithStreamingResponse(self._devices.language) diff --git a/src/mobilerun_sdk/resources/devices/esim.py b/src/mobilerun_sdk/resources/devices/esim.py deleted file mode 100644 index ba2d38e..0000000 --- a/src/mobilerun_sdk/resources/devices/esim.py +++ /dev/null @@ -1,510 +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, path_template, 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 esim_enable_params, esim_remove_params, esim_activate_params -from ...types.devices.esim_list_response import EsimListResponse -from ...types.devices.esim_activate_response import EsimActivateResponse - -__all__ = ["EsimResource", "AsyncEsimResource"] - - -class EsimResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EsimResourceWithRawResponse: - """ - 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 EsimResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EsimResourceWithStreamingResponse: - """ - 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 EsimResourceWithStreamingResponse(self) - - def list( - 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, - ) -> Optional[EsimListResponse]: - """ - List eSIM subscriptions - - 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( - path_template("/devices/{device_id}/esim", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EsimListResponse, - ) - - def activate( - self, - device_id: str, - *, - enable: bool, - sm_dp_addr: str, - confirmation_code: str | Omit = omit, - matching_id: 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, - ) -> EsimActivateResponse: - """ - Configure eSIM (download profile and/or enable subscription) - - Args: - confirmation_code: Optional carrier-issued confirmation code (the 4th LPA segment). Required only - for plans whose SM-DP+ challenges the device for one. Requires matchingId — the - LPA spec only interprets segment 4 when segment 3 is present. - - 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._post( - path_template("/devices/{device_id}/esim", device_id=device_id), - body=maybe_transform( - { - "enable": enable, - "sm_dp_addr": sm_dp_addr, - "confirmation_code": confirmation_code, - "matching_id": matching_id, - }, - esim_activate_params.EsimActivateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EsimActivateResponse, - ) - - def enable( - self, - device_id: str, - *, - sub_id: 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: - """ - Enable an eSIM subscription - - 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( - path_template("/devices/{device_id}/esim", device_id=device_id), - body=maybe_transform({"sub_id": sub_id}, esim_enable_params.EsimEnableParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def remove( - self, - device_id: str, - *, - sub_id: 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: - """ - Delete eSIM subscription - - 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( - path_template("/devices/{device_id}/esim", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"sub_id": sub_id}, esim_remove_params.EsimRemoveParams), - ), - cast_to=NoneType, - ) - - -class AsyncEsimResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEsimResourceWithRawResponse: - """ - 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 AsyncEsimResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEsimResourceWithStreamingResponse: - """ - 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 AsyncEsimResourceWithStreamingResponse(self) - - async def list( - 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, - ) -> Optional[EsimListResponse]: - """ - List eSIM subscriptions - - 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( - path_template("/devices/{device_id}/esim", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EsimListResponse, - ) - - async def activate( - self, - device_id: str, - *, - enable: bool, - sm_dp_addr: str, - confirmation_code: str | Omit = omit, - matching_id: 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, - ) -> EsimActivateResponse: - """ - Configure eSIM (download profile and/or enable subscription) - - Args: - confirmation_code: Optional carrier-issued confirmation code (the 4th LPA segment). Required only - for plans whose SM-DP+ challenges the device for one. Requires matchingId — the - LPA spec only interprets segment 4 when segment 3 is present. - - 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._post( - path_template("/devices/{device_id}/esim", device_id=device_id), - body=await async_maybe_transform( - { - "enable": enable, - "sm_dp_addr": sm_dp_addr, - "confirmation_code": confirmation_code, - "matching_id": matching_id, - }, - esim_activate_params.EsimActivateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EsimActivateResponse, - ) - - async def enable( - self, - device_id: str, - *, - sub_id: 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: - """ - Enable an eSIM subscription - - 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( - path_template("/devices/{device_id}/esim", device_id=device_id), - body=await async_maybe_transform({"sub_id": sub_id}, esim_enable_params.EsimEnableParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def remove( - self, - device_id: str, - *, - sub_id: 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: - """ - Delete eSIM subscription - - 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( - path_template("/devices/{device_id}/esim", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"sub_id": sub_id}, esim_remove_params.EsimRemoveParams), - ), - cast_to=NoneType, - ) - - -class EsimResourceWithRawResponse: - def __init__(self, esim: EsimResource) -> None: - self._esim = esim - - self.list = to_raw_response_wrapper( - esim.list, - ) - self.activate = to_raw_response_wrapper( - esim.activate, - ) - self.enable = to_raw_response_wrapper( - esim.enable, - ) - self.remove = to_raw_response_wrapper( - esim.remove, - ) - - -class AsyncEsimResourceWithRawResponse: - def __init__(self, esim: AsyncEsimResource) -> None: - self._esim = esim - - self.list = async_to_raw_response_wrapper( - esim.list, - ) - self.activate = async_to_raw_response_wrapper( - esim.activate, - ) - self.enable = async_to_raw_response_wrapper( - esim.enable, - ) - self.remove = async_to_raw_response_wrapper( - esim.remove, - ) - - -class EsimResourceWithStreamingResponse: - def __init__(self, esim: EsimResource) -> None: - self._esim = esim - - self.list = to_streamed_response_wrapper( - esim.list, - ) - self.activate = to_streamed_response_wrapper( - esim.activate, - ) - self.enable = to_streamed_response_wrapper( - esim.enable, - ) - self.remove = to_streamed_response_wrapper( - esim.remove, - ) - - -class AsyncEsimResourceWithStreamingResponse: - def __init__(self, esim: AsyncEsimResource) -> None: - self._esim = esim - - self.list = async_to_streamed_response_wrapper( - esim.list, - ) - self.activate = async_to_streamed_response_wrapper( - esim.activate, - ) - self.enable = async_to_streamed_response_wrapper( - esim.enable, - ) - self.remove = async_to_streamed_response_wrapper( - esim.remove, - ) diff --git a/src/mobilerun_sdk/resources/devices/files.py b/src/mobilerun_sdk/resources/devices/files.py deleted file mode 100644 index ffaba39..0000000 --- a/src/mobilerun_sdk/resources/devices/files.py +++ /dev/null @@ -1,520 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Mapping, cast - -import httpx - -from ..._files import deepcopy_with_paths -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes, omit, not_given -from ..._utils import is_given, extract_files, path_template, 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 file_list_params, file_delete_params, file_upload_params, file_download_params -from ...types.devices.file_list_response import FileListResponse - -__all__ = ["FilesResource", "AsyncFilesResource"] - - -class FilesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> FilesResourceWithRawResponse: - """ - 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 FilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FilesResourceWithStreamingResponse: - """ - 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 FilesResourceWithStreamingResponse(self) - - def list( - self, - device_id: str, - *, - path: 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, - ) -> FileListResponse: - """ - List files - - 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( - path_template("/devices/{device_id}/files", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"path": path}, file_list_params.FileListParams), - ), - cast_to=FileListResponse, - ) - - def delete( - self, - device_id: str, - *, - path: 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 file - - 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( - path_template("/devices/{device_id}/files", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"path": path}, file_delete_params.FileDeleteParams), - ), - cast_to=NoneType, - ) - - def download( - self, - device_id: str, - *, - path: 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: - """ - Download file - - 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( - path_template("/devices/{device_id}/files/download", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"path": path}, file_download_params.FileDownloadParams), - ), - cast_to=str, - ) - - def upload( - self, - device_id: str, - *, - path: str, - file: FileTypes, - 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: - """ - Upload file - - 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 {}), - } - body = deepcopy_with_paths({"file": file}, [["file"]]) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers["Content-Type"] = "multipart/form-data" - return self._post( - path_template("/devices/{device_id}/files", device_id=device_id), - body=maybe_transform(body, file_upload_params.FileUploadParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"path": path}, file_upload_params.FileUploadParams), - ), - cast_to=NoneType, - ) - - -class AsyncFilesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: - """ - 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 AsyncFilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: - """ - 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 AsyncFilesResourceWithStreamingResponse(self) - - async def list( - self, - device_id: str, - *, - path: 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, - ) -> FileListResponse: - """ - List files - - 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( - path_template("/devices/{device_id}/files", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"path": path}, file_list_params.FileListParams), - ), - cast_to=FileListResponse, - ) - - async def delete( - self, - device_id: str, - *, - path: 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 file - - 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( - path_template("/devices/{device_id}/files", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"path": path}, file_delete_params.FileDeleteParams), - ), - cast_to=NoneType, - ) - - async def download( - self, - device_id: str, - *, - path: 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: - """ - Download file - - 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( - path_template("/devices/{device_id}/files/download", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"path": path}, file_download_params.FileDownloadParams), - ), - cast_to=str, - ) - - async def upload( - self, - device_id: str, - *, - path: str, - file: FileTypes, - 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: - """ - Upload file - - 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 {}), - } - body = deepcopy_with_paths({"file": file}, [["file"]]) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers["Content-Type"] = "multipart/form-data" - return await self._post( - path_template("/devices/{device_id}/files", device_id=device_id), - body=await async_maybe_transform(body, file_upload_params.FileUploadParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"path": path}, file_upload_params.FileUploadParams), - ), - cast_to=NoneType, - ) - - -class FilesResourceWithRawResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.list = to_raw_response_wrapper( - files.list, - ) - self.delete = to_raw_response_wrapper( - files.delete, - ) - self.download = to_raw_response_wrapper( - files.download, - ) - self.upload = to_raw_response_wrapper( - files.upload, - ) - - -class AsyncFilesResourceWithRawResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.list = async_to_raw_response_wrapper( - files.list, - ) - self.delete = async_to_raw_response_wrapper( - files.delete, - ) - self.download = async_to_raw_response_wrapper( - files.download, - ) - self.upload = async_to_raw_response_wrapper( - files.upload, - ) - - -class FilesResourceWithStreamingResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.list = to_streamed_response_wrapper( - files.list, - ) - self.delete = to_streamed_response_wrapper( - files.delete, - ) - self.download = to_streamed_response_wrapper( - files.download, - ) - self.upload = to_streamed_response_wrapper( - files.upload, - ) - - -class AsyncFilesResourceWithStreamingResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.list = async_to_streamed_response_wrapper( - files.list, - ) - self.delete = async_to_streamed_response_wrapper( - files.delete, - ) - self.download = async_to_streamed_response_wrapper( - files.download, - ) - self.upload = async_to_streamed_response_wrapper( - files.upload, - ) diff --git a/src/mobilerun_sdk/resources/devices/keyboard.py b/src/mobilerun_sdk/resources/devices/keyboard.py deleted file mode 100644 index 97e2695..0000000 --- a/src/mobilerun_sdk/resources/devices/keyboard.py +++ /dev/null @@ -1,412 +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, path_template, 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( - path_template("/devices/{device_id}/keyboard", device_id=device_id), - 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( - path_template("/devices/{device_id}/keyboard", device_id=device_id), - 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, - *, - text: str, - clear: bool | Omit = omit, - error_rate: float | Omit = omit, - stealth: bool | Omit = omit, - wpm: int | 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: - """Input text - - Args: - error_rate: Per-character mistake rate for humantouch typing. - - -1 uses server default. - - wpm: Words per minute for stealth typing. 0 uses portal default. - - 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( - path_template("/devices/{device_id}/keyboard", device_id=device_id), - body=maybe_transform( - { - "text": text, - "clear": clear, - "error_rate": error_rate, - "stealth": stealth, - "wpm": wpm, - }, - 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( - path_template("/devices/{device_id}/keyboard", device_id=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 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( - path_template("/devices/{device_id}/keyboard", device_id=device_id), - 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, - *, - text: str, - clear: bool | Omit = omit, - error_rate: float | Omit = omit, - stealth: bool | Omit = omit, - wpm: int | 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: - """Input text - - Args: - error_rate: Per-character mistake rate for humantouch typing. - - -1 uses server default. - - wpm: Words per minute for stealth typing. 0 uses portal default. - - 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( - path_template("/devices/{device_id}/keyboard", device_id=device_id), - body=await async_maybe_transform( - { - "text": text, - "clear": clear, - "error_rate": error_rate, - "stealth": stealth, - "wpm": wpm, - }, - 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_sdk/resources/devices/language.py b/src/mobilerun_sdk/resources/devices/language.py deleted file mode 100644 index 498c78f..0000000 --- a/src/mobilerun_sdk/resources/devices/language.py +++ /dev/null @@ -1,303 +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, path_template, 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 language_set_params -from ...types.devices.language_get_response import LanguageGetResponse - -__all__ = ["LanguageResource", "AsyncLanguageResource"] - - -class LanguageResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> LanguageResourceWithRawResponse: - """ - 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 LanguageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LanguageResourceWithStreamingResponse: - """ - 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 LanguageResourceWithStreamingResponse(self) - - def get( - 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, - ) -> LanguageGetResponse: - """ - Get device language/locale - - 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( - path_template("/devices/{device_id}/language", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LanguageGetResponse, - ) - - def set( - self, - device_id: str, - *, - locale: str, - restart: 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, - ) -> None: - """ - Set device language/locale - - Args: - locale: BCP-47 locale: a 2–3 letter language tag, optionally followed by a 4-letter - script and/or a 2-letter region (e.g. en-US, de-DE, ja-JP, zh-Hans-CN). - - restart: Restart zygote so the locale change takes full effect immediately. Without it, - the locale is written but won't fully apply until the next reboot. - - 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( - path_template("/devices/{device_id}/language", device_id=device_id), - body=maybe_transform( - { - "locale": locale, - "restart": restart, - }, - language_set_params.LanguageSetParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncLanguageResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncLanguageResourceWithRawResponse: - """ - 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 AsyncLanguageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLanguageResourceWithStreamingResponse: - """ - 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 AsyncLanguageResourceWithStreamingResponse(self) - - async def get( - 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, - ) -> LanguageGetResponse: - """ - Get device language/locale - - 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( - path_template("/devices/{device_id}/language", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LanguageGetResponse, - ) - - async def set( - self, - device_id: str, - *, - locale: str, - restart: 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, - ) -> None: - """ - Set device language/locale - - Args: - locale: BCP-47 locale: a 2–3 letter language tag, optionally followed by a 4-letter - script and/or a 2-letter region (e.g. en-US, de-DE, ja-JP, zh-Hans-CN). - - restart: Restart zygote so the locale change takes full effect immediately. Without it, - the locale is written but won't fully apply until the next reboot. - - 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( - path_template("/devices/{device_id}/language", device_id=device_id), - body=await async_maybe_transform( - { - "locale": locale, - "restart": restart, - }, - language_set_params.LanguageSetParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class LanguageResourceWithRawResponse: - def __init__(self, language: LanguageResource) -> None: - self._language = language - - self.get = to_raw_response_wrapper( - language.get, - ) - self.set = to_raw_response_wrapper( - language.set, - ) - - -class AsyncLanguageResourceWithRawResponse: - def __init__(self, language: AsyncLanguageResource) -> None: - self._language = language - - self.get = async_to_raw_response_wrapper( - language.get, - ) - self.set = async_to_raw_response_wrapper( - language.set, - ) - - -class LanguageResourceWithStreamingResponse: - def __init__(self, language: LanguageResource) -> None: - self._language = language - - self.get = to_streamed_response_wrapper( - language.get, - ) - self.set = to_streamed_response_wrapper( - language.set, - ) - - -class AsyncLanguageResourceWithStreamingResponse: - def __init__(self, language: AsyncLanguageResource) -> None: - self._language = language - - self.get = async_to_streamed_response_wrapper( - language.get, - ) - self.set = async_to_streamed_response_wrapper( - language.set, - ) diff --git a/src/mobilerun_sdk/resources/devices/location.py b/src/mobilerun_sdk/resources/devices/location.py deleted file mode 100644 index f9469fc..0000000 --- a/src/mobilerun_sdk/resources/devices/location.py +++ /dev/null @@ -1,291 +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, path_template, 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 location_set_params -from ...types.shared.location import Location - -__all__ = ["LocationResource", "AsyncLocationResource"] - - -class LocationResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> LocationResourceWithRawResponse: - """ - 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 LocationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LocationResourceWithStreamingResponse: - """ - 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 LocationResourceWithStreamingResponse(self) - - def get( - 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, - ) -> Location: - """ - Get device location - - 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( - path_template("/devices/{device_id}/location", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Location, - ) - - def set( - self, - device_id: str, - *, - latitude: float, - longitude: float, - 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: - """ - Set device location - - 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( - path_template("/devices/{device_id}/location", device_id=device_id), - body=maybe_transform( - { - "latitude": latitude, - "longitude": longitude, - }, - location_set_params.LocationSetParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncLocationResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncLocationResourceWithRawResponse: - """ - 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 AsyncLocationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLocationResourceWithStreamingResponse: - """ - 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 AsyncLocationResourceWithStreamingResponse(self) - - async def get( - 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, - ) -> Location: - """ - Get device location - - 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( - path_template("/devices/{device_id}/location", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Location, - ) - - async def set( - self, - device_id: str, - *, - latitude: float, - longitude: float, - 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: - """ - Set device location - - 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( - path_template("/devices/{device_id}/location", device_id=device_id), - body=await async_maybe_transform( - { - "latitude": latitude, - "longitude": longitude, - }, - location_set_params.LocationSetParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class LocationResourceWithRawResponse: - def __init__(self, location: LocationResource) -> None: - self._location = location - - self.get = to_raw_response_wrapper( - location.get, - ) - self.set = to_raw_response_wrapper( - location.set, - ) - - -class AsyncLocationResourceWithRawResponse: - def __init__(self, location: AsyncLocationResource) -> None: - self._location = location - - self.get = async_to_raw_response_wrapper( - location.get, - ) - self.set = async_to_raw_response_wrapper( - location.set, - ) - - -class LocationResourceWithStreamingResponse: - def __init__(self, location: LocationResource) -> None: - self._location = location - - self.get = to_streamed_response_wrapper( - location.get, - ) - self.set = to_streamed_response_wrapper( - location.set, - ) - - -class AsyncLocationResourceWithStreamingResponse: - def __init__(self, location: AsyncLocationResource) -> None: - self._location = location - - self.get = async_to_streamed_response_wrapper( - location.get, - ) - self.set = async_to_streamed_response_wrapper( - location.set, - ) diff --git a/src/mobilerun_sdk/resources/devices/packages.py b/src/mobilerun_sdk/resources/devices/packages.py deleted file mode 100644 index dea5db3..0000000 --- a/src/mobilerun_sdk/resources/devices/packages.py +++ /dev/null @@ -1,205 +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, path_template, 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_protected_packages: bool | Omit = omit, - 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( - path_template("/devices/{device_id}/packages", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_protected_packages": include_protected_packages, - "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_protected_packages: bool | Omit = omit, - 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( - path_template("/devices/{device_id}/packages", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_protected_packages": include_protected_packages, - "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_sdk/resources/devices/profile.py b/src/mobilerun_sdk/resources/devices/profile.py deleted file mode 100644 index d48b092..0000000 --- a/src/mobilerun_sdk/resources/devices/profile.py +++ /dev/null @@ -1,188 +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, path_template, 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 profile_update_params - -__all__ = ["ProfileResource", "AsyncProfileResource"] - - -class ProfileResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProfileResourceWithRawResponse: - """ - 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 ProfileResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProfileResourceWithStreamingResponse: - """ - 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 ProfileResourceWithStreamingResponse(self) - - def update( - self, - device_id: str, - *, - profile_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: - """ - Apply a profile to a device - - Args: - profile_id: ID of the profile to apply - - 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( - path_template("/devices/{device_id}/profile", device_id=device_id), - body=maybe_transform({"profile_id": profile_id}, profile_update_params.ProfileUpdateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncProfileResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProfileResourceWithRawResponse: - """ - 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 AsyncProfileResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProfileResourceWithStreamingResponse: - """ - 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 AsyncProfileResourceWithStreamingResponse(self) - - async def update( - self, - device_id: str, - *, - profile_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: - """ - Apply a profile to a device - - Args: - profile_id: ID of the profile to apply - - 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( - path_template("/devices/{device_id}/profile", device_id=device_id), - body=await async_maybe_transform({"profile_id": profile_id}, profile_update_params.ProfileUpdateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class ProfileResourceWithRawResponse: - def __init__(self, profile: ProfileResource) -> None: - self._profile = profile - - self.update = to_raw_response_wrapper( - profile.update, - ) - - -class AsyncProfileResourceWithRawResponse: - def __init__(self, profile: AsyncProfileResource) -> None: - self._profile = profile - - self.update = async_to_raw_response_wrapper( - profile.update, - ) - - -class ProfileResourceWithStreamingResponse: - def __init__(self, profile: ProfileResource) -> None: - self._profile = profile - - self.update = to_streamed_response_wrapper( - profile.update, - ) - - -class AsyncProfileResourceWithStreamingResponse: - def __init__(self, profile: AsyncProfileResource) -> None: - self._profile = profile - - self.update = async_to_streamed_response_wrapper( - profile.update, - ) diff --git a/src/mobilerun_sdk/resources/devices/proxy.py b/src/mobilerun_sdk/resources/devices/proxy.py deleted file mode 100644 index 08e0c04..0000000 --- a/src/mobilerun_sdk/resources/devices/proxy.py +++ /dev/null @@ -1,413 +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, path_template, 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 proxy_connect_params -from ...types.devices.proxy_status_response import ProxyStatusResponse - -__all__ = ["ProxyResource", "AsyncProxyResource"] - - -class ProxyResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProxyResourceWithRawResponse: - """ - 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 ProxyResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProxyResourceWithStreamingResponse: - """ - 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 ProxyResourceWithStreamingResponse(self) - - def connect( - self, - device_id: str, - *, - host: str | Omit = omit, - name: str | Omit = omit, - password: str | Omit = omit, - port: int | Omit = omit, - smart_ip: bool | Omit = omit, - socks5: proxy_connect_params.Socks5 | Omit = omit, - user: 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: - """ - Connect proxy - - Args: - name: Proxy name - - socks5: SOCKS5 proxy configuration (required for socks5). - - 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( - path_template("/devices/{device_id}/proxy", device_id=device_id), - body=maybe_transform( - { - "host": host, - "name": name, - "password": password, - "port": port, - "smart_ip": smart_ip, - "socks5": socks5, - "user": user, - }, - proxy_connect_params.ProxyConnectParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def disconnect( - 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: - """ - Disconnect proxy - - 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( - path_template("/devices/{device_id}/proxy", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def status( - 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, - ) -> ProxyStatusResponse: - """ - Get proxy connection 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( - path_template("/devices/{device_id}/proxy", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProxyStatusResponse, - ) - - -class AsyncProxyResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProxyResourceWithRawResponse: - """ - 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 AsyncProxyResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProxyResourceWithStreamingResponse: - """ - 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 AsyncProxyResourceWithStreamingResponse(self) - - async def connect( - self, - device_id: str, - *, - host: str | Omit = omit, - name: str | Omit = omit, - password: str | Omit = omit, - port: int | Omit = omit, - smart_ip: bool | Omit = omit, - socks5: proxy_connect_params.Socks5 | Omit = omit, - user: 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: - """ - Connect proxy - - Args: - name: Proxy name - - socks5: SOCKS5 proxy configuration (required for socks5). - - 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( - path_template("/devices/{device_id}/proxy", device_id=device_id), - body=await async_maybe_transform( - { - "host": host, - "name": name, - "password": password, - "port": port, - "smart_ip": smart_ip, - "socks5": socks5, - "user": user, - }, - proxy_connect_params.ProxyConnectParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def disconnect( - 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: - """ - Disconnect proxy - - 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( - path_template("/devices/{device_id}/proxy", device_id=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 status( - 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, - ) -> ProxyStatusResponse: - """ - Get proxy connection 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( - path_template("/devices/{device_id}/proxy", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProxyStatusResponse, - ) - - -class ProxyResourceWithRawResponse: - def __init__(self, proxy: ProxyResource) -> None: - self._proxy = proxy - - self.connect = to_raw_response_wrapper( - proxy.connect, - ) - self.disconnect = to_raw_response_wrapper( - proxy.disconnect, - ) - self.status = to_raw_response_wrapper( - proxy.status, - ) - - -class AsyncProxyResourceWithRawResponse: - def __init__(self, proxy: AsyncProxyResource) -> None: - self._proxy = proxy - - self.connect = async_to_raw_response_wrapper( - proxy.connect, - ) - self.disconnect = async_to_raw_response_wrapper( - proxy.disconnect, - ) - self.status = async_to_raw_response_wrapper( - proxy.status, - ) - - -class ProxyResourceWithStreamingResponse: - def __init__(self, proxy: ProxyResource) -> None: - self._proxy = proxy - - self.connect = to_streamed_response_wrapper( - proxy.connect, - ) - self.disconnect = to_streamed_response_wrapper( - proxy.disconnect, - ) - self.status = to_streamed_response_wrapper( - proxy.status, - ) - - -class AsyncProxyResourceWithStreamingResponse: - def __init__(self, proxy: AsyncProxyResource) -> None: - self._proxy = proxy - - self.connect = async_to_streamed_response_wrapper( - proxy.connect, - ) - self.disconnect = async_to_streamed_response_wrapper( - proxy.disconnect, - ) - self.status = async_to_streamed_response_wrapper( - proxy.status, - ) diff --git a/src/mobilerun_sdk/resources/devices/state.py b/src/mobilerun_sdk/resources/devices/state.py deleted file mode 100644 index 789665e..0000000 --- a/src/mobilerun_sdk/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, path_template, 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( - path_template("/devices/{device_id}/screenshot", device_id=device_id), - 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( - path_template("/devices/{device_id}/time", device_id=device_id), - 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( - path_template("/devices/{device_id}/ui-state", device_id=device_id), - 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( - path_template("/devices/{device_id}/screenshot", device_id=device_id), - 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( - path_template("/devices/{device_id}/time", device_id=device_id), - 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( - path_template("/devices/{device_id}/ui-state", device_id=device_id), - 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_sdk/resources/devices/tasks.py b/src/mobilerun_sdk/resources/devices/tasks.py deleted file mode 100644 index 62c8d6f..0000000 --- a/src/mobilerun_sdk/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 path_template, 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( - path_template("/devices/{device_id}/tasks", device_id=device_id), - 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( - path_template("/devices/{device_id}/tasks", device_id=device_id), - 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_sdk/resources/devices/timezone.py b/src/mobilerun_sdk/resources/devices/timezone.py deleted file mode 100644 index a136b2f..0000000 --- a/src/mobilerun_sdk/resources/devices/timezone.py +++ /dev/null @@ -1,277 +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, path_template, 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 timezone_set_params -from ...types.devices.timezone_get_response import TimezoneGetResponse - -__all__ = ["TimezoneResource", "AsyncTimezoneResource"] - - -class TimezoneResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TimezoneResourceWithRawResponse: - """ - 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 TimezoneResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TimezoneResourceWithStreamingResponse: - """ - 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 TimezoneResourceWithStreamingResponse(self) - - def get( - 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, - ) -> TimezoneGetResponse: - """ - Get device timezone - - 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( - path_template("/devices/{device_id}/timezone", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TimezoneGetResponse, - ) - - def set( - self, - device_id: str, - *, - timezone: 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: - """ - Set device timezone - - 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( - path_template("/devices/{device_id}/timezone", device_id=device_id), - body=maybe_transform({"timezone": timezone}, timezone_set_params.TimezoneSetParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncTimezoneResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTimezoneResourceWithRawResponse: - """ - 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 AsyncTimezoneResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTimezoneResourceWithStreamingResponse: - """ - 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 AsyncTimezoneResourceWithStreamingResponse(self) - - async def get( - 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, - ) -> TimezoneGetResponse: - """ - Get device timezone - - 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( - path_template("/devices/{device_id}/timezone", device_id=device_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TimezoneGetResponse, - ) - - async def set( - self, - device_id: str, - *, - timezone: 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: - """ - Set device timezone - - 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( - path_template("/devices/{device_id}/timezone", device_id=device_id), - body=await async_maybe_transform({"timezone": timezone}, timezone_set_params.TimezoneSetParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class TimezoneResourceWithRawResponse: - def __init__(self, timezone: TimezoneResource) -> None: - self._timezone = timezone - - self.get = to_raw_response_wrapper( - timezone.get, - ) - self.set = to_raw_response_wrapper( - timezone.set, - ) - - -class AsyncTimezoneResourceWithRawResponse: - def __init__(self, timezone: AsyncTimezoneResource) -> None: - self._timezone = timezone - - self.get = async_to_raw_response_wrapper( - timezone.get, - ) - self.set = async_to_raw_response_wrapper( - timezone.set, - ) - - -class TimezoneResourceWithStreamingResponse: - def __init__(self, timezone: TimezoneResource) -> None: - self._timezone = timezone - - self.get = to_streamed_response_wrapper( - timezone.get, - ) - self.set = to_streamed_response_wrapper( - timezone.set, - ) - - -class AsyncTimezoneResourceWithStreamingResponse: - def __init__(self, timezone: AsyncTimezoneResource) -> None: - self._timezone = timezone - - self.get = async_to_streamed_response_wrapper( - timezone.get, - ) - self.set = async_to_streamed_response_wrapper( - timezone.set, - ) diff --git a/src/mobilerun_sdk/resources/profiles.py b/src/mobilerun_sdk/resources/profiles.py deleted file mode 100644 index 5d2c498..0000000 --- a/src/mobilerun_sdk/resources/profiles.py +++ /dev/null @@ -1,558 +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 profile_list_params, profile_create_params, profile_update_params -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import path_template, 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.profile import Profile -from ..types.profile_list_response import ProfileListResponse -from ..types.profile_delete_response import ProfileDeleteResponse -from ..types.shared_params.device_spec import DeviceSpec - -__all__ = ["ProfilesResource", "AsyncProfilesResource"] - - -class ProfilesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProfilesResourceWithRawResponse: - """ - 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 ProfilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProfilesResourceWithStreamingResponse: - """ - 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 ProfilesResourceWithStreamingResponse(self) - - def create( - self, - *, - name: str, - spec: DeviceSpec, - # 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, - ) -> Profile: - """ - Create a new device profile - - Args: - name: Profile name - - spec: Device specification - - 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( - "/profiles", - body=maybe_transform( - { - "name": name, - "spec": spec, - }, - profile_create_params.ProfileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Profile, - ) - - def retrieve( - self, - profile_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, - ) -> Profile: - """ - Get device profile by ID - - 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 profile_id: - raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") - return self._get( - path_template("/profiles/{profile_id}", profile_id=profile_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Profile, - ) - - def update( - self, - profile_id: str, - *, - name: str, - spec: DeviceSpec, - # 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, - ) -> Profile: - """ - Update a device profile - - Args: - name: Profile name - - spec: Device specification - - 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 profile_id: - raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") - return self._put( - path_template("/profiles/{profile_id}", profile_id=profile_id), - body=maybe_transform( - { - "name": name, - "spec": spec, - }, - profile_update_params.ProfileUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Profile, - ) - - def list( - self, - *, - name: str | Omit = omit, - order_by: Literal["name", "created_at", "updated_at"] | 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, - ) -> ProfileListResponse: - """ - List device profiles - - 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( - "/profiles", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - }, - profile_list_params.ProfileListParams, - ), - ), - cast_to=ProfileListResponse, - ) - - def delete( - self, - profile_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, - ) -> ProfileDeleteResponse: - """ - Delete a device profile - - 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 profile_id: - raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") - return self._delete( - path_template("/profiles/{profile_id}", profile_id=profile_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProfileDeleteResponse, - ) - - -class AsyncProfilesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: - """ - 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 AsyncProfilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProfilesResourceWithStreamingResponse: - """ - 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 AsyncProfilesResourceWithStreamingResponse(self) - - async def create( - self, - *, - name: str, - spec: DeviceSpec, - # 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, - ) -> Profile: - """ - Create a new device profile - - Args: - name: Profile name - - spec: Device specification - - 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( - "/profiles", - body=await async_maybe_transform( - { - "name": name, - "spec": spec, - }, - profile_create_params.ProfileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Profile, - ) - - async def retrieve( - self, - profile_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, - ) -> Profile: - """ - Get device profile by ID - - 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 profile_id: - raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") - return await self._get( - path_template("/profiles/{profile_id}", profile_id=profile_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Profile, - ) - - async def update( - self, - profile_id: str, - *, - name: str, - spec: DeviceSpec, - # 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, - ) -> Profile: - """ - Update a device profile - - Args: - name: Profile name - - spec: Device specification - - 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 profile_id: - raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") - return await self._put( - path_template("/profiles/{profile_id}", profile_id=profile_id), - body=await async_maybe_transform( - { - "name": name, - "spec": spec, - }, - profile_update_params.ProfileUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Profile, - ) - - async def list( - self, - *, - name: str | Omit = omit, - order_by: Literal["name", "created_at", "updated_at"] | 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, - ) -> ProfileListResponse: - """ - List device profiles - - 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( - "/profiles", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "name": name, - "order_by": order_by, - "order_by_direction": order_by_direction, - "page": page, - "page_size": page_size, - }, - profile_list_params.ProfileListParams, - ), - ), - cast_to=ProfileListResponse, - ) - - async def delete( - self, - profile_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, - ) -> ProfileDeleteResponse: - """ - Delete a device profile - - 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 profile_id: - raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") - return await self._delete( - path_template("/profiles/{profile_id}", profile_id=profile_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProfileDeleteResponse, - ) - - -class ProfilesResourceWithRawResponse: - def __init__(self, profiles: ProfilesResource) -> None: - self._profiles = profiles - - self.create = to_raw_response_wrapper( - profiles.create, - ) - self.retrieve = to_raw_response_wrapper( - profiles.retrieve, - ) - self.update = to_raw_response_wrapper( - profiles.update, - ) - self.list = to_raw_response_wrapper( - profiles.list, - ) - self.delete = to_raw_response_wrapper( - profiles.delete, - ) - - -class AsyncProfilesResourceWithRawResponse: - def __init__(self, profiles: AsyncProfilesResource) -> None: - self._profiles = profiles - - self.create = async_to_raw_response_wrapper( - profiles.create, - ) - self.retrieve = async_to_raw_response_wrapper( - profiles.retrieve, - ) - self.update = async_to_raw_response_wrapper( - profiles.update, - ) - self.list = async_to_raw_response_wrapper( - profiles.list, - ) - self.delete = async_to_raw_response_wrapper( - profiles.delete, - ) - - -class ProfilesResourceWithStreamingResponse: - def __init__(self, profiles: ProfilesResource) -> None: - self._profiles = profiles - - self.create = to_streamed_response_wrapper( - profiles.create, - ) - self.retrieve = to_streamed_response_wrapper( - profiles.retrieve, - ) - self.update = to_streamed_response_wrapper( - profiles.update, - ) - self.list = to_streamed_response_wrapper( - profiles.list, - ) - self.delete = to_streamed_response_wrapper( - profiles.delete, - ) - - -class AsyncProfilesResourceWithStreamingResponse: - def __init__(self, profiles: AsyncProfilesResource) -> None: - self._profiles = profiles - - self.create = async_to_streamed_response_wrapper( - profiles.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - profiles.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - profiles.update, - ) - self.list = async_to_streamed_response_wrapper( - profiles.list, - ) - self.delete = async_to_streamed_response_wrapper( - profiles.delete, - ) diff --git a/src/mobilerun_sdk/resources/proxies.py b/src/mobilerun_sdk/resources/proxies.py index 45a990d..eb8bcc6 100644 --- a/src/mobilerun_sdk/resources/proxies.py +++ b/src/mobilerun_sdk/resources/proxies.py @@ -6,7 +6,7 @@ import httpx -from ..types import proxy_list_params, proxy_create_params, proxy_lookup_params, proxy_update_params +from ..types import proxy_list_params, proxy_create_params, proxy_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import path_template, required_args, maybe_transform, async_maybe_transform from .._compat import cached_property @@ -21,7 +21,6 @@ from ..types.proxy_list_response import ProxyListResponse from ..types.proxy_create_response import ProxyCreateResponse from ..types.proxy_delete_response import ProxyDeleteResponse -from ..types.proxy_lookup_response import ProxyLookupResponse from ..types.proxy_update_response import ProxyUpdateResponse from ..types.proxy_retrieve_response import ProxyRetrieveResponse @@ -368,40 +367,6 @@ def delete( cast_to=ProxyDeleteResponse, ) - def lookup( - self, - *, - socks5: proxy_lookup_params.Socks5, - # 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, - ) -> ProxyLookupResponse: - """ - Lookup proxy location - - Args: - socks5: SOCKS5 proxy configuration. - - 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( - "/proxies/lookup", - body=maybe_transform({"socks5": socks5}, proxy_lookup_params.ProxyLookupParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProxyLookupResponse, - ) - class AsyncProxiesResource(AsyncAPIResource): @cached_property @@ -743,40 +708,6 @@ async def delete( cast_to=ProxyDeleteResponse, ) - async def lookup( - self, - *, - socks5: proxy_lookup_params.Socks5, - # 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, - ) -> ProxyLookupResponse: - """ - Lookup proxy location - - Args: - socks5: SOCKS5 proxy configuration. - - 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( - "/proxies/lookup", - body=await async_maybe_transform({"socks5": socks5}, proxy_lookup_params.ProxyLookupParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProxyLookupResponse, - ) - class ProxiesResourceWithRawResponse: def __init__(self, proxies: ProxiesResource) -> None: @@ -797,9 +728,6 @@ def __init__(self, proxies: ProxiesResource) -> None: self.delete = to_raw_response_wrapper( proxies.delete, ) - self.lookup = to_raw_response_wrapper( - proxies.lookup, - ) class AsyncProxiesResourceWithRawResponse: @@ -821,9 +749,6 @@ def __init__(self, proxies: AsyncProxiesResource) -> None: self.delete = async_to_raw_response_wrapper( proxies.delete, ) - self.lookup = async_to_raw_response_wrapper( - proxies.lookup, - ) class ProxiesResourceWithStreamingResponse: @@ -845,9 +770,6 @@ def __init__(self, proxies: ProxiesResource) -> None: self.delete = to_streamed_response_wrapper( proxies.delete, ) - self.lookup = to_streamed_response_wrapper( - proxies.lookup, - ) class AsyncProxiesResourceWithStreamingResponse: @@ -869,6 +791,3 @@ def __init__(self, proxies: AsyncProxiesResource) -> None: self.delete = async_to_streamed_response_wrapper( proxies.delete, ) - self.lookup = async_to_streamed_response_wrapper( - proxies.lookup, - ) diff --git a/src/mobilerun_sdk/types/__init__.py b/src/mobilerun_sdk/types/__init__.py index ecf96d9..ee48455 100644 --- a/src/mobilerun_sdk/types/__init__.py +++ b/src/mobilerun_sdk/types/__init__.py @@ -2,23 +2,9 @@ from __future__ import annotations -from . import devices -from .. import _compat from .flow import Flow as Flow from .task import Task as Task -from .device import Device as Device -from .shared import ( - Meta as Meta, - Socks5 as Socks5, - Location as Location, - DeviceSpec as DeviceSpec, - Pagination as Pagination, - DeviceCarrier as DeviceCarrier, - PermissionSet as PermissionSet, - PaginationMeta as PaginationMeta, - DeviceIdentifiers as DeviceIdentifiers, -) -from .profile import Profile as Profile +from .shared import Pagination as Pagination, PaginationMeta as PaginationMeta from .task_status import TaskStatus as TaskStatus from .proxy_config import ProxyConfig as ProxyConfig from .usage_result import UsageResult as UsageResult @@ -28,46 +14,24 @@ from .app_list_response import AppListResponse as AppListResponse from .proxy_list_params import ProxyListParams as ProxyListParams from .task_run_response import TaskRunResponse as TaskRunResponse -from .device_list_params import DeviceListParams as DeviceListParams from .task_list_response import TaskListResponse as TaskListResponse from .task_stop_response import TaskStopResponse as TaskStopResponse from .app_delete_response import AppDeleteResponse as AppDeleteResponse -from .carrier_list_params import CarrierListParams as CarrierListParams from .model_list_response import ModelListResponse as ModelListResponse from .package_credentials import PackageCredentials as PackageCredentials -from .profile_list_params import ProfileListParams as ProfileListParams from .proxy_create_params import ProxyCreateParams as ProxyCreateParams from .proxy_list_response import ProxyListResponse as ProxyListResponse -from .proxy_lookup_params import ProxyLookupParams as ProxyLookupParams from .proxy_update_params import ProxyUpdateParams as ProxyUpdateParams from .webhook_list_params import WebhookListParams as WebhookListParams -from .device_create_params import DeviceCreateParams as DeviceCreateParams -from .device_list_response import DeviceListResponse as DeviceListResponse from .app_retrieve_response import AppRetrieveResponse as AppRetrieveResponse -from .carrier_create_params import CarrierCreateParams as CarrierCreateParams -from .carrier_list_response import CarrierListResponse as CarrierListResponse -from .carrier_lookup_params import CarrierLookupParams as CarrierLookupParams -from .carrier_update_params import CarrierUpdateParams as CarrierUpdateParams -from .device_count_response import DeviceCountResponse as DeviceCountResponse -from .profile_create_params import ProfileCreateParams as ProfileCreateParams -from .profile_list_response import ProfileListResponse as ProfileListResponse -from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams from .proxy_create_response import ProxyCreateResponse as ProxyCreateResponse from .proxy_delete_response import ProxyDeleteResponse as ProxyDeleteResponse -from .proxy_lookup_response import ProxyLookupResponse as ProxyLookupResponse from .proxy_update_response import ProxyUpdateResponse as ProxyUpdateResponse from .webhook_create_params import WebhookCreateParams as WebhookCreateParams from .webhook_list_response import WebhookListResponse as WebhookListResponse from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams from .credential_list_params import CredentialListParams as CredentialListParams -from .device_set_name_params import DeviceSetNameParams as DeviceSetNameParams from .task_retrieve_response import TaskRetrieveResponse as TaskRetrieveResponse -from .carrier_create_response import CarrierCreateResponse as CarrierCreateResponse -from .carrier_delete_response import CarrierDeleteResponse as CarrierDeleteResponse -from .carrier_lookup_response import CarrierLookupResponse as CarrierLookupResponse -from .carrier_update_response import CarrierUpdateResponse as CarrierUpdateResponse -from .device_terminate_params import DeviceTerminateParams as DeviceTerminateParams -from .profile_delete_response import ProfileDeleteResponse as ProfileDeleteResponse from .proxy_retrieve_response import ProxyRetrieveResponse as ProxyRetrieveResponse from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse @@ -76,27 +40,14 @@ from .task_get_status_response import TaskGetStatusResponse as TaskGetStatusResponse from .task_run_streamed_params import TaskRunStreamedParams as TaskRunStreamedParams from .task_send_message_params import TaskSendMessageParams as TaskSendMessageParams -from .carrier_retrieve_response import CarrierRetrieveResponse as CarrierRetrieveResponse from .package_credentials_param import PackageCredentialsParam as PackageCredentialsParam from .webhook_retrieve_response import WebhookRetrieveResponse as WebhookRetrieveResponse from .app_list_versions_response import AppListVersionsResponse as AppListVersionsResponse from .task_send_message_response import TaskSendMessageResponse as TaskSendMessageResponse from .app_confirm_upload_response import AppConfirmUploadResponse as AppConfirmUploadResponse -from .device_fingerprint_response import DeviceFingerprintResponse as DeviceFingerprintResponse from .task_get_trajectory_response import TaskGetTrajectoryResponse as TaskGetTrajectoryResponse from .webhook_event_types_response import WebhookEventTypesResponse as WebhookEventTypesResponse from .webhook_rotate_secret_response import WebhookRotateSecretResponse as WebhookRotateSecretResponse from .webhook_test_delivery_response import WebhookTestDeliveryResponse as WebhookTestDeliveryResponse from .app_create_signed_upload_url_params import AppCreateSignedUploadURLParams as AppCreateSignedUploadURLParams from .app_create_signed_upload_url_response import AppCreateSignedUploadURLResponse as AppCreateSignedUploadURLResponse - -# Rebuild cyclical models only after all modules are imported. -# This ensures that, when building the deferred (due to cyclical references) model schema, -# Pydantic can resolve the necessary references. -# See: https://github.com/pydantic/pydantic/issues/11250 for more context. -if _compat.PYDANTIC_V1: - devices.a11_y_node.A11YNode.update_forward_refs() # type: ignore - devices.state_ui_response.StateUiResponse.update_forward_refs() # type: ignore -else: - devices.a11_y_node.A11YNode.model_rebuild(_parent_namespace_depth=0) - devices.state_ui_response.StateUiResponse.model_rebuild(_parent_namespace_depth=0) diff --git a/src/mobilerun_sdk/types/carrier_create_params.py b/src/mobilerun_sdk/types/carrier_create_params.py deleted file mode 100644 index 3b6c6c7..0000000 --- a/src/mobilerun_sdk/types/carrier_create_params.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["CarrierCreateParams"] - - -class CarrierCreateParams(TypedDict, total=False): - country: Required[str] - """Country name""" - - mcc: Required[str] - """Mobile Country Code""" - - mnc: Required[str] - """Mobile Network Code""" - - operator: Required[str] - """Operator name""" - - company: str - """Company name""" - - country_code: str - """Country dialing code (e.g., +1)""" - - country_iso: str - """ISO country code""" - - detail_url: str - """URL to carrier details page""" - - gsm_bands: str - """Supported GSM bands""" - - lte_bands: str - """Supported LTE bands""" - - mobile_prefix: str - """Mobile number prefix""" - - nsn_size: str - """National Significant Number size""" - - number_format: str - """Phone number format""" - - protocols: str - """Supported protocols (comma-separated)""" - - umts_bands: str - """Supported UMTS bands""" - - website: str - """Company website""" diff --git a/src/mobilerun_sdk/types/carrier_create_response.py b/src/mobilerun_sdk/types/carrier_create_response.py deleted file mode 100644 index 643be23..0000000 --- a/src/mobilerun_sdk/types/carrier_create_response.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["CarrierCreateResponse"] - - -class CarrierCreateResponse(BaseModel): - id: int - - company: str - - country: str - - country_code: str - - country_iso: str - - created_at: datetime - - detail_url: str - - gsm_bands: str - - lte_bands: str - - mcc: str - - mnc: str - - mobile_prefix: str - - nsn_size: str - - number_format: str - - operator: str - - protocols: str - - umts_bands: str - - website: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_delete_response.py b/src/mobilerun_sdk/types/carrier_delete_response.py deleted file mode 100644 index ccb2aea..0000000 --- a/src/mobilerun_sdk/types/carrier_delete_response.py +++ /dev/null @@ -1,16 +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__ = ["CarrierDeleteResponse"] - - -class CarrierDeleteResponse(BaseModel): - message: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_list_params.py b/src/mobilerun_sdk/types/carrier_list_params.py deleted file mode 100644 index 8cd3723..0000000 --- a/src/mobilerun_sdk/types/carrier_list_params.py +++ /dev/null @@ -1,31 +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__ = ["CarrierListParams"] - - -class CarrierListParams(TypedDict, total=False): - country: str - """Filter by country name""" - - country_iso: Annotated[str, PropertyInfo(alias="countryISO")] - """Filter by country ISO code""" - - order_by: Annotated[ - Literal["id", "mcc", "mnc", "operator", "country", "country_iso"], PropertyInfo(alias="orderBy") - ] - """Field to order by""" - - order_dir: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderDir")] - """Order direction""" - - page: int - """Page number""" - - page_size: Annotated[int, PropertyInfo(alias="pageSize")] - """Items per page""" diff --git a/src/mobilerun_sdk/types/carrier_list_response.py b/src/mobilerun_sdk/types/carrier_list_response.py deleted file mode 100644 index 098754a..0000000 --- a/src/mobilerun_sdk/types/carrier_list_response.py +++ /dev/null @@ -1,61 +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 -from .shared.meta import Meta - -__all__ = ["CarrierListResponse", "Item"] - - -class Item(BaseModel): - id: int - - company: str - - country: str - - country_code: str - - country_iso: str - - created_at: datetime - - detail_url: str - - gsm_bands: str - - lte_bands: str - - mcc: str - - mnc: str - - mobile_prefix: str - - nsn_size: str - - number_format: str - - operator: str - - protocols: str - - umts_bands: str - - website: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" - - -class CarrierListResponse(BaseModel): - items: Optional[List[Item]] = None - - pagination: Meta - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_lookup_params.py b/src/mobilerun_sdk/types/carrier_lookup_params.py deleted file mode 100644 index bf51578..0000000 --- a/src/mobilerun_sdk/types/carrier_lookup_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, TypedDict - -__all__ = ["CarrierLookupParams"] - - -class CarrierLookupParams(TypedDict, total=False): - mcc: Required[str] - """Mobile Country Code""" - - mnc: Required[str] - """Mobile Network Code""" diff --git a/src/mobilerun_sdk/types/carrier_lookup_response.py b/src/mobilerun_sdk/types/carrier_lookup_response.py deleted file mode 100644 index 925e0d6..0000000 --- a/src/mobilerun_sdk/types/carrier_lookup_response.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["CarrierLookupResponse"] - - -class CarrierLookupResponse(BaseModel): - id: int - - company: str - - country: str - - country_code: str - - country_iso: str - - created_at: datetime - - detail_url: str - - gsm_bands: str - - lte_bands: str - - mcc: str - - mnc: str - - mobile_prefix: str - - nsn_size: str - - number_format: str - - operator: str - - protocols: str - - umts_bands: str - - website: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_retrieve_response.py b/src/mobilerun_sdk/types/carrier_retrieve_response.py deleted file mode 100644 index f4bf58c..0000000 --- a/src/mobilerun_sdk/types/carrier_retrieve_response.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["CarrierRetrieveResponse"] - - -class CarrierRetrieveResponse(BaseModel): - id: int - - company: str - - country: str - - country_code: str - - country_iso: str - - created_at: datetime - - detail_url: str - - gsm_bands: str - - lte_bands: str - - mcc: str - - mnc: str - - mobile_prefix: str - - nsn_size: str - - number_format: str - - operator: str - - protocols: str - - umts_bands: str - - website: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_update_params.py b/src/mobilerun_sdk/types/carrier_update_params.py deleted file mode 100644 index aa98473..0000000 --- a/src/mobilerun_sdk/types/carrier_update_params.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["CarrierUpdateParams"] - - -class CarrierUpdateParams(TypedDict, total=False): - company: str - """Company name""" - - country: str - """Country name""" - - country_code: str - """Country dialing code""" - - country_iso: str - """ISO country code""" - - detail_url: str - """URL to carrier details""" - - gsm_bands: str - """Supported GSM bands""" - - lte_bands: str - """Supported LTE bands""" - - mobile_prefix: str - """Mobile number prefix""" - - nsn_size: str - """NSN size""" - - number_format: str - """Phone number format""" - - operator: str - """Operator name""" - - protocols: str - """Supported protocols""" - - umts_bands: str - """Supported UMTS bands""" - - website: str - """Company website""" diff --git a/src/mobilerun_sdk/types/carrier_update_response.py b/src/mobilerun_sdk/types/carrier_update_response.py deleted file mode 100644 index ba0d7ef..0000000 --- a/src/mobilerun_sdk/types/carrier_update_response.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["CarrierUpdateResponse"] - - -class CarrierUpdateResponse(BaseModel): - id: int - - company: str - - country: str - - country_code: str - - country_iso: str - - created_at: datetime - - detail_url: str - - gsm_bands: str - - lte_bands: str - - mcc: str - - mnc: str - - mobile_prefix: str - - nsn_size: str - - number_format: str - - operator: str - - protocols: str - - umts_bands: str - - website: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/device.py b/src/mobilerun_sdk/types/device.py deleted file mode 100644 index c4ba3f8..0000000 --- a/src/mobilerun_sdk/types/device.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["Device"] - - -class Device(BaseModel): - id: str - - active_task_id: str = FieldInfo(alias="activeTaskId") - - assigned_at: Optional[datetime] = FieldInfo(alias="assignedAt", default=None) - - created_at: datetime = FieldInfo(alias="createdAt") - - name: str - - state: str - - state_message: str = FieldInfo(alias="stateMessage") - - stream_url: str = FieldInfo(alias="streamUrl") - - task_count: int = FieldInfo(alias="taskCount") - - terminates_at: Optional[datetime] = FieldInfo(alias="terminatesAt", default=None) - - type: str - - updated_at: datetime = FieldInfo(alias="updatedAt") - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" - - provider_id: Optional[str] = FieldInfo(alias="providerId", default=None) - - stream_token: Optional[str] = FieldInfo(alias="streamToken", default=None) - - user_id: Optional[str] = FieldInfo(alias="userId", default=None) diff --git a/src/mobilerun_sdk/types/device_count_response.py b/src/mobilerun_sdk/types/device_count_response.py deleted file mode 100644 index 966ff68..0000000 --- a/src/mobilerun_sdk/types/device_count_response.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict -from typing_extensions import TypeAlias - -__all__ = ["DeviceCountResponse"] - -DeviceCountResponse: TypeAlias = Dict[str, int] diff --git a/src/mobilerun_sdk/types/device_create_params.py b/src/mobilerun_sdk/types/device_create_params.py deleted file mode 100644 index a631b9c..0000000 --- a/src/mobilerun_sdk/types/device_create_params.py +++ /dev/null @@ -1,61 +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, Annotated, TypedDict - -from .._types import SequenceNotStr -from .._utils import PropertyInfo -from .shared_params.socks5 import Socks5 -from .shared_params.location import Location -from .shared_params.device_carrier import DeviceCarrier -from .shared_params.device_identifiers import DeviceIdentifiers - -__all__ = ["DeviceCreateParams", "Proxy"] - - -class DeviceCreateParams(TypedDict, total=False): - query_country: Annotated[str, PropertyInfo(alias="country")] - """ISO 3166-1 alpha-2 country code. - - If omitted the system picks the country with the most availability. - """ - - device_type: Annotated[ - Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device"], - PropertyInfo(alias="deviceType"), - ] - - profile_id: Annotated[str, PropertyInfo(alias="profileId")] - """Profile ID to use as device spec""" - - android_version: Annotated[int, PropertyInfo(alias="androidVersion")] - - apps: Optional[SequenceNotStr[str]] - - carrier: DeviceCarrier - - body_country: Annotated[str, PropertyInfo(alias="country")] - - files: Optional[SequenceNotStr[str]] - - identifiers: DeviceIdentifiers - - locale: str - - location: Location - - name: str - - proxy: Proxy - - timezone: str - - -class Proxy(TypedDict, total=False): - name: str - - smart_ip: Annotated[bool, PropertyInfo(alias="smartIp")] - - socks5: Socks5 diff --git a/src/mobilerun_sdk/types/device_fingerprint_response.py b/src/mobilerun_sdk/types/device_fingerprint_response.py deleted file mode 100644 index 4f8f410..0000000 --- a/src/mobilerun_sdk/types/device_fingerprint_response.py +++ /dev/null @@ -1,48 +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 -from .shared.device_carrier import DeviceCarrier -from .shared.device_identifiers import DeviceIdentifiers - -__all__ = ["DeviceFingerprintResponse", "Display", "Model"] - - -class Display(BaseModel): - density_dpi: Optional[int] = FieldInfo(alias="densityDpi", default=None) - - height: Optional[int] = None - - width: Optional[int] = None - - -class Model(BaseModel): - aosp_version: Optional[str] = FieldInfo(alias="aospVersion", default=None) - - brand: Optional[str] = None - - device: Optional[str] = None - - hardware: Optional[str] = None - - image_repository: Optional[str] = FieldInfo(alias="imageRepository", default=None) - - manufacturer: Optional[str] = None - - model: Optional[str] = None - - -class DeviceFingerprintResponse(BaseModel): - carrier: DeviceCarrier - - display: Display - - identifiers: DeviceIdentifiers - - model: Model - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/device_list_params.py b/src/mobilerun_sdk/types/device_list_params.py deleted file mode 100644 index fcec1bb..0000000 --- a/src/mobilerun_sdk/types/device_list_params.py +++ /dev/null @@ -1,44 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -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_id: Annotated[str, PropertyInfo(alias="providerId")] - - state: Optional[ - List[ - Literal[ - "creating", - "assigned", - "ready", - "rebooting", - "migrating", - "resetting", - "terminated", - "maintenance", - "unknown", - ] - ] - ] - - type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device"] diff --git a/src/mobilerun_sdk/types/device_list_response.py b/src/mobilerun_sdk/types/device_list_response.py deleted file mode 100644 index e748a8e..0000000 --- a/src/mobilerun_sdk/types/device_list_response.py +++ /dev/null @@ -1,20 +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 -from .shared.meta import Meta - -__all__ = ["DeviceListResponse"] - - -class DeviceListResponse(BaseModel): - items: Optional[List[Device]] = None - - pagination: Meta - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/device_set_name_params.py b/src/mobilerun_sdk/types/device_set_name_params.py deleted file mode 100644 index 03cb2f6..0000000 --- a/src/mobilerun_sdk/types/device_set_name_params.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["DeviceSetNameParams"] - - -class DeviceSetNameParams(TypedDict, total=False): - name: Required[str] diff --git a/src/mobilerun_sdk/types/device_terminate_params.py b/src/mobilerun_sdk/types/device_terminate_params.py deleted file mode 100644 index f4a7660..0000000 --- a/src/mobilerun_sdk/types/device_terminate_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 import Union -from datetime import datetime -from typing_extensions import Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["DeviceTerminateParams"] - - -class DeviceTerminateParams(TypedDict, total=False): - previous_device_id: Annotated[str, PropertyInfo(alias="previousDeviceId")] - - terminate_at: Annotated[Union[str, datetime], PropertyInfo(alias="terminateAt", format="iso8601")] diff --git a/src/mobilerun_sdk/types/devices/__init__.py b/src/mobilerun_sdk/types/devices/__init__.py index dcd2cfa..f8ee8b1 100644 --- a/src/mobilerun_sdk/types/devices/__init__.py +++ b/src/mobilerun_sdk/types/devices/__init__.py @@ -1,47 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .rect import Rect as Rect -from .file_info import FileInfo as FileInfo -from .a11_y_node import A11YNode as A11YNode -from .app_list_params import AppListParams as AppListParams -from .app_stop_params import AppStopParams as AppStopParams -from .state_ui_params import StateUiParams as StateUiParams -from .app_start_params import AppStartParams as AppStartParams -from .file_list_params import FileListParams as FileListParams -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 .esim_enable_params import EsimEnableParams as EsimEnableParams -from .esim_list_response import EsimListResponse as EsimListResponse -from .esim_remove_params import EsimRemoveParams as EsimRemoveParams -from .file_delete_params import FileDeleteParams as FileDeleteParams -from .file_list_response import FileListResponse as FileListResponse -from .file_upload_params import FileUploadParams as FileUploadParams -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 .language_set_params import LanguageSetParams as LanguageSetParams -from .location_set_params import LocationSetParams as LocationSetParams -from .package_list_params import PackageListParams as PackageListParams -from .state_time_response import StateTimeResponse as StateTimeResponse -from .timezone_set_params import TimezoneSetParams as TimezoneSetParams -from .action_global_params import ActionGlobalParams as ActionGlobalParams -from .esim_activate_params import EsimActivateParams as EsimActivateParams -from .file_download_params import FileDownloadParams as FileDownloadParams -from .proxy_connect_params import ProxyConnectParams as ProxyConnectParams -from .keyboard_write_params import KeyboardWriteParams as KeyboardWriteParams -from .language_get_response import LanguageGetResponse as LanguageGetResponse -from .package_list_response import PackageListResponse as PackageListResponse -from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams -from .proxy_status_response import ProxyStatusResponse as ProxyStatusResponse -from .timezone_get_response import TimezoneGetResponse as TimezoneGetResponse -from .esim_activate_response import EsimActivateResponse as EsimActivateResponse -from .file_download_response import FileDownloadResponse as FileDownloadResponse -from .state_screenshot_params import StateScreenshotParams as StateScreenshotParams -from .state_screenshot_response import StateScreenshotResponse as StateScreenshotResponse -from .action_overlay_visible_response import ActionOverlayVisibleResponse as ActionOverlayVisibleResponse -from .action_set_overlay_visible_params import ActionSetOverlayVisibleParams as ActionSetOverlayVisibleParams diff --git a/src/mobilerun_sdk/types/devices/a11_y_node.py b/src/mobilerun_sdk/types/devices/a11_y_node.py deleted file mode 100644 index aa4eb12..0000000 --- a/src/mobilerun_sdk/types/devices/a11_y_node.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["A11YNode", "BoundsInScreen"] - - -class BoundsInScreen(BaseModel): - bottom: int - - left: int - - right: int - - top: int - - -class A11YNode(BaseModel): - bounds_in_screen: BoundsInScreen = FieldInfo(alias="boundsInScreen") - - children: Optional[List["A11YNode"]] = None - - class_name: str = FieldInfo(alias="className") - - content_description: str = FieldInfo(alias="contentDescription") - - is_checkable: bool = FieldInfo(alias="isCheckable") - - is_checked: bool = FieldInfo(alias="isChecked") - - is_clickable: bool = FieldInfo(alias="isClickable") - - is_enabled: bool = FieldInfo(alias="isEnabled") - - is_focusable: bool = FieldInfo(alias="isFocusable") - - is_focused: bool = FieldInfo(alias="isFocused") - - is_long_clickable: bool = FieldInfo(alias="isLongClickable") - - is_password: bool = FieldInfo(alias="isPassword") - - is_scrollable: bool = FieldInfo(alias="isScrollable") - - is_selected: bool = FieldInfo(alias="isSelected") - - package_name: str = FieldInfo(alias="packageName") - - resource_id: str = FieldInfo(alias="resourceId") - - text: str diff --git a/src/mobilerun_sdk/types/devices/action_global_params.py b/src/mobilerun_sdk/types/devices/action_global_params.py deleted file mode 100644 index a8fca37..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/action_overlay_visible_response.py b/src/mobilerun_sdk/types/devices/action_overlay_visible_response.py deleted file mode 100644 index 1ad6161..0000000 --- a/src/mobilerun_sdk/types/devices/action_overlay_visible_response.py +++ /dev/null @@ -1,16 +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__ = ["ActionOverlayVisibleResponse"] - - -class ActionOverlayVisibleResponse(BaseModel): - visible: bool - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/action_set_overlay_visible_params.py b/src/mobilerun_sdk/types/devices/action_set_overlay_visible_params.py deleted file mode 100644 index ff1d216..0000000 --- a/src/mobilerun_sdk/types/devices/action_set_overlay_visible_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__ = ["ActionSetOverlayVisibleParams"] - - -class ActionSetOverlayVisibleParams(TypedDict, total=False): - visible: Required[bool] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/action_swipe_params.py b/src/mobilerun_sdk/types/devices/action_swipe_params.py deleted file mode 100644 index 180d1db..0000000 --- a/src/mobilerun_sdk/types/devices/action_swipe_params.py +++ /dev/null @@ -1,26 +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")]] - - stealth: bool - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/action_tap_params.py b/src/mobilerun_sdk/types/devices/action_tap_params.py deleted file mode 100644 index 749d2d2..0000000 --- a/src/mobilerun_sdk/types/devices/action_tap_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 Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ActionTapParams"] - - -class ActionTapParams(TypedDict, total=False): - x: Required[int] - - y: Required[int] - - stealth: bool - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/app_install_params.py b/src/mobilerun_sdk/types/devices/app_install_params.py deleted file mode 100644 index 8db67fe..0000000 --- a/src/mobilerun_sdk/types/devices/app_install_params.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["AppInstallParams", "Variant0", "Variant1"] - - -class Variant0(TypedDict, total=False): - bundle_id: Required[Annotated[str, PropertyInfo(alias="bundleId")]] - """iOS bundle identifier (e.g. com.example.app)""" - - package_name: Annotated[str, PropertyInfo(alias="packageName")] - """Android package name (e.g. com.example.app)""" - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] - - -class Variant1(TypedDict, total=False): - package_name: Required[Annotated[str, PropertyInfo(alias="packageName")]] - """Android package name (e.g. com.example.app)""" - - bundle_id: Annotated[str, PropertyInfo(alias="bundleId")] - """iOS bundle identifier (e.g. com.example.app)""" - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] - - -AppInstallParams: TypeAlias = Union[Variant0, Variant1] diff --git a/src/mobilerun_sdk/types/devices/app_list_params.py b/src/mobilerun_sdk/types/devices/app_list_params.py deleted file mode 100644 index 9e6b98c..0000000 --- a/src/mobilerun_sdk/types/devices/app_list_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 Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["AppListParams"] - - -class AppListParams(TypedDict, total=False): - include_protected_apps: Annotated[bool, PropertyInfo(alias="includeProtectedApps")] - - 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_sdk/types/devices/app_list_response.py b/src/mobilerun_sdk/types/devices/app_list_response.py deleted file mode 100644 index c8f8f4e..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/app_start_params.py b/src/mobilerun_sdk/types/devices/app_start_params.py deleted file mode 100644 index f5761f1..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/app_stop_params.py b/src/mobilerun_sdk/types/devices/app_stop_params.py deleted file mode 100644 index 08dcece..0000000 --- a/src/mobilerun_sdk/types/devices/app_stop_params.py +++ /dev/null @@ -1,18 +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__ = ["AppStopParams"] - - -class AppStopParams(TypedDict, total=False): - device_id: Required[Annotated[str, PropertyInfo(alias="deviceId")]] - - clear_data: Annotated[bool, PropertyInfo(alias="clearData")] - """If true, clears all app data (pm clear) in addition to stopping the app.""" - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/esim_activate_params.py b/src/mobilerun_sdk/types/devices/esim_activate_params.py deleted file mode 100644 index e5c9e74..0000000 --- a/src/mobilerun_sdk/types/devices/esim_activate_params.py +++ /dev/null @@ -1,26 +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__ = ["EsimActivateParams"] - - -class EsimActivateParams(TypedDict, total=False): - enable: Required[bool] - - sm_dp_addr: Required[Annotated[str, PropertyInfo(alias="smDpAddr")]] - - confirmation_code: Annotated[str, PropertyInfo(alias="confirmationCode")] - """Optional carrier-issued confirmation code (the 4th LPA segment). - - Required only for plans whose SM-DP+ challenges the device for one. Requires - matchingId — the LPA spec only interprets segment 4 when segment 3 is present. - """ - - matching_id: Annotated[str, PropertyInfo(alias="matchingId")] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/esim_activate_response.py b/src/mobilerun_sdk/types/devices/esim_activate_response.py deleted file mode 100644 index 517c0ba..0000000 --- a/src/mobilerun_sdk/types/devices/esim_activate_response.py +++ /dev/null @@ -1,28 +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__ = ["EsimActivateResponse"] - - -class EsimActivateResponse(BaseModel): - carrier: str - - display_name: str = FieldInfo(alias="displayName") - - iccid: str - - is_embedded: bool = FieldInfo(alias="isEmbedded") - - slot: int - - sub_id: int = FieldInfo(alias="subId") - - type: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/esim_enable_params.py b/src/mobilerun_sdk/types/devices/esim_enable_params.py deleted file mode 100644 index 25e8fdd..0000000 --- a/src/mobilerun_sdk/types/devices/esim_enable_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__ = ["EsimEnableParams"] - - -class EsimEnableParams(TypedDict, total=False): - sub_id: Required[Annotated[int, PropertyInfo(alias="subId")]] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/esim_list_response.py b/src/mobilerun_sdk/types/devices/esim_list_response.py deleted file mode 100644 index 6aa50af..0000000 --- a/src/mobilerun_sdk/types/devices/esim_list_response.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import TypeAlias - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["EsimListResponse", "EsimListResponseItem"] - - -class EsimListResponseItem(BaseModel): - carrier: str - - display_name: str = FieldInfo(alias="displayName") - - iccid: str - - is_embedded: bool = FieldInfo(alias="isEmbedded") - - slot: int - - sub_id: int = FieldInfo(alias="subId") - - type: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" - - -EsimListResponse: TypeAlias = List[EsimListResponseItem] diff --git a/src/mobilerun_sdk/types/devices/esim_remove_params.py b/src/mobilerun_sdk/types/devices/esim_remove_params.py deleted file mode 100644 index e73c1a6..0000000 --- a/src/mobilerun_sdk/types/devices/esim_remove_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__ = ["EsimRemoveParams"] - - -class EsimRemoveParams(TypedDict, total=False): - sub_id: Required[Annotated[int, PropertyInfo(alias="subId")]] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_delete_params.py b/src/mobilerun_sdk/types/devices/file_delete_params.py deleted file mode 100644 index 33a0dc0..0000000 --- a/src/mobilerun_sdk/types/devices/file_delete_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__ = ["FileDeleteParams"] - - -class FileDeleteParams(TypedDict, total=False): - path: Required[str] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_download_params.py b/src/mobilerun_sdk/types/devices/file_download_params.py deleted file mode 100644 index 6919c17..0000000 --- a/src/mobilerun_sdk/types/devices/file_download_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__ = ["FileDownloadParams"] - - -class FileDownloadParams(TypedDict, total=False): - path: Required[str] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_download_response.py b/src/mobilerun_sdk/types/devices/file_download_response.py deleted file mode 100644 index 7dcee00..0000000 --- a/src/mobilerun_sdk/types/devices/file_download_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__ = ["FileDownloadResponse"] - -FileDownloadResponse: TypeAlias = str diff --git a/src/mobilerun_sdk/types/devices/file_info.py b/src/mobilerun_sdk/types/devices/file_info.py deleted file mode 100644 index ed09c7b..0000000 --- a/src/mobilerun_sdk/types/devices/file_info.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel -from ..shared.permission_set import PermissionSet - -__all__ = ["FileInfo", "Permissions", "PermissionsSpecial"] - - -class PermissionsSpecial(BaseModel): - set_gid: bool = FieldInfo(alias="setGid") - - set_uid: bool = FieldInfo(alias="setUid") - - sticky: bool - - -class Permissions(BaseModel): - group: PermissionSet - - others: PermissionSet - - owner: PermissionSet - - special: PermissionsSpecial - - -class FileInfo(BaseModel): - extended_attributes: bool = FieldInfo(alias="extendedAttributes") - - group: str - - hard_links: int = FieldInfo(alias="hardLinks") - - modified_at: datetime = FieldInfo(alias="modifiedAt") - - name: str - - owner: str - - permissions: Permissions - - size: int - - type: str - - symlink_target: Optional[str] = FieldInfo(alias="symlinkTarget", default=None) diff --git a/src/mobilerun_sdk/types/devices/file_list_params.py b/src/mobilerun_sdk/types/devices/file_list_params.py deleted file mode 100644 index 6284a3a..0000000 --- a/src/mobilerun_sdk/types/devices/file_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 Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["FileListParams"] - - -class FileListParams(TypedDict, total=False): - path: Required[str] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_list_response.py b/src/mobilerun_sdk/types/devices/file_list_response.py deleted file mode 100644 index 527b7fa..0000000 --- a/src/mobilerun_sdk/types/devices/file_list_response.py +++ /dev/null @@ -1,21 +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 ..._models import BaseModel -from .file_info import FileInfo - -__all__ = ["FileListResponse"] - - -class FileListResponse(BaseModel): - files: Optional[List[FileInfo]] = None - - path: str - - total: int - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/file_upload_params.py b/src/mobilerun_sdk/types/devices/file_upload_params.py deleted file mode 100644 index e6112d1..0000000 --- a/src/mobilerun_sdk/types/devices/file_upload_params.py +++ /dev/null @@ -1,18 +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 ..._types import FileTypes -from ..._utils import PropertyInfo - -__all__ = ["FileUploadParams"] - - -class FileUploadParams(TypedDict, total=False): - path: Required[str] - - file: Required[FileTypes] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/keyboard_key_params.py b/src/mobilerun_sdk/types/devices/keyboard_key_params.py deleted file mode 100644 index 85854de..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/keyboard_write_params.py b/src/mobilerun_sdk/types/devices/keyboard_write_params.py deleted file mode 100644 index c1340d7..0000000 --- a/src/mobilerun_sdk/types/devices/keyboard_write_params.py +++ /dev/null @@ -1,25 +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): - text: Required[str] - - clear: bool - - error_rate: Annotated[float, PropertyInfo(alias="errorRate")] - """Per-character mistake rate for humantouch typing. -1 uses server default.""" - - stealth: bool - - wpm: int - """Words per minute for stealth typing. 0 uses portal default.""" - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/language_get_response.py b/src/mobilerun_sdk/types/devices/language_get_response.py deleted file mode 100644 index 22c2c78..0000000 --- a/src/mobilerun_sdk/types/devices/language_get_response.py +++ /dev/null @@ -1,16 +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__ = ["LanguageGetResponse"] - - -class LanguageGetResponse(BaseModel): - locale: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/language_set_params.py b/src/mobilerun_sdk/types/devices/language_set_params.py deleted file mode 100644 index 1cfb643..0000000 --- a/src/mobilerun_sdk/types/devices/language_set_params.py +++ /dev/null @@ -1,25 +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__ = ["LanguageSetParams"] - - -class LanguageSetParams(TypedDict, total=False): - locale: Required[str] - """ - BCP-47 locale: a 2–3 letter language tag, optionally followed by a 4-letter - script and/or a 2-letter region (e.g. en-US, de-DE, ja-JP, zh-Hans-CN). - """ - - restart: bool - """Restart zygote so the locale change takes full effect immediately. - - Without it, the locale is written but won't fully apply until the next reboot. - """ - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/location_set_params.py b/src/mobilerun_sdk/types/devices/location_set_params.py deleted file mode 100644 index 6a51626..0000000 --- a/src/mobilerun_sdk/types/devices/location_set_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__ = ["LocationSetParams"] - - -class LocationSetParams(TypedDict, total=False): - latitude: Required[float] - - longitude: Required[float] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/package_list_params.py b/src/mobilerun_sdk/types/devices/package_list_params.py deleted file mode 100644 index 662043e..0000000 --- a/src/mobilerun_sdk/types/devices/package_list_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 Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["PackageListParams"] - - -class PackageListParams(TypedDict, total=False): - include_protected_packages: Annotated[bool, PropertyInfo(alias="includeProtectedPackages")] - - 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_sdk/types/devices/package_list_response.py b/src/mobilerun_sdk/types/devices/package_list_response.py deleted file mode 100644 index 0ab9e4b..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/profile_update_params.py b/src/mobilerun_sdk/types/devices/profile_update_params.py deleted file mode 100644 index 8bab1e8..0000000 --- a/src/mobilerun_sdk/types/devices/profile_update_params.py +++ /dev/null @@ -1,16 +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__ = ["ProfileUpdateParams"] - - -class ProfileUpdateParams(TypedDict, total=False): - profile_id: Required[Annotated[str, PropertyInfo(alias="profileId")]] - """ID of the profile to apply""" - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/proxy_connect_params.py b/src/mobilerun_sdk/types/devices/proxy_connect_params.py deleted file mode 100644 index 5afc504..0000000 --- a/src/mobilerun_sdk/types/devices/proxy_connect_params.py +++ /dev/null @@ -1,41 +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__ = ["ProxyConnectParams", "Socks5"] - - -class ProxyConnectParams(TypedDict, total=False): - host: str - - name: str - """Proxy name""" - - password: str - - port: int - - smart_ip: Annotated[bool, PropertyInfo(alias="smartIp")] - - socks5: Socks5 - """SOCKS5 proxy configuration (required for socks5).""" - - user: str - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] - - -class Socks5(TypedDict, total=False): - """SOCKS5 proxy configuration (required for socks5).""" - - host: Required[str] - - port: Required[int] - - password: str - - user: str diff --git a/src/mobilerun_sdk/types/devices/proxy_status_response.py b/src/mobilerun_sdk/types/devices/proxy_status_response.py deleted file mode 100644 index 668f612..0000000 --- a/src/mobilerun_sdk/types/devices/proxy_status_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__ = ["ProxyStatusResponse"] - - -class ProxyStatusResponse(BaseModel): - connected: bool - - name: Optional[str] = None - """Active proxy name""" - - protocol: Optional[str] = None - """Active proxy protocol (socks5).""" - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/rect.py b/src/mobilerun_sdk/types/devices/rect.py deleted file mode 100644 index 1199a0e..0000000 --- a/src/mobilerun_sdk/types/devices/rect.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["Rect"] - - -class Rect(BaseModel): - height: int - - width: int diff --git a/src/mobilerun_sdk/types/devices/state_screenshot_params.py b/src/mobilerun_sdk/types/devices/state_screenshot_params.py deleted file mode 100644 index fa4d0bd..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/state_screenshot_response.py b/src/mobilerun_sdk/types/devices/state_screenshot_response.py deleted file mode 100644 index aaa4a93..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/state_time_response.py b/src/mobilerun_sdk/types/devices/state_time_response.py deleted file mode 100644 index 6aed1eb..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/state_ui_params.py b/src/mobilerun_sdk/types/devices/state_ui_params.py deleted file mode 100644 index de012d2..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/state_ui_response.py b/src/mobilerun_sdk/types/devices/state_ui_response.py deleted file mode 100644 index 54fa0bc..0000000 --- a/src/mobilerun_sdk/types/devices/state_ui_response.py +++ /dev/null @@ -1,83 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional - -from pydantic import Field as FieldInfo - -from .rect import Rect -from ..._models import BaseModel - -__all__ = [ - "StateUiResponse", - "DeviceContext", - "DeviceContextDisplayMetrics", - "DeviceContextFilteringParams", - "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 DeviceContext(BaseModel): - display_metrics: DeviceContextDisplayMetrics - - filtering_params: DeviceContextFilteringParams - - screen_bounds: Rect - - -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: "A11YNode" - - device_context: DeviceContext - - ime_tree: "A11YNode" - - phone_state: PhoneState - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" - - -from .a11_y_node import A11YNode diff --git a/src/mobilerun_sdk/types/devices/task_list_params.py b/src/mobilerun_sdk/types/devices/task_list_params.py deleted file mode 100644 index 6c98a67..0000000 --- a/src/mobilerun_sdk/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_sdk/types/devices/task_list_response.py b/src/mobilerun_sdk/types/devices/task_list_response.py deleted file mode 100644 index a7243ed..0000000 --- a/src/mobilerun_sdk/types/devices/task_list_response.py +++ /dev/null @@ -1,28 +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 -from ..shared.meta import Meta - -__all__ = ["TaskListResponse", "Item"] - - -class Item(BaseModel): - created_at: datetime = FieldInfo(alias="createdAt") - - task_id: str = FieldInfo(alias="taskId") - - updated_at: datetime = FieldInfo(alias="updatedAt") - - -class TaskListResponse(BaseModel): - items: Optional[List[Item]] = None - - pagination: Meta - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/timezone_get_response.py b/src/mobilerun_sdk/types/devices/timezone_get_response.py deleted file mode 100644 index 2eaa30d..0000000 --- a/src/mobilerun_sdk/types/devices/timezone_get_response.py +++ /dev/null @@ -1,16 +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__ = ["TimezoneGetResponse"] - - -class TimezoneGetResponse(BaseModel): - timezone: Optional[str] = None - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/timezone_set_params.py b/src/mobilerun_sdk/types/devices/timezone_set_params.py deleted file mode 100644 index 87172dc..0000000 --- a/src/mobilerun_sdk/types/devices/timezone_set_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__ = ["TimezoneSetParams"] - - -class TimezoneSetParams(TypedDict, total=False): - timezone: Required[str] - - x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/profile.py b/src/mobilerun_sdk/types/profile.py deleted file mode 100644 index 339eeb2..0000000 --- a/src/mobilerun_sdk/types/profile.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from pydantic import Field as FieldInfo - -from .._models import BaseModel -from .shared.device_spec import DeviceSpec - -__all__ = ["Profile"] - - -class Profile(BaseModel): - id: str - - created_at: datetime = FieldInfo(alias="createdAt") - - name: str - - spec: DeviceSpec - - updated_at: datetime = FieldInfo(alias="updatedAt") - - user_id: str = FieldInfo(alias="userId") - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/profile_create_params.py b/src/mobilerun_sdk/types/profile_create_params.py deleted file mode 100644 index 10e349a..0000000 --- a/src/mobilerun_sdk/types/profile_create_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, TypedDict - -from .shared_params.device_spec import DeviceSpec - -__all__ = ["ProfileCreateParams"] - - -class ProfileCreateParams(TypedDict, total=False): - name: Required[str] - """Profile name""" - - spec: Required[DeviceSpec] - """Device specification""" diff --git a/src/mobilerun_sdk/types/profile_delete_response.py b/src/mobilerun_sdk/types/profile_delete_response.py deleted file mode 100644 index 319a3f4..0000000 --- a/src/mobilerun_sdk/types/profile_delete_response.py +++ /dev/null @@ -1,16 +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__ = ["ProfileDeleteResponse"] - - -class ProfileDeleteResponse(BaseModel): - message: str - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/profile_list_params.py b/src/mobilerun_sdk/types/profile_list_params.py deleted file mode 100644 index db0a7a3..0000000 --- a/src/mobilerun_sdk/types/profile_list_params.py +++ /dev/null @@ -1,21 +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__ = ["ProfileListParams"] - - -class ProfileListParams(TypedDict, total=False): - name: str - - order_by: Annotated[Literal["name", "created_at", "updated_at"], 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_sdk/types/profile_list_response.py b/src/mobilerun_sdk/types/profile_list_response.py deleted file mode 100644 index 279dcbe..0000000 --- a/src/mobilerun_sdk/types/profile_list_response.py +++ /dev/null @@ -1,20 +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 .profile import Profile -from .._models import BaseModel -from .shared.meta import Meta - -__all__ = ["ProfileListResponse"] - - -class ProfileListResponse(BaseModel): - items: Optional[List[Profile]] = None - - pagination: Meta - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/profile_update_params.py b/src/mobilerun_sdk/types/profile_update_params.py deleted file mode 100644 index c332a19..0000000 --- a/src/mobilerun_sdk/types/profile_update_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, TypedDict - -from .shared_params.device_spec import DeviceSpec - -__all__ = ["ProfileUpdateParams"] - - -class ProfileUpdateParams(TypedDict, total=False): - name: Required[str] - """Profile name""" - - spec: Required[DeviceSpec] - """Device specification""" diff --git a/src/mobilerun_sdk/types/proxy_lookup_params.py b/src/mobilerun_sdk/types/proxy_lookup_params.py deleted file mode 100644 index 43b7464..0000000 --- a/src/mobilerun_sdk/types/proxy_lookup_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, TypedDict - -__all__ = ["ProxyLookupParams", "Socks5"] - - -class ProxyLookupParams(TypedDict, total=False): - socks5: Required[Socks5] - """SOCKS5 proxy configuration.""" - - -class Socks5(TypedDict, total=False): - """SOCKS5 proxy configuration.""" - - host: Required[str] - - port: Required[int] - - password: str - - user: str diff --git a/src/mobilerun_sdk/types/proxy_lookup_response.py b/src/mobilerun_sdk/types/proxy_lookup_response.py deleted file mode 100644 index 6e4e88f..0000000 --- a/src/mobilerun_sdk/types/proxy_lookup_response.py +++ /dev/null @@ -1,57 +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__ = ["ProxyLookupResponse", "Carrier"] - - -class Carrier(BaseModel): - """Mobile carrier information.""" - - mcc: Optional[str] = None - """Mobile Country Code.""" - - mnc: Optional[str] = None - """Mobile Network Code.""" - - name: Optional[str] = None - """Carrier name.""" - - -class ProxyLookupResponse(BaseModel): - ip: str - """IP address of the proxy.""" - - is_mobile: bool = FieldInfo(alias="isMobile") - """Whether the IP is a mobile connection.""" - - latitude: float - """Latitude of the proxy.""" - - longitude: float - """Longitude of the proxy.""" - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" - - carrier: Optional[Carrier] = None - """Mobile carrier information.""" - - city: Optional[str] = None - """City of the proxy.""" - - country: Optional[str] = None - """Country of the proxy.""" - - country_code: Optional[str] = FieldInfo(alias="countryCode", default=None) - """ISO country code.""" - - region: Optional[str] = None - """Region of the proxy.""" - - timezone: Optional[str] = None - """Timezone of the proxy.""" diff --git a/src/mobilerun_sdk/types/shared/__init__.py b/src/mobilerun_sdk/types/shared/__init__.py index 7d0f116..90fbaba 100644 --- a/src/mobilerun_sdk/types/shared/__init__.py +++ b/src/mobilerun_sdk/types/shared/__init__.py @@ -1,11 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .meta import Meta as Meta -from .socks5 import Socks5 as Socks5 -from .location import Location as Location from .pagination import Pagination as Pagination -from .device_spec import DeviceSpec as DeviceSpec -from .device_carrier import DeviceCarrier as DeviceCarrier -from .permission_set import PermissionSet as PermissionSet from .pagination_meta import PaginationMeta as PaginationMeta -from .device_identifiers import DeviceIdentifiers as DeviceIdentifiers diff --git a/src/mobilerun_sdk/types/shared/device_carrier.py b/src/mobilerun_sdk/types/shared/device_carrier.py deleted file mode 100644 index 55e9d45..0000000 --- a/src/mobilerun_sdk/types/shared/device_carrier.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["DeviceCarrier"] - - -class DeviceCarrier(BaseModel): - gsm_operator_alpha: str = FieldInfo(alias="GsmOperatorAlpha") - - gsm_operator_numeric: int = FieldInfo(alias="GsmOperatorNumeric") - - gsm_sim_operator_alpha: str = FieldInfo(alias="GsmSimOperatorAlpha") - - gsm_sim_operator_iso_country: str = FieldInfo(alias="GsmSimOperatorIsoCountry") - - gsm_sim_operator_numeric: int = FieldInfo(alias="GsmSimOperatorNumeric") - - persist_sys_timezone: str = FieldInfo(alias="PersistSysTimezone") diff --git a/src/mobilerun_sdk/types/shared/device_identifiers.py b/src/mobilerun_sdk/types/shared/device_identifiers.py deleted file mode 100644 index 90d4bf1..0000000 --- a/src/mobilerun_sdk/types/shared/device_identifiers.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["DeviceIdentifiers"] - - -class DeviceIdentifiers(BaseModel): - bootloader_serial_number: str = FieldInfo(alias="BootloaderSerialNumber") - - identifier_android_id: str = FieldInfo(alias="IdentifierAndroidID") - - identifier_app_set_id: str = FieldInfo(alias="IdentifierAppSetID") - - identifier_bluetooth_mac: str = FieldInfo(alias="IdentifierBluetoothMAC") - - identifier_gaid: str = FieldInfo(alias="IdentifierGAID") - - identifier_gsfid: str = FieldInfo(alias="IdentifierGSFID") - - identifier_iccid: str = FieldInfo(alias="IdentifierICCID") - - identifier_imei: str = FieldInfo(alias="IdentifierIMEI") - - identifier_imsi: str = FieldInfo(alias="IdentifierIMSI") - - identifier_media_drmid: str = FieldInfo(alias="IdentifierMediaDRMID") - - identifier_meid: str = FieldInfo(alias="IdentifierMEID") - - identifier_phone_number: str = FieldInfo(alias="IdentifierPhoneNumber") - - identifier_serial: str = FieldInfo(alias="IdentifierSerial") - - identifier_wifi_mac: str = FieldInfo(alias="IdentifierWifiMAC") - - serial_number: str = FieldInfo(alias="SerialNumber") diff --git a/src/mobilerun_sdk/types/shared/device_spec.py b/src/mobilerun_sdk/types/shared/device_spec.py deleted file mode 100644 index 64614c9..0000000 --- a/src/mobilerun_sdk/types/shared/device_spec.py +++ /dev/null @@ -1,48 +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 .socks5 import Socks5 -from .location import Location -from ..._models import BaseModel -from .device_carrier import DeviceCarrier -from .device_identifiers import DeviceIdentifiers - -__all__ = ["DeviceSpec", "Proxy"] - - -class Proxy(BaseModel): - name: Optional[str] = None - - smart_ip: Optional[bool] = FieldInfo(alias="smartIp", default=None) - - socks5: Optional[Socks5] = None - - -class DeviceSpec(BaseModel): - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" - - android_version: Optional[int] = FieldInfo(alias="androidVersion", default=None) - - apps: Optional[List[str]] = None - - carrier: Optional[DeviceCarrier] = None - - country: Optional[str] = None - - files: Optional[List[str]] = None - - identifiers: Optional[DeviceIdentifiers] = None - - locale: Optional[str] = None - - location: Optional[Location] = None - - name: Optional[str] = None - - proxy: Optional[Proxy] = None - - timezone: Optional[str] = None diff --git a/src/mobilerun_sdk/types/shared/location.py b/src/mobilerun_sdk/types/shared/location.py deleted file mode 100644 index bf0a32a..0000000 --- a/src/mobilerun_sdk/types/shared/location.py +++ /dev/null @@ -1,18 +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__ = ["Location"] - - -class Location(BaseModel): - latitude: float - - longitude: float - - schema_: Optional[str] = FieldInfo(alias="$schema", default=None) - """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/shared/meta.py b/src/mobilerun_sdk/types/shared/meta.py deleted file mode 100644 index cf6beca..0000000 --- a/src/mobilerun_sdk/types/shared/meta.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["Meta"] - - -class Meta(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 diff --git a/src/mobilerun_sdk/types/shared/permission_set.py b/src/mobilerun_sdk/types/shared/permission_set.py deleted file mode 100644 index 79284d2..0000000 --- a/src/mobilerun_sdk/types/shared/permission_set.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["PermissionSet"] - - -class PermissionSet(BaseModel): - execute: bool - - read: bool - - write: bool diff --git a/src/mobilerun_sdk/types/shared/socks5.py b/src/mobilerun_sdk/types/shared/socks5.py deleted file mode 100644 index 36791bd..0000000 --- a/src/mobilerun_sdk/types/shared/socks5.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["Socks5"] - - -class Socks5(BaseModel): - host: str - - password: str - - port: int - - user: str diff --git a/src/mobilerun_sdk/types/shared_params/__init__.py b/src/mobilerun_sdk/types/shared_params/__init__.py deleted file mode 100644 index 0b4dbfb..0000000 --- a/src/mobilerun_sdk/types/shared_params/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .socks5 import Socks5 as Socks5 -from .location import Location as Location -from .device_spec import DeviceSpec as DeviceSpec -from .device_carrier import DeviceCarrier as DeviceCarrier -from .device_identifiers import DeviceIdentifiers as DeviceIdentifiers diff --git a/src/mobilerun_sdk/types/shared_params/device_carrier.py b/src/mobilerun_sdk/types/shared_params/device_carrier.py deleted file mode 100644 index 0b0c162..0000000 --- a/src/mobilerun_sdk/types/shared_params/device_carrier.py +++ /dev/null @@ -1,23 +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__ = ["DeviceCarrier"] - - -class DeviceCarrier(TypedDict, total=False): - gsm_operator_alpha: Required[Annotated[str, PropertyInfo(alias="GsmOperatorAlpha")]] - - gsm_operator_numeric: Required[Annotated[int, PropertyInfo(alias="GsmOperatorNumeric")]] - - gsm_sim_operator_alpha: Required[Annotated[str, PropertyInfo(alias="GsmSimOperatorAlpha")]] - - gsm_sim_operator_iso_country: Required[Annotated[str, PropertyInfo(alias="GsmSimOperatorIsoCountry")]] - - gsm_sim_operator_numeric: Required[Annotated[int, PropertyInfo(alias="GsmSimOperatorNumeric")]] - - persist_sys_timezone: Required[Annotated[str, PropertyInfo(alias="PersistSysTimezone")]] diff --git a/src/mobilerun_sdk/types/shared_params/device_identifiers.py b/src/mobilerun_sdk/types/shared_params/device_identifiers.py deleted file mode 100644 index 528ae53..0000000 --- a/src/mobilerun_sdk/types/shared_params/device_identifiers.py +++ /dev/null @@ -1,41 +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__ = ["DeviceIdentifiers"] - - -class DeviceIdentifiers(TypedDict, total=False): - bootloader_serial_number: Required[Annotated[str, PropertyInfo(alias="BootloaderSerialNumber")]] - - identifier_android_id: Required[Annotated[str, PropertyInfo(alias="IdentifierAndroidID")]] - - identifier_app_set_id: Required[Annotated[str, PropertyInfo(alias="IdentifierAppSetID")]] - - identifier_bluetooth_mac: Required[Annotated[str, PropertyInfo(alias="IdentifierBluetoothMAC")]] - - identifier_gaid: Required[Annotated[str, PropertyInfo(alias="IdentifierGAID")]] - - identifier_gsfid: Required[Annotated[str, PropertyInfo(alias="IdentifierGSFID")]] - - identifier_iccid: Required[Annotated[str, PropertyInfo(alias="IdentifierICCID")]] - - identifier_imei: Required[Annotated[str, PropertyInfo(alias="IdentifierIMEI")]] - - identifier_imsi: Required[Annotated[str, PropertyInfo(alias="IdentifierIMSI")]] - - identifier_media_drmid: Required[Annotated[str, PropertyInfo(alias="IdentifierMediaDRMID")]] - - identifier_meid: Required[Annotated[str, PropertyInfo(alias="IdentifierMEID")]] - - identifier_phone_number: Required[Annotated[str, PropertyInfo(alias="IdentifierPhoneNumber")]] - - identifier_serial: Required[Annotated[str, PropertyInfo(alias="IdentifierSerial")]] - - identifier_wifi_mac: Required[Annotated[str, PropertyInfo(alias="IdentifierWifiMAC")]] - - serial_number: Required[Annotated[str, PropertyInfo(alias="SerialNumber")]] diff --git a/src/mobilerun_sdk/types/shared_params/device_spec.py b/src/mobilerun_sdk/types/shared_params/device_spec.py deleted file mode 100644 index 7d1a43e..0000000 --- a/src/mobilerun_sdk/types/shared_params/device_spec.py +++ /dev/null @@ -1,47 +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 Annotated, TypedDict - -from .socks5 import Socks5 -from ..._types import SequenceNotStr -from ..._utils import PropertyInfo -from .location import Location -from .device_carrier import DeviceCarrier -from .device_identifiers import DeviceIdentifiers - -__all__ = ["DeviceSpec", "Proxy"] - - -class Proxy(TypedDict, total=False): - name: str - - smart_ip: Annotated[bool, PropertyInfo(alias="smartIp")] - - socks5: Socks5 - - -class DeviceSpec(TypedDict, total=False): - android_version: Annotated[int, PropertyInfo(alias="androidVersion")] - - apps: Optional[SequenceNotStr[str]] - - carrier: DeviceCarrier - - country: str - - files: Optional[SequenceNotStr[str]] - - identifiers: DeviceIdentifiers - - locale: str - - location: Location - - name: str - - proxy: Proxy - - timezone: str diff --git a/src/mobilerun_sdk/types/shared_params/location.py b/src/mobilerun_sdk/types/shared_params/location.py deleted file mode 100644 index 49198dc..0000000 --- a/src/mobilerun_sdk/types/shared_params/location.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["Location"] - - -class Location(TypedDict, total=False): - latitude: Required[float] - - longitude: Required[float] diff --git a/src/mobilerun_sdk/types/shared_params/socks5.py b/src/mobilerun_sdk/types/shared_params/socks5.py deleted file mode 100644 index 0e56d16..0000000 --- a/src/mobilerun_sdk/types/shared_params/socks5.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, TypedDict - -__all__ = ["Socks5"] - - -class Socks5(TypedDict, total=False): - host: Required[str] - - password: Required[str] - - port: Required[int] - - user: Required[str] 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 bec389f..0000000 --- a/tests/api_resources/devices/test_actions.py +++ /dev/null @@ -1,630 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.devices import ( - ActionOverlayVisibleResponse, -) - -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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - def test_method_overlay_visible(self, client: Mobilerun) -> None: - action = client.devices.actions.overlay_visible( - device_id="deviceId", - ) - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_overlay_visible_with_all_params(self, client: Mobilerun) -> None: - action = client.devices.actions.overlay_visible( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_overlay_visible(self, client: Mobilerun) -> None: - response = client.devices.actions.with_raw_response.overlay_visible( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = response.parse() - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_overlay_visible(self, client: Mobilerun) -> None: - with client.devices.actions.with_streaming_response.overlay_visible( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = response.parse() - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_overlay_visible(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.overlay_visible( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set_overlay_visible(self, client: Mobilerun) -> None: - action = client.devices.actions.set_overlay_visible( - device_id="deviceId", - visible=True, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set_overlay_visible_with_all_params(self, client: Mobilerun) -> None: - action = client.devices.actions.set_overlay_visible( - device_id="deviceId", - visible=True, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_set_overlay_visible(self, client: Mobilerun) -> None: - response = client.devices.actions.with_raw_response.set_overlay_visible( - device_id="deviceId", - visible=True, - ) - - 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="Mock server tests are disabled") - @parametrize - def test_streaming_response_set_overlay_visible(self, client: Mobilerun) -> None: - with client.devices.actions.with_streaming_response.set_overlay_visible( - device_id="deviceId", - visible=True, - ) 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="Mock server tests are disabled") - @parametrize - def test_path_params_set_overlay_visible(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.set_overlay_visible( - device_id="", - visible=True, - ) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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, - stealth=True, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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, - stealth=True, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - async def test_method_overlay_visible(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.overlay_visible( - device_id="deviceId", - ) - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_overlay_visible_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.overlay_visible( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_overlay_visible(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.actions.with_raw_response.overlay_visible( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - action = await response.parse() - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_overlay_visible(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.actions.with_streaming_response.overlay_visible( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - action = await response.parse() - assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_overlay_visible(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.overlay_visible( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set_overlay_visible(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.set_overlay_visible( - device_id="deviceId", - visible=True, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set_overlay_visible_with_all_params(self, async_client: AsyncMobilerun) -> None: - action = await async_client.devices.actions.set_overlay_visible( - device_id="deviceId", - visible=True, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_set_overlay_visible(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.actions.with_raw_response.set_overlay_visible( - device_id="deviceId", - visible=True, - ) - - 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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_set_overlay_visible(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.actions.with_streaming_response.set_overlay_visible( - device_id="deviceId", - visible=True, - ) 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="Mock server tests are disabled") - @parametrize - async def test_path_params_set_overlay_visible(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.set_overlay_visible( - device_id="", - visible=True, - ) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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, - stealth=True, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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, - stealth=True, - x_device_display_id=0, - ) - assert action is None - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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 1826542..0000000 --- a/tests/api_resources/devices/test_apps.py +++ /dev/null @@ -1,736 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.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="Mock server 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="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - app = client.devices.apps.list( - device_id="deviceId", - include_protected_apps=True, - include_system_apps=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - def test_method_install_overload_1(self, client: Mobilerun) -> None: - app = client.devices.apps.install( - device_id="deviceId", - bundle_id="x", - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_install_with_all_params_overload_1(self, client: Mobilerun) -> None: - app = client.devices.apps.install( - device_id="deviceId", - bundle_id="x", - package_name="x", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_install_overload_1(self, client: Mobilerun) -> None: - response = client.devices.apps.with_raw_response.install( - device_id="deviceId", - bundle_id="x", - ) - - 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="Mock server tests are disabled") - @parametrize - def test_streaming_response_install_overload_1(self, client: Mobilerun) -> None: - with client.devices.apps.with_streaming_response.install( - device_id="deviceId", - bundle_id="x", - ) 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="Mock server tests are disabled") - @parametrize - def test_path_params_install_overload_1(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="", - bundle_id="x", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_install_overload_2(self, client: Mobilerun) -> None: - app = client.devices.apps.install( - device_id="deviceId", - package_name="x", - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_install_with_all_params_overload_2(self, client: Mobilerun) -> None: - app = client.devices.apps.install( - device_id="deviceId", - package_name="x", - bundle_id="x", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_install_overload_2(self, client: Mobilerun) -> None: - response = client.devices.apps.with_raw_response.install( - device_id="deviceId", - package_name="x", - ) - - 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="Mock server tests are disabled") - @parametrize - def test_streaming_response_install_overload_2(self, client: Mobilerun) -> None: - with client.devices.apps.with_streaming_response.install( - device_id="deviceId", - package_name="x", - ) 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="Mock server tests are disabled") - @parametrize - def test_path_params_install_overload_2(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="x", - ) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_stop(self, client: Mobilerun) -> None: - app = client.devices.apps.stop( - package_name="packageName", - device_id="deviceId", - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_stop_with_all_params(self, client: Mobilerun) -> None: - app = client.devices.apps.stop( - package_name="packageName", - device_id="deviceId", - clear_data=True, - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_stop(self, client: Mobilerun) -> None: - response = client.devices.apps.with_raw_response.stop( - 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="Mock server tests are disabled") - @parametrize - def test_streaming_response_stop(self, client: Mobilerun) -> None: - with client.devices.apps.with_streaming_response.stop( - 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="Mock server tests are disabled") - @parametrize - def test_path_params_stop(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.stop( - 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.stop( - 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="Mock server 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="Mock server 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_protected_apps=True, - include_system_apps=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[AppListResponse], app, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - async def test_method_install_overload_1(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.install( - device_id="deviceId", - bundle_id="x", - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_install_with_all_params_overload_1(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.install( - device_id="deviceId", - bundle_id="x", - package_name="x", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_install_overload_1(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.apps.with_raw_response.install( - device_id="deviceId", - bundle_id="x", - ) - - 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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_install_overload_1(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.apps.with_streaming_response.install( - device_id="deviceId", - bundle_id="x", - ) 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="Mock server tests are disabled") - @parametrize - async def test_path_params_install_overload_1(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="", - bundle_id="x", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_install_overload_2(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.install( - device_id="deviceId", - package_name="x", - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_install_with_all_params_overload_2(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.install( - device_id="deviceId", - package_name="x", - bundle_id="x", - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_install_overload_2(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.apps.with_raw_response.install( - device_id="deviceId", - package_name="x", - ) - - 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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_install_overload_2(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.apps.with_streaming_response.install( - device_id="deviceId", - package_name="x", - ) 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="Mock server tests are disabled") - @parametrize - async def test_path_params_install_overload_2(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="x", - ) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_stop(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.stop( - package_name="packageName", - device_id="deviceId", - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_stop_with_all_params(self, async_client: AsyncMobilerun) -> None: - app = await async_client.devices.apps.stop( - package_name="packageName", - device_id="deviceId", - clear_data=True, - x_device_display_id=0, - ) - assert app is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_stop(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.apps.with_raw_response.stop( - 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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_stop(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.apps.with_streaming_response.stop( - 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="Mock server tests are disabled") - @parametrize - async def test_path_params_stop(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.stop( - 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.stop( - package_name="", - device_id="deviceId", - ) diff --git a/tests/api_resources/devices/test_esim.py b/tests/api_resources/devices/test_esim.py deleted file mode 100644 index 3ff9449..0000000 --- a/tests/api_resources/devices/test_esim.py +++ /dev/null @@ -1,479 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.devices import ( - EsimListResponse, - EsimActivateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEsim: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - esim = client.devices.esim.list( - device_id="deviceId", - ) - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - esim = client.devices.esim.list( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.devices.esim.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = response.parse() - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.devices.esim.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = response.parse() - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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.esim.with_raw_response.list( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_activate(self, client: Mobilerun) -> None: - esim = client.devices.esim.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - ) - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_activate_with_all_params(self, client: Mobilerun) -> None: - esim = client.devices.esim.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - confirmation_code="confirmationCode", - matching_id="matchingId", - x_device_display_id=0, - ) - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_activate(self, client: Mobilerun) -> None: - response = client.devices.esim.with_raw_response.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = response.parse() - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_activate(self, client: Mobilerun) -> None: - with client.devices.esim.with_streaming_response.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = response.parse() - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_activate(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.esim.with_raw_response.activate( - device_id="", - enable=True, - sm_dp_addr="smDpAddr", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_enable(self, client: Mobilerun) -> None: - esim = client.devices.esim.enable( - device_id="deviceId", - sub_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_enable_with_all_params(self, client: Mobilerun) -> None: - esim = client.devices.esim.enable( - device_id="deviceId", - sub_id=0, - x_device_display_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_enable(self, client: Mobilerun) -> None: - response = client.devices.esim.with_raw_response.enable( - device_id="deviceId", - sub_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = response.parse() - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_enable(self, client: Mobilerun) -> None: - with client.devices.esim.with_streaming_response.enable( - device_id="deviceId", - sub_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = response.parse() - assert esim is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_enable(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.esim.with_raw_response.enable( - device_id="", - sub_id=0, - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_remove(self, client: Mobilerun) -> None: - esim = client.devices.esim.remove( - device_id="deviceId", - sub_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_remove_with_all_params(self, client: Mobilerun) -> None: - esim = client.devices.esim.remove( - device_id="deviceId", - sub_id=0, - x_device_display_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_remove(self, client: Mobilerun) -> None: - response = client.devices.esim.with_raw_response.remove( - device_id="deviceId", - sub_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = response.parse() - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_remove(self, client: Mobilerun) -> None: - with client.devices.esim.with_streaming_response.remove( - device_id="deviceId", - sub_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = response.parse() - assert esim is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_remove(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.esim.with_raw_response.remove( - device_id="", - sub_id=0, - ) - - -class TestAsyncEsim: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.list( - device_id="deviceId", - ) - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.list( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.esim.with_raw_response.list( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = await response.parse() - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.esim.with_streaming_response.list( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = await response.parse() - assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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.esim.with_raw_response.list( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_activate(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - ) - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_activate_with_all_params(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - confirmation_code="confirmationCode", - matching_id="matchingId", - x_device_display_id=0, - ) - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_activate(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.esim.with_raw_response.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = await response.parse() - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_activate(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.esim.with_streaming_response.activate( - device_id="deviceId", - enable=True, - sm_dp_addr="smDpAddr", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = await response.parse() - assert_matches_type(EsimActivateResponse, esim, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_activate(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.esim.with_raw_response.activate( - device_id="", - enable=True, - sm_dp_addr="smDpAddr", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_enable(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.enable( - device_id="deviceId", - sub_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_enable_with_all_params(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.enable( - device_id="deviceId", - sub_id=0, - x_device_display_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_enable(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.esim.with_raw_response.enable( - device_id="deviceId", - sub_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = await response.parse() - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_enable(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.esim.with_streaming_response.enable( - device_id="deviceId", - sub_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = await response.parse() - assert esim is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_enable(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.esim.with_raw_response.enable( - device_id="", - sub_id=0, - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_remove(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.remove( - device_id="deviceId", - sub_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_remove_with_all_params(self, async_client: AsyncMobilerun) -> None: - esim = await async_client.devices.esim.remove( - device_id="deviceId", - sub_id=0, - x_device_display_id=0, - ) - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_remove(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.esim.with_raw_response.remove( - device_id="deviceId", - sub_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - esim = await response.parse() - assert esim is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_remove(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.esim.with_streaming_response.remove( - device_id="deviceId", - sub_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - esim = await response.parse() - assert esim is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_remove(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.esim.with_raw_response.remove( - device_id="", - sub_id=0, - ) diff --git a/tests/api_resources/devices/test_files.py b/tests/api_resources/devices/test_files.py deleted file mode 100644 index 1b56622..0000000 --- a/tests/api_resources/devices/test_files.py +++ /dev/null @@ -1,484 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.devices import ( - FileListResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFiles: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - file = client.devices.files.list( - device_id="deviceId", - path="path", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - file = client.devices.files.list( - device_id="deviceId", - path="path", - x_device_display_id=0, - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.devices.files.with_raw_response.list( - device_id="deviceId", - path="path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.devices.files.with_streaming_response.list( - device_id="deviceId", - path="path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.list( - device_id="", - path="path", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_delete(self, client: Mobilerun) -> None: - file = client.devices.files.delete( - device_id="deviceId", - path="path", - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_delete_with_all_params(self, client: Mobilerun) -> None: - file = client.devices.files.delete( - device_id="deviceId", - path="path", - x_device_display_id=0, - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_delete(self, client: Mobilerun) -> None: - response = client.devices.files.with_raw_response.delete( - device_id="deviceId", - path="path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_delete(self, client: Mobilerun) -> None: - with client.devices.files.with_streaming_response.delete( - device_id="deviceId", - path="path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert file is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.delete( - device_id="", - path="path", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_download(self, client: Mobilerun) -> None: - file = client.devices.files.download( - device_id="deviceId", - path="path", - ) - assert_matches_type(str, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_download_with_all_params(self, client: Mobilerun) -> None: - file = client.devices.files.download( - device_id="deviceId", - path="path", - x_device_display_id=0, - ) - assert_matches_type(str, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_download(self, client: Mobilerun) -> None: - response = client.devices.files.with_raw_response.download( - device_id="deviceId", - path="path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(str, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_download(self, client: Mobilerun) -> None: - with client.devices.files.with_streaming_response.download( - device_id="deviceId", - path="path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(str, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_download(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.files.with_raw_response.download( - device_id="", - path="path", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_upload(self, client: Mobilerun) -> None: - file = client.devices.files.upload( - device_id="deviceId", - path="path", - file=b"Example data", - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_upload_with_all_params(self, client: Mobilerun) -> None: - file = client.devices.files.upload( - device_id="deviceId", - path="path", - file=b"Example data", - x_device_display_id=0, - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_upload(self, client: Mobilerun) -> None: - response = client.devices.files.with_raw_response.upload( - device_id="deviceId", - path="path", - file=b"Example data", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_upload(self, client: Mobilerun) -> None: - with client.devices.files.with_streaming_response.upload( - device_id="deviceId", - path="path", - file=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert file is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_upload(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.files.with_raw_response.upload( - device_id="", - path="path", - file=b"Example data", - ) - - -class TestAsyncFiles: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.list( - device_id="deviceId", - path="path", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.list( - device_id="deviceId", - path="path", - x_device_display_id=0, - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.files.with_raw_response.list( - device_id="deviceId", - path="path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.files.with_streaming_response.list( - device_id="deviceId", - path="path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.list( - device_id="", - path="path", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_delete(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.delete( - device_id="deviceId", - path="path", - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.delete( - device_id="deviceId", - path="path", - x_device_display_id=0, - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.files.with_raw_response.delete( - device_id="deviceId", - path="path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.files.with_streaming_response.delete( - device_id="deviceId", - path="path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert file is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.delete( - device_id="", - path="path", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_download(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.download( - device_id="deviceId", - path="path", - ) - assert_matches_type(str, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_download_with_all_params(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.download( - device_id="deviceId", - path="path", - x_device_display_id=0, - ) - assert_matches_type(str, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_download(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.files.with_raw_response.download( - device_id="deviceId", - path="path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(str, file, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_download(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.files.with_streaming_response.download( - device_id="deviceId", - path="path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(str, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_download(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.files.with_raw_response.download( - device_id="", - path="path", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_upload(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.upload( - device_id="deviceId", - path="path", - file=b"Example data", - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_upload_with_all_params(self, async_client: AsyncMobilerun) -> None: - file = await async_client.devices.files.upload( - device_id="deviceId", - path="path", - file=b"Example data", - x_device_display_id=0, - ) - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_upload(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.files.with_raw_response.upload( - device_id="deviceId", - path="path", - file=b"Example data", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert file is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_upload(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.files.with_streaming_response.upload( - device_id="deviceId", - path="path", - file=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert file is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_upload(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.files.with_raw_response.upload( - device_id="", - path="path", - file=b"Example data", - ) diff --git a/tests/api_resources/devices/test_keyboard.py b/tests/api_resources/devices/test_keyboard.py deleted file mode 100644 index 766a63b..0000000 --- a/tests/api_resources/devices/test_keyboard.py +++ /dev/null @@ -1,356 +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_sdk 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - def test_method_write(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.write( - device_id="deviceId", - text="text", - ) - assert keyboard is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_write_with_all_params(self, client: Mobilerun) -> None: - keyboard = client.devices.keyboard.write( - device_id="deviceId", - text="text", - clear=True, - error_rate=0, - stealth=True, - wpm=0, - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_write(self, client: Mobilerun) -> None: - response = client.devices.keyboard.with_raw_response.write( - device_id="deviceId", - 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="Mock server tests are disabled") - @parametrize - def test_streaming_response_write(self, client: Mobilerun) -> None: - with client.devices.keyboard.with_streaming_response.write( - device_id="deviceId", - 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="Mock server 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="", - 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - async def test_method_write(self, async_client: AsyncMobilerun) -> None: - keyboard = await async_client.devices.keyboard.write( - device_id="deviceId", - text="text", - ) - assert keyboard is None - - @pytest.mark.skip(reason="Mock server 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", - text="text", - clear=True, - error_rate=0, - stealth=True, - wpm=0, - x_device_display_id=0, - ) - assert keyboard is None - - @pytest.mark.skip(reason="Mock server 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", - 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="Mock server 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", - 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="Mock server 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="", - text="text", - ) diff --git a/tests/api_resources/devices/test_language.py b/tests/api_resources/devices/test_language.py deleted file mode 100644 index c38f4dd..0000000 --- a/tests/api_resources/devices/test_language.py +++ /dev/null @@ -1,240 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.devices import LanguageGetResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestLanguage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get(self, client: Mobilerun) -> None: - language = client.devices.language.get( - device_id="deviceId", - ) - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_with_all_params(self, client: Mobilerun) -> None: - language = client.devices.language.get( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_get(self, client: Mobilerun) -> None: - response = client.devices.language.with_raw_response.get( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - language = response.parse() - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_get(self, client: Mobilerun) -> None: - with client.devices.language.with_streaming_response.get( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - language = response.parse() - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_get(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.language.with_raw_response.get( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set(self, client: Mobilerun) -> None: - language = client.devices.language.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - ) - assert language is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set_with_all_params(self, client: Mobilerun) -> None: - language = client.devices.language.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - restart=True, - x_device_display_id=0, - ) - assert language is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_set(self, client: Mobilerun) -> None: - response = client.devices.language.with_raw_response.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - language = response.parse() - assert language is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_set(self, client: Mobilerun) -> None: - with client.devices.language.with_streaming_response.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - language = response.parse() - assert language is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_set(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.language.with_raw_response.set( - device_id="", - locale="sqf-Kkif-BB", - ) - - -class TestAsyncLanguage: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get(self, async_client: AsyncMobilerun) -> None: - language = await async_client.devices.language.get( - device_id="deviceId", - ) - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncMobilerun) -> None: - language = await async_client.devices.language.get( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_get(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.language.with_raw_response.get( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - language = await response.parse() - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.language.with_streaming_response.get( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - language = await response.parse() - assert_matches_type(LanguageGetResponse, language, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_get(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.language.with_raw_response.get( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set(self, async_client: AsyncMobilerun) -> None: - language = await async_client.devices.language.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - ) - assert language is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set_with_all_params(self, async_client: AsyncMobilerun) -> None: - language = await async_client.devices.language.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - restart=True, - x_device_display_id=0, - ) - assert language is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_set(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.language.with_raw_response.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - language = await response.parse() - assert language is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_set(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.language.with_streaming_response.set( - device_id="deviceId", - locale="sqf-Kkif-BB", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - language = await response.parse() - assert language is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_set(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.language.with_raw_response.set( - device_id="", - locale="sqf-Kkif-BB", - ) diff --git a/tests/api_resources/devices/test_location.py b/tests/api_resources/devices/test_location.py deleted file mode 100644 index 2ec5cb0..0000000 --- a/tests/api_resources/devices/test_location.py +++ /dev/null @@ -1,248 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.shared import Location - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get(self, client: Mobilerun) -> None: - location = client.devices.location.get( - device_id="deviceId", - ) - assert_matches_type(Location, location, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_with_all_params(self, client: Mobilerun) -> None: - location = client.devices.location.get( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(Location, location, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_get(self, client: Mobilerun) -> None: - response = client.devices.location.with_raw_response.get( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = response.parse() - assert_matches_type(Location, location, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_get(self, client: Mobilerun) -> None: - with client.devices.location.with_streaming_response.get( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - location = response.parse() - assert_matches_type(Location, location, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_get(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.location.with_raw_response.get( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set(self, client: Mobilerun) -> None: - location = client.devices.location.set( - device_id="deviceId", - latitude=0, - longitude=0, - ) - assert location is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set_with_all_params(self, client: Mobilerun) -> None: - location = client.devices.location.set( - device_id="deviceId", - latitude=0, - longitude=0, - x_device_display_id=0, - ) - assert location is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_set(self, client: Mobilerun) -> None: - response = client.devices.location.with_raw_response.set( - device_id="deviceId", - latitude=0, - longitude=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = response.parse() - assert location is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_set(self, client: Mobilerun) -> None: - with client.devices.location.with_streaming_response.set( - device_id="deviceId", - latitude=0, - longitude=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - location = response.parse() - assert location is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_set(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.location.with_raw_response.set( - device_id="", - latitude=0, - longitude=0, - ) - - -class TestAsyncLocation: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get(self, async_client: AsyncMobilerun) -> None: - location = await async_client.devices.location.get( - device_id="deviceId", - ) - assert_matches_type(Location, location, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncMobilerun) -> None: - location = await async_client.devices.location.get( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(Location, location, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_get(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.location.with_raw_response.get( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = await response.parse() - assert_matches_type(Location, location, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.location.with_streaming_response.get( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - location = await response.parse() - assert_matches_type(Location, location, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_get(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.location.with_raw_response.get( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set(self, async_client: AsyncMobilerun) -> None: - location = await async_client.devices.location.set( - device_id="deviceId", - latitude=0, - longitude=0, - ) - assert location is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set_with_all_params(self, async_client: AsyncMobilerun) -> None: - location = await async_client.devices.location.set( - device_id="deviceId", - latitude=0, - longitude=0, - x_device_display_id=0, - ) - assert location is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_set(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.location.with_raw_response.set( - device_id="deviceId", - latitude=0, - longitude=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = await response.parse() - assert location is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_set(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.location.with_streaming_response.set( - device_id="deviceId", - latitude=0, - longitude=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - location = await response.parse() - assert location is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_set(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.location.with_raw_response.set( - device_id="", - latitude=0, - longitude=0, - ) diff --git a/tests/api_resources/devices/test_packages.py b/tests/api_resources/devices/test_packages.py deleted file mode 100644 index dbfc3cb..0000000 --- a/tests/api_resources/devices/test_packages.py +++ /dev/null @@ -1,130 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.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="Mock server 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="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - package = client.devices.packages.list( - device_id="deviceId", - include_protected_packages=True, - include_system_packages=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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_protected_packages=True, - include_system_packages=True, - x_device_display_id=0, - ) - assert_matches_type(Optional[PackageListResponse], package, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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_profile.py b/tests/api_resources/devices/test_profile.py deleted file mode 100644 index 3bec114..0000000 --- a/tests/api_resources/devices/test_profile.py +++ /dev/null @@ -1,134 +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_sdk import Mobilerun, AsyncMobilerun - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProfile: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update(self, client: Mobilerun) -> None: - profile = client.devices.profile.update( - device_id="deviceId", - profile_id="profileId", - ) - assert profile is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update_with_all_params(self, client: Mobilerun) -> None: - profile = client.devices.profile.update( - device_id="deviceId", - profile_id="profileId", - x_device_display_id=0, - ) - assert profile is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_update(self, client: Mobilerun) -> None: - response = client.devices.profile.with_raw_response.update( - device_id="deviceId", - profile_id="profileId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert profile is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_update(self, client: Mobilerun) -> None: - with client.devices.profile.with_streaming_response.update( - device_id="deviceId", - profile_id="profileId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert profile is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_update(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.profile.with_raw_response.update( - device_id="", - profile_id="profileId", - ) - - -class TestAsyncProfile: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.devices.profile.update( - device_id="deviceId", - profile_id="profileId", - ) - assert profile is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.devices.profile.update( - device_id="deviceId", - profile_id="profileId", - x_device_display_id=0, - ) - assert profile is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.profile.with_raw_response.update( - device_id="deviceId", - profile_id="profileId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert profile is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.profile.with_streaming_response.update( - device_id="deviceId", - profile_id="profileId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert profile is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_update(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.profile.with_raw_response.update( - device_id="", - profile_id="profileId", - ) diff --git a/tests/api_resources/devices/test_proxy.py b/tests/api_resources/devices/test_proxy.py deleted file mode 100644 index 914b3e3..0000000 --- a/tests/api_resources/devices/test_proxy.py +++ /dev/null @@ -1,354 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.devices import ProxyStatusResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProxy: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_connect(self, client: Mobilerun) -> None: - proxy = client.devices.proxy.connect( - device_id="deviceId", - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_connect_with_all_params(self, client: Mobilerun) -> None: - proxy = client.devices.proxy.connect( - device_id="deviceId", - host="host", - name="name", - password="password", - port=1, - smart_ip=True, - socks5={ - "host": "host", - "port": 1, - "password": "password", - "user": "user", - }, - user="user", - x_device_display_id=0, - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_connect(self, client: Mobilerun) -> None: - response = client.devices.proxy.with_raw_response.connect( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = response.parse() - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_connect(self, client: Mobilerun) -> None: - with client.devices.proxy.with_streaming_response.connect( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = response.parse() - assert proxy is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_connect(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.proxy.with_raw_response.connect( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_disconnect(self, client: Mobilerun) -> None: - proxy = client.devices.proxy.disconnect( - device_id="deviceId", - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_disconnect_with_all_params(self, client: Mobilerun) -> None: - proxy = client.devices.proxy.disconnect( - device_id="deviceId", - x_device_display_id=0, - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_disconnect(self, client: Mobilerun) -> None: - response = client.devices.proxy.with_raw_response.disconnect( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = response.parse() - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_disconnect(self, client: Mobilerun) -> None: - with client.devices.proxy.with_streaming_response.disconnect( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = response.parse() - assert proxy is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_disconnect(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.proxy.with_raw_response.disconnect( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_status(self, client: Mobilerun) -> None: - proxy = client.devices.proxy.status( - device_id="deviceId", - ) - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_status_with_all_params(self, client: Mobilerun) -> None: - proxy = client.devices.proxy.status( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_status(self, client: Mobilerun) -> None: - response = client.devices.proxy.with_raw_response.status( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = response.parse() - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_status(self, client: Mobilerun) -> None: - with client.devices.proxy.with_streaming_response.status( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = response.parse() - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_status(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.proxy.with_raw_response.status( - device_id="", - ) - - -class TestAsyncProxy: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_connect(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.devices.proxy.connect( - device_id="deviceId", - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_connect_with_all_params(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.devices.proxy.connect( - device_id="deviceId", - host="host", - name="name", - password="password", - port=1, - smart_ip=True, - socks5={ - "host": "host", - "port": 1, - "password": "password", - "user": "user", - }, - user="user", - x_device_display_id=0, - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_connect(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.proxy.with_raw_response.connect( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = await response.parse() - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_connect(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.proxy.with_streaming_response.connect( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = await response.parse() - assert proxy is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_connect(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.proxy.with_raw_response.connect( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_disconnect(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.devices.proxy.disconnect( - device_id="deviceId", - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_disconnect_with_all_params(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.devices.proxy.disconnect( - device_id="deviceId", - x_device_display_id=0, - ) - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_disconnect(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.proxy.with_raw_response.disconnect( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = await response.parse() - assert proxy is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_disconnect(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.proxy.with_streaming_response.disconnect( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = await response.parse() - assert proxy is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_disconnect(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.proxy.with_raw_response.disconnect( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_status(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.devices.proxy.status( - device_id="deviceId", - ) - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_status_with_all_params(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.devices.proxy.status( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_status(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.proxy.with_raw_response.status( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = await response.parse() - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_status(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.proxy.with_streaming_response.status( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = await response.parse() - assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_status(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.proxy.with_raw_response.status( - 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 64d94ec..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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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 aa53bcf..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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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/devices/test_timezone.py b/tests/api_resources/devices/test_timezone.py deleted file mode 100644 index 6902ac4..0000000 --- a/tests/api_resources/devices/test_timezone.py +++ /dev/null @@ -1,238 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types.devices import TimezoneGetResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTimezone: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get(self, client: Mobilerun) -> None: - timezone = client.devices.timezone.get( - device_id="deviceId", - ) - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_with_all_params(self, client: Mobilerun) -> None: - timezone = client.devices.timezone.get( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_get(self, client: Mobilerun) -> None: - response = client.devices.timezone.with_raw_response.get( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - timezone = response.parse() - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_get(self, client: Mobilerun) -> None: - with client.devices.timezone.with_streaming_response.get( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - timezone = response.parse() - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_get(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.timezone.with_raw_response.get( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set(self, client: Mobilerun) -> None: - timezone = client.devices.timezone.set( - device_id="deviceId", - timezone="timezone", - ) - assert timezone is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set_with_all_params(self, client: Mobilerun) -> None: - timezone = client.devices.timezone.set( - device_id="deviceId", - timezone="timezone", - x_device_display_id=0, - ) - assert timezone is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_set(self, client: Mobilerun) -> None: - response = client.devices.timezone.with_raw_response.set( - device_id="deviceId", - timezone="timezone", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - timezone = response.parse() - assert timezone is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_set(self, client: Mobilerun) -> None: - with client.devices.timezone.with_streaming_response.set( - device_id="deviceId", - timezone="timezone", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - timezone = response.parse() - assert timezone is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_set(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): - client.devices.timezone.with_raw_response.set( - device_id="", - timezone="timezone", - ) - - -class TestAsyncTimezone: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get(self, async_client: AsyncMobilerun) -> None: - timezone = await async_client.devices.timezone.get( - device_id="deviceId", - ) - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncMobilerun) -> None: - timezone = await async_client.devices.timezone.get( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_get(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.timezone.with_raw_response.get( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - timezone = await response.parse() - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_get(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.timezone.with_streaming_response.get( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - timezone = await response.parse() - assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_get(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.timezone.with_raw_response.get( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set(self, async_client: AsyncMobilerun) -> None: - timezone = await async_client.devices.timezone.set( - device_id="deviceId", - timezone="timezone", - ) - assert timezone is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set_with_all_params(self, async_client: AsyncMobilerun) -> None: - timezone = await async_client.devices.timezone.set( - device_id="deviceId", - timezone="timezone", - x_device_display_id=0, - ) - assert timezone is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_set(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.timezone.with_raw_response.set( - device_id="deviceId", - timezone="timezone", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - timezone = await response.parse() - assert timezone is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_set(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.timezone.with_streaming_response.set( - device_id="deviceId", - timezone="timezone", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - timezone = await response.parse() - assert timezone is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_set(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.timezone.with_raw_response.set( - device_id="", - timezone="timezone", - ) diff --git a/tests/api_resources/test_carriers.py b/tests/api_resources/test_carriers.py deleted file mode 100644 index 537784a..0000000 --- a/tests/api_resources/test_carriers.py +++ /dev/null @@ -1,567 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types import ( - CarrierListResponse, - CarrierCreateResponse, - CarrierDeleteResponse, - CarrierLookupResponse, - CarrierUpdateResponse, - CarrierRetrieveResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCarriers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create(self, client: Mobilerun) -> None: - carrier = client.carriers.create( - country="x", - mcc="x", - mnc="x", - operator="x", - ) - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create_with_all_params(self, client: Mobilerun) -> None: - carrier = client.carriers.create( - country="x", - mcc="x", - mnc="x", - operator="x", - company="company", - country_code="country_code", - country_iso="xx", - detail_url="detail_url", - gsm_bands="gsm_bands", - lte_bands="lte_bands", - mobile_prefix="mobile_prefix", - nsn_size="nsn_size", - number_format="number_format", - protocols="protocols", - umts_bands="umts_bands", - website="website", - ) - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_create(self, client: Mobilerun) -> None: - response = client.carriers.with_raw_response.create( - country="x", - mcc="x", - mnc="x", - operator="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = response.parse() - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_create(self, client: Mobilerun) -> None: - with client.carriers.with_streaming_response.create( - country="x", - mcc="x", - mnc="x", - operator="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = response.parse() - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - carrier = client.carriers.retrieve( - 1, - ) - assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.carriers.with_raw_response.retrieve( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = response.parse() - assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.carriers.with_streaming_response.retrieve( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = response.parse() - assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update(self, client: Mobilerun) -> None: - carrier = client.carriers.update( - carrier_id=1, - ) - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update_with_all_params(self, client: Mobilerun) -> None: - carrier = client.carriers.update( - carrier_id=1, - company="company", - country="country", - country_code="country_code", - country_iso="xx", - detail_url="detail_url", - gsm_bands="gsm_bands", - lte_bands="lte_bands", - mobile_prefix="mobile_prefix", - nsn_size="nsn_size", - number_format="number_format", - operator="operator", - protocols="protocols", - umts_bands="umts_bands", - website="website", - ) - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_update(self, client: Mobilerun) -> None: - response = client.carriers.with_raw_response.update( - carrier_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = response.parse() - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_update(self, client: Mobilerun) -> None: - with client.carriers.with_streaming_response.update( - carrier_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = response.parse() - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - carrier = client.carriers.list() - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - carrier = client.carriers.list( - country="country", - country_iso="xx", - order_by="id", - order_dir="asc", - page=1, - page_size=1, - ) - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.carriers.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = response.parse() - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.carriers.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = response.parse() - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_delete(self, client: Mobilerun) -> None: - carrier = client.carriers.delete( - 1, - ) - assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_delete(self, client: Mobilerun) -> None: - response = client.carriers.with_raw_response.delete( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = response.parse() - assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_delete(self, client: Mobilerun) -> None: - with client.carriers.with_streaming_response.delete( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = response.parse() - assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_lookup(self, client: Mobilerun) -> None: - carrier = client.carriers.lookup( - mcc="x", - mnc="x", - ) - assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_lookup(self, client: Mobilerun) -> None: - response = client.carriers.with_raw_response.lookup( - mcc="x", - mnc="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = response.parse() - assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_lookup(self, client: Mobilerun) -> None: - with client.carriers.with_streaming_response.lookup( - mcc="x", - mnc="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = response.parse() - assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncCarriers: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.create( - country="x", - mcc="x", - mnc="x", - operator="x", - ) - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.create( - country="x", - mcc="x", - mnc="x", - operator="x", - company="company", - country_code="country_code", - country_iso="xx", - detail_url="detail_url", - gsm_bands="gsm_bands", - lte_bands="lte_bands", - mobile_prefix="mobile_prefix", - nsn_size="nsn_size", - number_format="number_format", - protocols="protocols", - umts_bands="umts_bands", - website="website", - ) - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: - response = await async_client.carriers.with_raw_response.create( - country="x", - mcc="x", - mnc="x", - operator="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = await response.parse() - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: - async with async_client.carriers.with_streaming_response.create( - country="x", - mcc="x", - mnc="x", - operator="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = await response.parse() - assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.retrieve( - 1, - ) - assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.carriers.with_raw_response.retrieve( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = await response.parse() - assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.carriers.with_streaming_response.retrieve( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = await response.parse() - assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.update( - carrier_id=1, - ) - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.update( - carrier_id=1, - company="company", - country="country", - country_code="country_code", - country_iso="xx", - detail_url="detail_url", - gsm_bands="gsm_bands", - lte_bands="lte_bands", - mobile_prefix="mobile_prefix", - nsn_size="nsn_size", - number_format="number_format", - operator="operator", - protocols="protocols", - umts_bands="umts_bands", - website="website", - ) - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: - response = await async_client.carriers.with_raw_response.update( - carrier_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = await response.parse() - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: - async with async_client.carriers.with_streaming_response.update( - carrier_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = await response.parse() - assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.list() - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.list( - country="country", - country_iso="xx", - order_by="id", - order_dir="asc", - page=1, - page_size=1, - ) - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.carriers.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = await response.parse() - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.carriers.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = await response.parse() - assert_matches_type(CarrierListResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_delete(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.delete( - 1, - ) - assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: - response = await async_client.carriers.with_raw_response.delete( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = await response.parse() - assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: - async with async_client.carriers.with_streaming_response.delete( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = await response.parse() - assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_lookup(self, async_client: AsyncMobilerun) -> None: - carrier = await async_client.carriers.lookup( - mcc="x", - mnc="x", - ) - assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_lookup(self, async_client: AsyncMobilerun) -> None: - response = await async_client.carriers.with_raw_response.lookup( - mcc="x", - mnc="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - carrier = await response.parse() - assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_lookup(self, async_client: AsyncMobilerun) -> None: - async with async_client.carriers.with_streaming_response.lookup( - mcc="x", - mnc="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - carrier = await response.parse() - assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_devices.py b/tests/api_resources/test_devices.py deleted file mode 100644 index c70afb3..0000000 --- a/tests/api_resources/test_devices.py +++ /dev/null @@ -1,976 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types import ( - Device, - DeviceListResponse, - DeviceCountResponse, - DeviceFingerprintResponse, -) -from mobilerun_sdk._utils import parse_datetime - -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="Mock server 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="Mock server tests are disabled") - @parametrize - def test_method_create_with_all_params(self, client: Mobilerun) -> None: - device = client.devices.create( - query_country="country", - device_type="dedicated_physical_device", - profile_id="profileId", - android_version=0, - apps=["string"], - carrier={ - "gsm_operator_alpha": "GsmOperatorAlpha", - "gsm_operator_numeric": 0, - "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", - "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", - "gsm_sim_operator_numeric": 0, - "persist_sys_timezone": "PersistSysTimezone", - }, - body_country="country", - files=["string"], - identifiers={ - "bootloader_serial_number": "BootloaderSerialNumber", - "identifier_android_id": "IdentifierAndroidID", - "identifier_app_set_id": "IdentifierAppSetID", - "identifier_bluetooth_mac": "IdentifierBluetoothMAC", - "identifier_gaid": "IdentifierGAID", - "identifier_gsfid": "IdentifierGSFID", - "identifier_iccid": "IdentifierICCID", - "identifier_imei": "IdentifierIMEI", - "identifier_imsi": "IdentifierIMSI", - "identifier_media_drmid": "IdentifierMediaDRMID", - "identifier_meid": "IdentifierMEID", - "identifier_phone_number": "IdentifierPhoneNumber", - "identifier_serial": "IdentifierSerial", - "identifier_wifi_mac": "IdentifierWifiMAC", - "serial_number": "SerialNumber", - }, - locale="locale", - location={ - "latitude": 0, - "longitude": 0, - }, - name="name", - proxy={ - "name": "name", - "smart_ip": True, - "socks5": { - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - }, - timezone="timezone", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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_id="providerId", - state=["creating"], - type="dedicated_physical_device", - ) - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - def test_method_fingerprint(self, client: Mobilerun) -> None: - device = client.devices.fingerprint( - device_id="deviceId", - ) - assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_fingerprint_with_all_params(self, client: Mobilerun) -> None: - device = client.devices.fingerprint( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_fingerprint(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.fingerprint( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = response.parse() - assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_fingerprint(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.fingerprint( - device_id="deviceId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - device = response.parse() - assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_fingerprint(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.fingerprint( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_reboot(self, client: Mobilerun) -> None: - device = client.devices.reboot( - "deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_reboot(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.reboot( - "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="Mock server tests are disabled") - @parametrize - def test_streaming_response_reboot(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.reboot( - "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="Mock server tests are disabled") - @parametrize - def test_path_params_reboot(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.reboot( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_reset(self, client: Mobilerun) -> None: - device = client.devices.reset( - "deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_reset(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.reset( - "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="Mock server tests are disabled") - @parametrize - def test_streaming_response_reset(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.reset( - "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="Mock server tests are disabled") - @parametrize - def test_path_params_reset(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.reset( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_set_name(self, client: Mobilerun) -> None: - device = client.devices.set_name( - device_id="deviceId", - name="x", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_set_name(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.set_name( - device_id="deviceId", - name="x", - ) - - 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="Mock server tests are disabled") - @parametrize - def test_streaming_response_set_name(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.set_name( - device_id="deviceId", - name="x", - ) 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="Mock server tests are disabled") - @parametrize - def test_path_params_set_name(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.set_name( - device_id="", - name="x", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_terminate(self, client: Mobilerun) -> None: - device = client.devices.terminate( - device_id="deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_terminate_with_all_params(self, client: Mobilerun) -> None: - device = client.devices.terminate( - device_id="deviceId", - previous_device_id="previousDeviceId", - terminate_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_terminate(self, client: Mobilerun) -> None: - response = client.devices.with_raw_response.terminate( - device_id="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="Mock server tests are disabled") - @parametrize - def test_streaming_response_terminate(self, client: Mobilerun) -> None: - with client.devices.with_streaming_response.terminate( - device_id="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="Mock server 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( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.create( - query_country="country", - device_type="dedicated_physical_device", - profile_id="profileId", - android_version=0, - apps=["string"], - carrier={ - "gsm_operator_alpha": "GsmOperatorAlpha", - "gsm_operator_numeric": 0, - "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", - "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", - "gsm_sim_operator_numeric": 0, - "persist_sys_timezone": "PersistSysTimezone", - }, - body_country="country", - files=["string"], - identifiers={ - "bootloader_serial_number": "BootloaderSerialNumber", - "identifier_android_id": "IdentifierAndroidID", - "identifier_app_set_id": "IdentifierAppSetID", - "identifier_bluetooth_mac": "IdentifierBluetoothMAC", - "identifier_gaid": "IdentifierGAID", - "identifier_gsfid": "IdentifierGSFID", - "identifier_iccid": "IdentifierICCID", - "identifier_imei": "IdentifierIMEI", - "identifier_imsi": "IdentifierIMSI", - "identifier_media_drmid": "IdentifierMediaDRMID", - "identifier_meid": "IdentifierMEID", - "identifier_phone_number": "IdentifierPhoneNumber", - "identifier_serial": "IdentifierSerial", - "identifier_wifi_mac": "IdentifierWifiMAC", - "serial_number": "SerialNumber", - }, - locale="locale", - location={ - "latitude": 0, - "longitude": 0, - }, - name="name", - proxy={ - "name": "name", - "smart_ip": True, - "socks5": { - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - }, - timezone="timezone", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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_id="providerId", - state=["creating"], - type="dedicated_physical_device", - ) - assert_matches_type(DeviceListResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") - @parametrize - async def test_method_fingerprint(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.fingerprint( - device_id="deviceId", - ) - assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_fingerprint_with_all_params(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.fingerprint( - device_id="deviceId", - x_device_display_id=0, - ) - assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_fingerprint(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.fingerprint( - device_id="deviceId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - device = await response.parse() - assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_fingerprint(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.fingerprint( - device_id="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(DeviceFingerprintResponse, device, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_fingerprint(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.fingerprint( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_reboot(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.reboot( - "deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_reboot(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.reboot( - "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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_reboot(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.reboot( - "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="Mock server tests are disabled") - @parametrize - async def test_path_params_reboot(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.reboot( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_reset(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.reset( - "deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_reset(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.reset( - "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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_reset(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.reset( - "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="Mock server tests are disabled") - @parametrize - async def test_path_params_reset(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.reset( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_set_name(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.set_name( - device_id="deviceId", - name="x", - ) - assert_matches_type(Device, device, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_set_name(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.set_name( - device_id="deviceId", - name="x", - ) - - 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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_set_name(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.set_name( - device_id="deviceId", - name="x", - ) 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="Mock server tests are disabled") - @parametrize - async def test_path_params_set_name(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.set_name( - device_id="", - name="x", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_terminate(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.terminate( - device_id="deviceId", - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_terminate_with_all_params(self, async_client: AsyncMobilerun) -> None: - device = await async_client.devices.terminate( - device_id="deviceId", - previous_device_id="previousDeviceId", - terminate_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert device is None - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_terminate(self, async_client: AsyncMobilerun) -> None: - response = await async_client.devices.with_raw_response.terminate( - device_id="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="Mock server tests are disabled") - @parametrize - async def test_streaming_response_terminate(self, async_client: AsyncMobilerun) -> None: - async with async_client.devices.with_streaming_response.terminate( - device_id="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="Mock server 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( - device_id="", - ) - - @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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( - "", - ) diff --git a/tests/api_resources/test_profiles.py b/tests/api_resources/test_profiles.py deleted file mode 100644 index 404e8d8..0000000 --- a/tests/api_resources/test_profiles.py +++ /dev/null @@ -1,676 +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 tests.utils import assert_matches_type -from mobilerun_sdk import Mobilerun, AsyncMobilerun -from mobilerun_sdk.types import ( - Profile, - ProfileListResponse, - ProfileDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProfiles: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create(self, client: Mobilerun) -> None: - profile = client.profiles.create( - name="x", - spec={}, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create_with_all_params(self, client: Mobilerun) -> None: - profile = client.profiles.create( - name="x", - spec={ - "android_version": 0, - "apps": ["string"], - "carrier": { - "gsm_operator_alpha": "GsmOperatorAlpha", - "gsm_operator_numeric": 0, - "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", - "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", - "gsm_sim_operator_numeric": 0, - "persist_sys_timezone": "PersistSysTimezone", - }, - "country": "country", - "files": ["string"], - "identifiers": { - "bootloader_serial_number": "BootloaderSerialNumber", - "identifier_android_id": "IdentifierAndroidID", - "identifier_app_set_id": "IdentifierAppSetID", - "identifier_bluetooth_mac": "IdentifierBluetoothMAC", - "identifier_gaid": "IdentifierGAID", - "identifier_gsfid": "IdentifierGSFID", - "identifier_iccid": "IdentifierICCID", - "identifier_imei": "IdentifierIMEI", - "identifier_imsi": "IdentifierIMSI", - "identifier_media_drmid": "IdentifierMediaDRMID", - "identifier_meid": "IdentifierMEID", - "identifier_phone_number": "IdentifierPhoneNumber", - "identifier_serial": "IdentifierSerial", - "identifier_wifi_mac": "IdentifierWifiMAC", - "serial_number": "SerialNumber", - }, - "locale": "locale", - "location": { - "latitude": 0, - "longitude": 0, - }, - "name": "name", - "proxy": { - "name": "name", - "smart_ip": True, - "socks5": { - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - }, - "timezone": "timezone", - }, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_create(self, client: Mobilerun) -> None: - response = client.profiles.with_raw_response.create( - name="x", - spec={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_create(self, client: Mobilerun) -> None: - with client.profiles.with_streaming_response.create( - name="x", - spec={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: Mobilerun) -> None: - profile = client.profiles.retrieve( - "profileId", - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: Mobilerun) -> None: - response = client.profiles.with_raw_response.retrieve( - "profileId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: Mobilerun) -> None: - with client.profiles.with_streaming_response.retrieve( - "profileId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): - client.profiles.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update(self, client: Mobilerun) -> None: - profile = client.profiles.update( - profile_id="profileId", - name="x", - spec={}, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_update_with_all_params(self, client: Mobilerun) -> None: - profile = client.profiles.update( - profile_id="profileId", - name="x", - spec={ - "android_version": 0, - "apps": ["string"], - "carrier": { - "gsm_operator_alpha": "GsmOperatorAlpha", - "gsm_operator_numeric": 0, - "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", - "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", - "gsm_sim_operator_numeric": 0, - "persist_sys_timezone": "PersistSysTimezone", - }, - "country": "country", - "files": ["string"], - "identifiers": { - "bootloader_serial_number": "BootloaderSerialNumber", - "identifier_android_id": "IdentifierAndroidID", - "identifier_app_set_id": "IdentifierAppSetID", - "identifier_bluetooth_mac": "IdentifierBluetoothMAC", - "identifier_gaid": "IdentifierGAID", - "identifier_gsfid": "IdentifierGSFID", - "identifier_iccid": "IdentifierICCID", - "identifier_imei": "IdentifierIMEI", - "identifier_imsi": "IdentifierIMSI", - "identifier_media_drmid": "IdentifierMediaDRMID", - "identifier_meid": "IdentifierMEID", - "identifier_phone_number": "IdentifierPhoneNumber", - "identifier_serial": "IdentifierSerial", - "identifier_wifi_mac": "IdentifierWifiMAC", - "serial_number": "SerialNumber", - }, - "locale": "locale", - "location": { - "latitude": 0, - "longitude": 0, - }, - "name": "name", - "proxy": { - "name": "name", - "smart_ip": True, - "socks5": { - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - }, - "timezone": "timezone", - }, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_update(self, client: Mobilerun) -> None: - response = client.profiles.with_raw_response.update( - profile_id="profileId", - name="x", - spec={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_update(self, client: Mobilerun) -> None: - with client.profiles.with_streaming_response.update( - profile_id="profileId", - name="x", - spec={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_update(self, client: Mobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): - client.profiles.with_raw_response.update( - profile_id="", - name="x", - spec={}, - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: Mobilerun) -> None: - profile = client.profiles.list() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: Mobilerun) -> None: - profile = client.profiles.list( - name="name", - order_by="name", - order_by_direction="asc", - page=0, - page_size=0, - ) - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: Mobilerun) -> None: - response = client.profiles.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: Mobilerun) -> None: - with client.profiles.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_delete(self, client: Mobilerun) -> None: - profile = client.profiles.delete( - "profileId", - ) - assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_delete(self, client: Mobilerun) -> None: - response = client.profiles.with_raw_response.delete( - "profileId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_delete(self, client: Mobilerun) -> None: - with client.profiles.with_streaming_response.delete( - "profileId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): - client.profiles.with_raw_response.delete( - "", - ) - - -class TestAsyncProfiles: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.create( - name="x", - spec={}, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.create( - name="x", - spec={ - "android_version": 0, - "apps": ["string"], - "carrier": { - "gsm_operator_alpha": "GsmOperatorAlpha", - "gsm_operator_numeric": 0, - "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", - "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", - "gsm_sim_operator_numeric": 0, - "persist_sys_timezone": "PersistSysTimezone", - }, - "country": "country", - "files": ["string"], - "identifiers": { - "bootloader_serial_number": "BootloaderSerialNumber", - "identifier_android_id": "IdentifierAndroidID", - "identifier_app_set_id": "IdentifierAppSetID", - "identifier_bluetooth_mac": "IdentifierBluetoothMAC", - "identifier_gaid": "IdentifierGAID", - "identifier_gsfid": "IdentifierGSFID", - "identifier_iccid": "IdentifierICCID", - "identifier_imei": "IdentifierIMEI", - "identifier_imsi": "IdentifierIMSI", - "identifier_media_drmid": "IdentifierMediaDRMID", - "identifier_meid": "IdentifierMEID", - "identifier_phone_number": "IdentifierPhoneNumber", - "identifier_serial": "IdentifierSerial", - "identifier_wifi_mac": "IdentifierWifiMAC", - "serial_number": "SerialNumber", - }, - "locale": "locale", - "location": { - "latitude": 0, - "longitude": 0, - }, - "name": "name", - "proxy": { - "name": "name", - "smart_ip": True, - "socks5": { - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - }, - "timezone": "timezone", - }, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: - response = await async_client.profiles.with_raw_response.create( - name="x", - spec={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: - async with async_client.profiles.with_streaming_response.create( - name="x", - spec={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.retrieve( - "profileId", - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: - response = await async_client.profiles.with_raw_response.retrieve( - "profileId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: - async with async_client.profiles.with_streaming_response.retrieve( - "profileId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): - await async_client.profiles.with_raw_response.retrieve( - "", - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.update( - profile_id="profileId", - name="x", - spec={}, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.update( - profile_id="profileId", - name="x", - spec={ - "android_version": 0, - "apps": ["string"], - "carrier": { - "gsm_operator_alpha": "GsmOperatorAlpha", - "gsm_operator_numeric": 0, - "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", - "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", - "gsm_sim_operator_numeric": 0, - "persist_sys_timezone": "PersistSysTimezone", - }, - "country": "country", - "files": ["string"], - "identifiers": { - "bootloader_serial_number": "BootloaderSerialNumber", - "identifier_android_id": "IdentifierAndroidID", - "identifier_app_set_id": "IdentifierAppSetID", - "identifier_bluetooth_mac": "IdentifierBluetoothMAC", - "identifier_gaid": "IdentifierGAID", - "identifier_gsfid": "IdentifierGSFID", - "identifier_iccid": "IdentifierICCID", - "identifier_imei": "IdentifierIMEI", - "identifier_imsi": "IdentifierIMSI", - "identifier_media_drmid": "IdentifierMediaDRMID", - "identifier_meid": "IdentifierMEID", - "identifier_phone_number": "IdentifierPhoneNumber", - "identifier_serial": "IdentifierSerial", - "identifier_wifi_mac": "IdentifierWifiMAC", - "serial_number": "SerialNumber", - }, - "locale": "locale", - "location": { - "latitude": 0, - "longitude": 0, - }, - "name": "name", - "proxy": { - "name": "name", - "smart_ip": True, - "socks5": { - "host": "host", - "password": "password", - "port": 0, - "user": "user", - }, - }, - "timezone": "timezone", - }, - ) - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: - response = await async_client.profiles.with_raw_response.update( - profile_id="profileId", - name="x", - spec={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: - async with async_client.profiles.with_streaming_response.update( - profile_id="profileId", - name="x", - spec={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(Profile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): - await async_client.profiles.with_raw_response.update( - profile_id="", - name="x", - spec={}, - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.list() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.list( - name="name", - order_by="name", - order_by_direction="asc", - page=0, - page_size=0, - ) - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: - response = await async_client.profiles.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: - async with async_client.profiles.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_delete(self, async_client: AsyncMobilerun) -> None: - profile = await async_client.profiles.delete( - "profileId", - ) - assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: - response = await async_client.profiles.with_raw_response.delete( - "profileId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: - async with async_client.profiles.with_streaming_response.delete( - "profileId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): - await async_client.profiles.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/test_proxies.py b/tests/api_resources/test_proxies.py index b96cc4d..6b09e36 100644 --- a/tests/api_resources/test_proxies.py +++ b/tests/api_resources/test_proxies.py @@ -13,7 +13,6 @@ ProxyListResponse, ProxyCreateResponse, ProxyDeleteResponse, - ProxyLookupResponse, ProxyUpdateResponse, ProxyRetrieveResponse, ) @@ -353,62 +352,6 @@ def test_path_params_delete(self, client: Mobilerun) -> None: "", ) - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_lookup(self, client: Mobilerun) -> None: - proxy = client.proxies.lookup( - socks5={ - "host": "host", - "port": 1, - }, - ) - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_lookup_with_all_params(self, client: Mobilerun) -> None: - proxy = client.proxies.lookup( - socks5={ - "host": "host", - "port": 1, - "password": "password", - "user": "user", - }, - ) - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_lookup(self, client: Mobilerun) -> None: - response = client.proxies.with_raw_response.lookup( - socks5={ - "host": "host", - "port": 1, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = response.parse() - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_lookup(self, client: Mobilerun) -> None: - with client.proxies.with_streaming_response.lookup( - socks5={ - "host": "host", - "port": 1, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = response.parse() - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncProxies: parametrize = pytest.mark.parametrize( @@ -743,59 +686,3 @@ async def test_path_params_delete(self, async_client: AsyncMobilerun) -> None: await async_client.proxies.with_raw_response.delete( "", ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_lookup(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.proxies.lookup( - socks5={ - "host": "host", - "port": 1, - }, - ) - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_lookup_with_all_params(self, async_client: AsyncMobilerun) -> None: - proxy = await async_client.proxies.lookup( - socks5={ - "host": "host", - "port": 1, - "password": "password", - "user": "user", - }, - ) - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_lookup(self, async_client: AsyncMobilerun) -> None: - response = await async_client.proxies.with_raw_response.lookup( - socks5={ - "host": "host", - "port": 1, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy = await response.parse() - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_lookup(self, async_client: AsyncMobilerun) -> None: - async with async_client.proxies.with_streaming_response.lookup( - socks5={ - "host": "host", - "port": 1, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy = await response.parse() - assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) - - assert cast(Any, response.is_closed) is True From 394547478c920f583e007fb733cda9e6c4dcc80c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 19:14:26 +0000 Subject: [PATCH 09/10] feat(api): api update --- .stats.yml | 6 +- README.md | 34 +- api.md | 247 ++- src/mobilerun_sdk/_client.py | 125 +- src/mobilerun_sdk/_files.py | 2 +- src/mobilerun_sdk/resources/__init__.py | 42 + src/mobilerun_sdk/resources/carriers.py | 900 ++++++++++ .../resources/connect/countries.py | 4 +- .../resources/connect/proxies.py | 4 +- .../resources/devices/__init__.py | 201 +++ .../resources/devices/actions.py | 642 +++++++ src/mobilerun_sdk/resources/devices/apps.py | 764 +++++++++ .../resources/devices/devices.py | 1523 +++++++++++++++++ src/mobilerun_sdk/resources/devices/esim.py | 514 ++++++ src/mobilerun_sdk/resources/devices/files.py | 526 ++++++ .../resources/devices/keyboard.py | 416 +++++ .../resources/devices/language.py | 309 ++++ .../resources/devices/location.py | 295 ++++ .../resources/devices/packages.py | 209 +++ .../resources/devices/profile.py | 188 ++ src/mobilerun_sdk/resources/devices/proxy.py | 421 +++++ src/mobilerun_sdk/resources/devices/state.py | 393 +++++ src/mobilerun_sdk/resources/devices/tasks.py | 201 +++ .../resources/devices/timezone.py | 285 +++ src/mobilerun_sdk/resources/profiles.py | 558 ++++++ src/mobilerun_sdk/resources/proxies.py | 83 +- src/mobilerun_sdk/types/__init__.py | 51 +- .../types/carrier_create_params.py | 57 + .../types/carrier_create_response.py | 51 + .../types/carrier_delete_response.py | 16 + .../types/carrier_list_params.py | 31 + .../types/carrier_list_response.py | 61 + .../types/carrier_lookup_params.py | 15 + .../types/carrier_lookup_response.py | 51 + .../types/carrier_retrieve_response.py | 51 + .../types/carrier_update_params.py | 51 + .../types/carrier_update_response.py | 51 + .../types/connect/country_list_params.py | 2 +- .../types/connect/country_list_response.py | 2 +- .../types/connect/proxy_buy_params.py | 2 +- .../types/connect/proxy_buy_response.py | 2 +- .../types/connect/proxy_list_response.py | 2 +- .../types/connect/proxy_retrieve_response.py | 2 +- src/mobilerun_sdk/types/device.py | 47 + .../types/device_count_response.py | 8 + .../types/device_create_params.py | 71 + .../types/device_fingerprint_response.py | 48 + src/mobilerun_sdk/types/device_list_params.py | 44 + .../types/device_list_response.py | 20 + .../types/device_set_name_params.py | 11 + .../types/device_terminate_params.py | 17 + src/mobilerun_sdk/types/devices/__init__.py | 44 + src/mobilerun_sdk/types/devices/a11_y_node.py | 57 + .../types/devices/action_global_params.py | 15 + .../action_overlay_visible_response.py | 16 + .../action_set_overlay_visible_params.py | 15 + .../types/devices/action_swipe_params.py | 26 + .../types/devices/action_tap_params.py | 19 + .../types/devices/app_install_params.py | 33 + .../types/devices/app_list_params.py | 17 + .../types/devices/app_list_response.py | 25 + .../types/devices/app_start_params.py | 17 + .../types/devices/app_stop_params.py | 18 + .../types/devices/esim_activate_params.py | 26 + .../types/devices/esim_activate_response.py | 28 + .../types/devices/esim_enable_params.py | 15 + .../types/devices/esim_list_response.py | 32 + .../types/devices/esim_remove_params.py | 15 + .../types/devices/file_delete_params.py | 15 + .../types/devices/file_download_params.py | 15 + .../types/devices/file_download_response.py | 7 + src/mobilerun_sdk/types/devices/file_info.py | 51 + .../types/devices/file_list_params.py | 15 + .../types/devices/file_list_response.py | 21 + .../types/devices/file_upload_params.py | 18 + .../types/devices/keyboard_key_params.py | 15 + .../types/devices/keyboard_write_params.py | 25 + .../types/devices/language_get_response.py | 16 + .../types/devices/language_set_params.py | 25 + .../types/devices/location_set_params.py | 17 + .../types/devices/package_list_params.py | 17 + .../types/devices/package_list_response.py | 8 + .../types/devices/profile_update_params.py | 16 + .../types/devices/proxy_connect_params.py | 41 + .../types/devices/proxy_status_response.py | 22 + src/mobilerun_sdk/types/devices/rect.py | 11 + .../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 | 83 + .../types/devices/task_list_params.py | 19 + .../types/devices/task_list_response.py | 28 + .../types/devices/timezone_get_response.py | 16 + .../types/devices/timezone_set_params.py | 15 + src/mobilerun_sdk/types/profile.py | 28 + .../types/profile_create_params.py | 17 + .../types/profile_delete_response.py | 16 + .../types/profile_list_params.py | 21 + .../types/profile_list_response.py | 20 + .../types/profile_update_params.py | 17 + .../types/proxy_lookup_params.py | 24 + .../types/proxy_lookup_response.py | 57 + src/mobilerun_sdk/types/shared/__init__.py | 7 + .../types/shared/device_carrier.py | 21 + .../types/shared/device_identifiers.py | 39 + src/mobilerun_sdk/types/shared/device_spec.py | 48 + src/mobilerun_sdk/types/shared/location.py | 18 + src/mobilerun_sdk/types/shared/meta.py | 21 + .../types/shared/permission_set.py | 13 + src/mobilerun_sdk/types/shared/socks5.py | 15 + .../types/shared_params/__init__.py | 7 + .../types/shared_params/device_carrier.py | 23 + .../types/shared_params/device_identifiers.py | 41 + .../types/shared_params/device_spec.py | 47 + .../types/shared_params/location.py | 13 + .../types/shared_params/socks5.py | 17 + tests/api_resources/connect/test_countries.py | 4 +- tests/api_resources/connect/test_proxies.py | 4 +- tests/api_resources/devices/__init__.py | 1 + tests/api_resources/devices/test_actions.py | 630 +++++++ tests/api_resources/devices/test_apps.py | 736 ++++++++ tests/api_resources/devices/test_esim.py | 479 ++++++ tests/api_resources/devices/test_files.py | 484 ++++++ tests/api_resources/devices/test_keyboard.py | 356 ++++ tests/api_resources/devices/test_language.py | 240 +++ tests/api_resources/devices/test_location.py | 248 +++ tests/api_resources/devices/test_packages.py | 130 ++ tests/api_resources/devices/test_profile.py | 134 ++ tests/api_resources/devices/test_proxy.py | 354 ++++ tests/api_resources/devices/test_state.py | 336 ++++ tests/api_resources/devices/test_tasks.py | 132 ++ tests/api_resources/devices/test_timezone.py | 238 +++ tests/api_resources/test_carriers.py | 567 ++++++ tests/api_resources/test_devices.py | 978 +++++++++++ tests/api_resources/test_profiles.py | 676 ++++++++ tests/api_resources/test_proxies.py | 113 ++ 137 files changed, 17977 insertions(+), 27 deletions(-) create mode 100644 src/mobilerun_sdk/resources/carriers.py create mode 100644 src/mobilerun_sdk/resources/devices/__init__.py create mode 100644 src/mobilerun_sdk/resources/devices/actions.py create mode 100644 src/mobilerun_sdk/resources/devices/apps.py create mode 100644 src/mobilerun_sdk/resources/devices/devices.py create mode 100644 src/mobilerun_sdk/resources/devices/esim.py create mode 100644 src/mobilerun_sdk/resources/devices/files.py create mode 100644 src/mobilerun_sdk/resources/devices/keyboard.py create mode 100644 src/mobilerun_sdk/resources/devices/language.py create mode 100644 src/mobilerun_sdk/resources/devices/location.py create mode 100644 src/mobilerun_sdk/resources/devices/packages.py create mode 100644 src/mobilerun_sdk/resources/devices/profile.py create mode 100644 src/mobilerun_sdk/resources/devices/proxy.py create mode 100644 src/mobilerun_sdk/resources/devices/state.py create mode 100644 src/mobilerun_sdk/resources/devices/tasks.py create mode 100644 src/mobilerun_sdk/resources/devices/timezone.py create mode 100644 src/mobilerun_sdk/resources/profiles.py create mode 100644 src/mobilerun_sdk/types/carrier_create_params.py create mode 100644 src/mobilerun_sdk/types/carrier_create_response.py create mode 100644 src/mobilerun_sdk/types/carrier_delete_response.py create mode 100644 src/mobilerun_sdk/types/carrier_list_params.py create mode 100644 src/mobilerun_sdk/types/carrier_list_response.py create mode 100644 src/mobilerun_sdk/types/carrier_lookup_params.py create mode 100644 src/mobilerun_sdk/types/carrier_lookup_response.py create mode 100644 src/mobilerun_sdk/types/carrier_retrieve_response.py create mode 100644 src/mobilerun_sdk/types/carrier_update_params.py create mode 100644 src/mobilerun_sdk/types/carrier_update_response.py create mode 100644 src/mobilerun_sdk/types/device.py create mode 100644 src/mobilerun_sdk/types/device_count_response.py create mode 100644 src/mobilerun_sdk/types/device_create_params.py create mode 100644 src/mobilerun_sdk/types/device_fingerprint_response.py create mode 100644 src/mobilerun_sdk/types/device_list_params.py create mode 100644 src/mobilerun_sdk/types/device_list_response.py create mode 100644 src/mobilerun_sdk/types/device_set_name_params.py create mode 100644 src/mobilerun_sdk/types/device_terminate_params.py create mode 100644 src/mobilerun_sdk/types/devices/a11_y_node.py create mode 100644 src/mobilerun_sdk/types/devices/action_global_params.py create mode 100644 src/mobilerun_sdk/types/devices/action_overlay_visible_response.py create mode 100644 src/mobilerun_sdk/types/devices/action_set_overlay_visible_params.py create mode 100644 src/mobilerun_sdk/types/devices/action_swipe_params.py create mode 100644 src/mobilerun_sdk/types/devices/action_tap_params.py create mode 100644 src/mobilerun_sdk/types/devices/app_install_params.py create mode 100644 src/mobilerun_sdk/types/devices/app_list_params.py create mode 100644 src/mobilerun_sdk/types/devices/app_list_response.py create mode 100644 src/mobilerun_sdk/types/devices/app_start_params.py create mode 100644 src/mobilerun_sdk/types/devices/app_stop_params.py create mode 100644 src/mobilerun_sdk/types/devices/esim_activate_params.py create mode 100644 src/mobilerun_sdk/types/devices/esim_activate_response.py create mode 100644 src/mobilerun_sdk/types/devices/esim_enable_params.py create mode 100644 src/mobilerun_sdk/types/devices/esim_list_response.py create mode 100644 src/mobilerun_sdk/types/devices/esim_remove_params.py create mode 100644 src/mobilerun_sdk/types/devices/file_delete_params.py create mode 100644 src/mobilerun_sdk/types/devices/file_download_params.py create mode 100644 src/mobilerun_sdk/types/devices/file_download_response.py create mode 100644 src/mobilerun_sdk/types/devices/file_info.py create mode 100644 src/mobilerun_sdk/types/devices/file_list_params.py create mode 100644 src/mobilerun_sdk/types/devices/file_list_response.py create mode 100644 src/mobilerun_sdk/types/devices/file_upload_params.py create mode 100644 src/mobilerun_sdk/types/devices/keyboard_key_params.py create mode 100644 src/mobilerun_sdk/types/devices/keyboard_write_params.py create mode 100644 src/mobilerun_sdk/types/devices/language_get_response.py create mode 100644 src/mobilerun_sdk/types/devices/language_set_params.py create mode 100644 src/mobilerun_sdk/types/devices/location_set_params.py create mode 100644 src/mobilerun_sdk/types/devices/package_list_params.py create mode 100644 src/mobilerun_sdk/types/devices/package_list_response.py create mode 100644 src/mobilerun_sdk/types/devices/profile_update_params.py create mode 100644 src/mobilerun_sdk/types/devices/proxy_connect_params.py create mode 100644 src/mobilerun_sdk/types/devices/proxy_status_response.py create mode 100644 src/mobilerun_sdk/types/devices/rect.py create mode 100644 src/mobilerun_sdk/types/devices/state_screenshot_params.py create mode 100644 src/mobilerun_sdk/types/devices/state_screenshot_response.py create mode 100644 src/mobilerun_sdk/types/devices/state_time_response.py create mode 100644 src/mobilerun_sdk/types/devices/state_ui_params.py create mode 100644 src/mobilerun_sdk/types/devices/state_ui_response.py create mode 100644 src/mobilerun_sdk/types/devices/task_list_params.py create mode 100644 src/mobilerun_sdk/types/devices/task_list_response.py create mode 100644 src/mobilerun_sdk/types/devices/timezone_get_response.py create mode 100644 src/mobilerun_sdk/types/devices/timezone_set_params.py create mode 100644 src/mobilerun_sdk/types/profile.py create mode 100644 src/mobilerun_sdk/types/profile_create_params.py create mode 100644 src/mobilerun_sdk/types/profile_delete_response.py create mode 100644 src/mobilerun_sdk/types/profile_list_params.py create mode 100644 src/mobilerun_sdk/types/profile_list_response.py create mode 100644 src/mobilerun_sdk/types/profile_update_params.py create mode 100644 src/mobilerun_sdk/types/proxy_lookup_params.py create mode 100644 src/mobilerun_sdk/types/proxy_lookup_response.py create mode 100644 src/mobilerun_sdk/types/shared/device_carrier.py create mode 100644 src/mobilerun_sdk/types/shared/device_identifiers.py create mode 100644 src/mobilerun_sdk/types/shared/device_spec.py create mode 100644 src/mobilerun_sdk/types/shared/location.py create mode 100644 src/mobilerun_sdk/types/shared/meta.py create mode 100644 src/mobilerun_sdk/types/shared/permission_set.py create mode 100644 src/mobilerun_sdk/types/shared/socks5.py create mode 100644 src/mobilerun_sdk/types/shared_params/__init__.py create mode 100644 src/mobilerun_sdk/types/shared_params/device_carrier.py create mode 100644 src/mobilerun_sdk/types/shared_params/device_identifiers.py create mode 100644 src/mobilerun_sdk/types/shared_params/device_spec.py create mode 100644 src/mobilerun_sdk/types/shared_params/location.py create mode 100644 src/mobilerun_sdk/types/shared_params/socks5.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_esim.py create mode 100644 tests/api_resources/devices/test_files.py create mode 100644 tests/api_resources/devices/test_keyboard.py create mode 100644 tests/api_resources/devices/test_language.py create mode 100644 tests/api_resources/devices/test_location.py create mode 100644 tests/api_resources/devices/test_packages.py create mode 100644 tests/api_resources/devices/test_profile.py create mode 100644 tests/api_resources/devices/test_proxy.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/devices/test_timezone.py create mode 100644 tests/api_resources/test_carriers.py create mode 100644 tests/api_resources/test_devices.py create mode 100644 tests/api_resources/test_profiles.py diff --git a/.stats.yml b/.stats.yml index 2efae16..e5df493 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 92 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-b9a26a687db7906dc76ce8e009567a1aefd65135a98b7784125f700e4ec76f2b.yml -openapi_spec_hash: c7fc0ba62410db6d5d1b8aeed9ca8b2a +configured_endpoints: 150 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/droidrun/droidrun-cloud-25fffba3f78da9bb7ed2f734f4b712bbacb7f07fff37c3f7903e1047b941bede.yml +openapi_spec_hash: ad96cd61fc43fc4840a84a93ec208842 config_hash: 0636636df2adbdea4b2e982ab5c858d4 diff --git a/README.md b/README.md index 36403bb..73b8b1d 100644 --- a/README.md +++ b/README.md @@ -124,14 +124,38 @@ from mobilerun_sdk import Mobilerun client = Mobilerun() -trigger = client.workflows.triggers.create( - activation="event", - name="x", - conditions={}, +device = client.devices.create( + carrier={ + "gsm_operator_alpha": "GsmOperatorAlpha", + "gsm_operator_numeric": 0, + "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", + "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", + "gsm_sim_operator_numeric": 0, + "persist_sys_timezone": "PersistSysTimezone", + }, ) -print(trigger.conditions) +print(device.carrier) ``` +## File uploads + +Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. + +```python +from pathlib import Path +from mobilerun_sdk import Mobilerun + +client = Mobilerun() + +client.devices.files.upload( + device_id="deviceId", + path="path", + file=Path("/path/to/file"), +) +``` + +The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically. + ## 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_sdk.APIConnectionError` is raised. diff --git a/api.md b/api.md index e3f09f0..1a26682 100644 --- a/api.md +++ b/api.md @@ -1,7 +1,17 @@ # Shared Types ```python -from mobilerun_sdk.types import Pagination, PaginationMeta +from mobilerun_sdk.types import ( + DeviceCarrier, + DeviceIdentifiers, + DeviceSpec, + Location, + Meta, + Pagination, + PaginationMeta, + PermissionSet, + Socks5, +) ``` # Apps @@ -30,6 +40,30 @@ Methods: - client.apps.list_versions(id) -> AppListVersionsResponse - client.apps.mark_failed(id) -> AppMarkFailedResponse +# Carriers + +Types: + +```python +from mobilerun_sdk.types import ( + CarrierCreateResponse, + CarrierRetrieveResponse, + CarrierUpdateResponse, + CarrierListResponse, + CarrierDeleteResponse, + CarrierLookupResponse, +) +``` + +Methods: + +- client.carriers.create(\*\*params) -> CarrierCreateResponse +- client.carriers.retrieve(carrier_id) -> CarrierRetrieveResponse +- client.carriers.update(carrier_id, \*\*params) -> CarrierUpdateResponse +- client.carriers.list(\*\*params) -> CarrierListResponse +- client.carriers.delete(carrier_id) -> CarrierDeleteResponse +- client.carriers.lookup(\*\*params) -> CarrierLookupResponse + # Credentials Types: @@ -92,6 +126,199 @@ Methods: - client.credentials.packages.credentials.fields.update(field_type, \*, package_name, credential_name, \*\*params) -> FieldUpdateResponse - client.credentials.packages.credentials.fields.delete(field_type, \*, package_name, credential_name) -> FieldDeleteResponse +# Devices + +Types: + +```python +from mobilerun_sdk.types import ( + Device, + DeviceListResponse, + DeviceCountResponse, + DeviceFingerprintResponse, +) +``` + +Methods: + +- client.devices.create(\*\*params) -> Device +- client.devices.retrieve(device_id) -> Device +- client.devices.list(\*\*params) -> DeviceListResponse +- client.devices.count() -> DeviceCountResponse +- client.devices.fingerprint(device_id) -> DeviceFingerprintResponse +- client.devices.reboot(device_id) -> None +- client.devices.reset(device_id) -> None +- client.devices.set_name(device_id, \*\*params) -> Device +- client.devices.terminate(device_id, \*\*params) -> None +- client.devices.wait_ready(device_id) -> Device + +## Actions + +Types: + +```python +from mobilerun_sdk.types.devices import ActionOverlayVisibleResponse +``` + +Methods: + +- client.devices.actions.global\_(device_id, \*\*params) -> None +- client.devices.actions.overlay_visible(device_id) -> ActionOverlayVisibleResponse +- client.devices.actions.set_overlay_visible(device_id, \*\*params) -> None +- client.devices.actions.swipe(device_id, \*\*params) -> None +- client.devices.actions.tap(device_id, \*\*params) -> None + +## Apps + +Types: + +```python +from mobilerun_sdk.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 +- client.devices.apps.stop(package_name, \*, device_id, \*\*params) -> None + +## Esim + +Types: + +```python +from mobilerun_sdk.types.devices import EsimListResponse, EsimActivateResponse +``` + +Methods: + +- client.devices.esim.list(device_id) -> Optional[EsimListResponse] +- client.devices.esim.activate(device_id, \*\*params) -> EsimActivateResponse +- client.devices.esim.enable(device_id, \*\*params) -> None +- client.devices.esim.remove(device_id, \*\*params) -> None + +## Files + +Types: + +```python +from mobilerun_sdk.types.devices import FileInfo, FileListResponse, FileDownloadResponse +``` + +Methods: + +- client.devices.files.list(device_id, \*\*params) -> FileListResponse +- client.devices.files.delete(device_id, \*\*params) -> None +- client.devices.files.download(device_id, \*\*params) -> str +- client.devices.files.upload(device_id, \*\*params) -> None + +## 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 + +## Location + +Methods: + +- client.devices.location.get(device_id) -> Location +- client.devices.location.set(device_id, \*\*params) -> None + +## Packages + +Types: + +```python +from mobilerun_sdk.types.devices import PackageListResponse +``` + +Methods: + +- client.devices.packages.list(device_id, \*\*params) -> Optional[PackageListResponse] + +## Profile + +Methods: + +- client.devices.profile.update(device_id, \*\*params) -> None + +## Proxy + +Types: + +```python +from mobilerun_sdk.types.devices import ProxyStatusResponse +``` + +Methods: + +- client.devices.proxy.connect(device_id, \*\*params) -> None +- client.devices.proxy.disconnect(device_id) -> None +- client.devices.proxy.status(device_id) -> ProxyStatusResponse + +## State + +Types: + +```python +from mobilerun_sdk.types.devices import ( + A11YNode, + Rect, + 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 + +## Tasks + +Types: + +```python +from mobilerun_sdk.types.devices import TaskListResponse +``` + +Methods: + +- client.devices.tasks.list(device_id, \*\*params) -> TaskListResponse + +## Timezone + +Types: + +```python +from mobilerun_sdk.types.devices import TimezoneGetResponse +``` + +Methods: + +- client.devices.timezone.get(device_id) -> TimezoneGetResponse +- client.devices.timezone.set(device_id, \*\*params) -> None + +## Language + +Types: + +```python +from mobilerun_sdk.types.devices import LanguageGetResponse +``` + +Methods: + +- client.devices.language.get(device_id) -> LanguageGetResponse +- client.devices.language.set(device_id, \*\*params) -> None + # Models Types: @@ -104,6 +331,22 @@ Methods: - client.models.list() -> ModelListResponse +# Profiles + +Types: + +```python +from mobilerun_sdk.types import Profile, ProfileListResponse, ProfileDeleteResponse +``` + +Methods: + +- client.profiles.create(\*\*params) -> Profile +- client.profiles.retrieve(profile_id) -> Profile +- client.profiles.update(profile_id, \*\*params) -> Profile +- client.profiles.list(\*\*params) -> ProfileListResponse +- client.profiles.delete(profile_id) -> ProfileDeleteResponse + # Proxies Types: @@ -116,6 +359,7 @@ from mobilerun_sdk.types import ( ProxyUpdateResponse, ProxyListResponse, ProxyDeleteResponse, + ProxyLookupResponse, ) ``` @@ -126,6 +370,7 @@ Methods: - client.proxies.update(proxy_id, \*\*params) -> ProxyUpdateResponse - client.proxies.list(\*\*params) -> ProxyListResponse - client.proxies.delete(proxy_id) -> ProxyDeleteResponse +- client.proxies.lookup(\*\*params) -> ProxyLookupResponse # Connect diff --git a/src/mobilerun_sdk/_client.py b/src/mobilerun_sdk/_client.py index 281499a..2ac5304 100644 --- a/src/mobilerun_sdk/_client.py +++ b/src/mobilerun_sdk/_client.py @@ -36,12 +36,27 @@ ) if TYPE_CHECKING: - from .resources import apps, tasks, models, connect, proxies, webhooks, workflows, credentials + from .resources import ( + apps, + tasks, + models, + connect, + devices, + proxies, + carriers, + profiles, + webhooks, + workflows, + credentials, + ) from .resources.apps import AppsResource, AsyncAppsResource from .resources.models import ModelsResource, AsyncModelsResource from .resources.proxies import ProxiesResource, AsyncProxiesResource + from .resources.carriers import CarriersResource, AsyncCarriersResource + from .resources.profiles import ProfilesResource, AsyncProfilesResource from .resources.tasks.tasks import TasksResource, AsyncTasksResource from .resources.connect.connect import ConnectResource, AsyncConnectResource + from .resources.devices.devices import DevicesResource, AsyncDevicesResource from .resources.webhooks.webhooks import WebhooksResource, AsyncWebhooksResource from .resources.workflows.workflows import WorkflowsResource, AsyncWorkflowsResource from .resources.credentials.credentials import CredentialsResource, AsyncCredentialsResource @@ -124,12 +139,24 @@ def apps(self) -> AppsResource: return AppsResource(self) + @cached_property + def carriers(self) -> CarriersResource: + from .resources.carriers import CarriersResource + + return CarriersResource(self) + @cached_property def credentials(self) -> CredentialsResource: from .resources.credentials import CredentialsResource return CredentialsResource(self) + @cached_property + def devices(self) -> DevicesResource: + from .resources.devices import DevicesResource + + return DevicesResource(self) + @cached_property def models(self) -> ModelsResource: """LLM Models""" @@ -137,6 +164,12 @@ def models(self) -> ModelsResource: return ModelsResource(self) + @cached_property + def profiles(self) -> ProfilesResource: + from .resources.profiles import ProfilesResource + + return ProfilesResource(self) + @cached_property def proxies(self) -> ProxiesResource: from .resources.proxies import ProxiesResource @@ -358,12 +391,24 @@ def apps(self) -> AsyncAppsResource: return AsyncAppsResource(self) + @cached_property + def carriers(self) -> AsyncCarriersResource: + from .resources.carriers import AsyncCarriersResource + + return AsyncCarriersResource(self) + @cached_property def credentials(self) -> AsyncCredentialsResource: from .resources.credentials import AsyncCredentialsResource return AsyncCredentialsResource(self) + @cached_property + def devices(self) -> AsyncDevicesResource: + from .resources.devices import AsyncDevicesResource + + return AsyncDevicesResource(self) + @cached_property def models(self) -> AsyncModelsResource: """LLM Models""" @@ -371,6 +416,12 @@ def models(self) -> AsyncModelsResource: return AsyncModelsResource(self) + @cached_property + def profiles(self) -> AsyncProfilesResource: + from .resources.profiles import AsyncProfilesResource + + return AsyncProfilesResource(self) + @cached_property def proxies(self) -> AsyncProxiesResource: from .resources.proxies import AsyncProxiesResource @@ -538,12 +589,24 @@ def apps(self) -> apps.AppsResourceWithRawResponse: return AppsResourceWithRawResponse(self._client.apps) + @cached_property + def carriers(self) -> carriers.CarriersResourceWithRawResponse: + from .resources.carriers import CarriersResourceWithRawResponse + + return CarriersResourceWithRawResponse(self._client.carriers) + @cached_property def credentials(self) -> credentials.CredentialsResourceWithRawResponse: from .resources.credentials import CredentialsResourceWithRawResponse return CredentialsResourceWithRawResponse(self._client.credentials) + @cached_property + def devices(self) -> devices.DevicesResourceWithRawResponse: + from .resources.devices import DevicesResourceWithRawResponse + + return DevicesResourceWithRawResponse(self._client.devices) + @cached_property def models(self) -> models.ModelsResourceWithRawResponse: """LLM Models""" @@ -551,6 +614,12 @@ def models(self) -> models.ModelsResourceWithRawResponse: return ModelsResourceWithRawResponse(self._client.models) + @cached_property + def profiles(self) -> profiles.ProfilesResourceWithRawResponse: + from .resources.profiles import ProfilesResourceWithRawResponse + + return ProfilesResourceWithRawResponse(self._client.profiles) + @cached_property def proxies(self) -> proxies.ProxiesResourceWithRawResponse: from .resources.proxies import ProxiesResourceWithRawResponse @@ -595,12 +664,24 @@ def apps(self) -> apps.AsyncAppsResourceWithRawResponse: return AsyncAppsResourceWithRawResponse(self._client.apps) + @cached_property + def carriers(self) -> carriers.AsyncCarriersResourceWithRawResponse: + from .resources.carriers import AsyncCarriersResourceWithRawResponse + + return AsyncCarriersResourceWithRawResponse(self._client.carriers) + @cached_property def credentials(self) -> credentials.AsyncCredentialsResourceWithRawResponse: from .resources.credentials import AsyncCredentialsResourceWithRawResponse return AsyncCredentialsResourceWithRawResponse(self._client.credentials) + @cached_property + def devices(self) -> devices.AsyncDevicesResourceWithRawResponse: + from .resources.devices import AsyncDevicesResourceWithRawResponse + + return AsyncDevicesResourceWithRawResponse(self._client.devices) + @cached_property def models(self) -> models.AsyncModelsResourceWithRawResponse: """LLM Models""" @@ -608,6 +689,12 @@ def models(self) -> models.AsyncModelsResourceWithRawResponse: return AsyncModelsResourceWithRawResponse(self._client.models) + @cached_property + def profiles(self) -> profiles.AsyncProfilesResourceWithRawResponse: + from .resources.profiles import AsyncProfilesResourceWithRawResponse + + return AsyncProfilesResourceWithRawResponse(self._client.profiles) + @cached_property def proxies(self) -> proxies.AsyncProxiesResourceWithRawResponse: from .resources.proxies import AsyncProxiesResourceWithRawResponse @@ -652,12 +739,24 @@ def apps(self) -> apps.AppsResourceWithStreamingResponse: return AppsResourceWithStreamingResponse(self._client.apps) + @cached_property + def carriers(self) -> carriers.CarriersResourceWithStreamingResponse: + from .resources.carriers import CarriersResourceWithStreamingResponse + + return CarriersResourceWithStreamingResponse(self._client.carriers) + @cached_property def credentials(self) -> credentials.CredentialsResourceWithStreamingResponse: from .resources.credentials import CredentialsResourceWithStreamingResponse return CredentialsResourceWithStreamingResponse(self._client.credentials) + @cached_property + def devices(self) -> devices.DevicesResourceWithStreamingResponse: + from .resources.devices import DevicesResourceWithStreamingResponse + + return DevicesResourceWithStreamingResponse(self._client.devices) + @cached_property def models(self) -> models.ModelsResourceWithStreamingResponse: """LLM Models""" @@ -665,6 +764,12 @@ def models(self) -> models.ModelsResourceWithStreamingResponse: return ModelsResourceWithStreamingResponse(self._client.models) + @cached_property + def profiles(self) -> profiles.ProfilesResourceWithStreamingResponse: + from .resources.profiles import ProfilesResourceWithStreamingResponse + + return ProfilesResourceWithStreamingResponse(self._client.profiles) + @cached_property def proxies(self) -> proxies.ProxiesResourceWithStreamingResponse: from .resources.proxies import ProxiesResourceWithStreamingResponse @@ -709,12 +814,24 @@ def apps(self) -> apps.AsyncAppsResourceWithStreamingResponse: return AsyncAppsResourceWithStreamingResponse(self._client.apps) + @cached_property + def carriers(self) -> carriers.AsyncCarriersResourceWithStreamingResponse: + from .resources.carriers import AsyncCarriersResourceWithStreamingResponse + + return AsyncCarriersResourceWithStreamingResponse(self._client.carriers) + @cached_property def credentials(self) -> credentials.AsyncCredentialsResourceWithStreamingResponse: from .resources.credentials import AsyncCredentialsResourceWithStreamingResponse return AsyncCredentialsResourceWithStreamingResponse(self._client.credentials) + @cached_property + def devices(self) -> devices.AsyncDevicesResourceWithStreamingResponse: + from .resources.devices import AsyncDevicesResourceWithStreamingResponse + + return AsyncDevicesResourceWithStreamingResponse(self._client.devices) + @cached_property def models(self) -> models.AsyncModelsResourceWithStreamingResponse: """LLM Models""" @@ -722,6 +839,12 @@ def models(self) -> models.AsyncModelsResourceWithStreamingResponse: return AsyncModelsResourceWithStreamingResponse(self._client.models) + @cached_property + def profiles(self) -> profiles.AsyncProfilesResourceWithStreamingResponse: + from .resources.profiles import AsyncProfilesResourceWithStreamingResponse + + return AsyncProfilesResourceWithStreamingResponse(self._client.profiles) + @cached_property def proxies(self) -> proxies.AsyncProxiesResourceWithStreamingResponse: from .resources.proxies import AsyncProxiesResourceWithStreamingResponse diff --git a/src/mobilerun_sdk/_files.py b/src/mobilerun_sdk/_files.py index 76da9e0..22855ba 100644 --- a/src/mobilerun_sdk/_files.py +++ b/src/mobilerun_sdk/_files.py @@ -36,7 +36,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: if not is_file_content(obj): prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" raise RuntimeError( - f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead." + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/droidrun/mobilerun-sdk-python/tree/main#file-uploads" ) from None diff --git a/src/mobilerun_sdk/resources/__init__.py b/src/mobilerun_sdk/resources/__init__.py index bf17686..be9be40 100644 --- a/src/mobilerun_sdk/resources/__init__.py +++ b/src/mobilerun_sdk/resources/__init__.py @@ -32,6 +32,14 @@ ConnectResourceWithStreamingResponse, AsyncConnectResourceWithStreamingResponse, ) +from .devices import ( + DevicesResource, + AsyncDevicesResource, + DevicesResourceWithRawResponse, + AsyncDevicesResourceWithRawResponse, + DevicesResourceWithStreamingResponse, + AsyncDevicesResourceWithStreamingResponse, +) from .proxies import ( ProxiesResource, AsyncProxiesResource, @@ -40,6 +48,22 @@ ProxiesResourceWithStreamingResponse, AsyncProxiesResourceWithStreamingResponse, ) +from .carriers import ( + CarriersResource, + AsyncCarriersResource, + CarriersResourceWithRawResponse, + AsyncCarriersResourceWithRawResponse, + CarriersResourceWithStreamingResponse, + AsyncCarriersResourceWithStreamingResponse, +) +from .profiles import ( + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, +) from .webhooks import ( WebhooksResource, AsyncWebhooksResource, @@ -72,18 +96,36 @@ "AsyncAppsResourceWithRawResponse", "AppsResourceWithStreamingResponse", "AsyncAppsResourceWithStreamingResponse", + "CarriersResource", + "AsyncCarriersResource", + "CarriersResourceWithRawResponse", + "AsyncCarriersResourceWithRawResponse", + "CarriersResourceWithStreamingResponse", + "AsyncCarriersResourceWithStreamingResponse", "CredentialsResource", "AsyncCredentialsResource", "CredentialsResourceWithRawResponse", "AsyncCredentialsResourceWithRawResponse", "CredentialsResourceWithStreamingResponse", "AsyncCredentialsResourceWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", "ModelsResource", "AsyncModelsResource", "ModelsResourceWithRawResponse", "AsyncModelsResourceWithRawResponse", "ModelsResourceWithStreamingResponse", "AsyncModelsResourceWithStreamingResponse", + "ProfilesResource", + "AsyncProfilesResource", + "ProfilesResourceWithRawResponse", + "AsyncProfilesResourceWithRawResponse", + "ProfilesResourceWithStreamingResponse", + "AsyncProfilesResourceWithStreamingResponse", "ProxiesResource", "AsyncProxiesResource", "ProxiesResourceWithRawResponse", diff --git a/src/mobilerun_sdk/resources/carriers.py b/src/mobilerun_sdk/resources/carriers.py new file mode 100644 index 0000000..a674b8f --- /dev/null +++ b/src/mobilerun_sdk/resources/carriers.py @@ -0,0 +1,900 @@ +# 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 carrier_list_params, carrier_create_params, carrier_lookup_params, carrier_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, 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.carrier_list_response import CarrierListResponse +from ..types.carrier_create_response import CarrierCreateResponse +from ..types.carrier_delete_response import CarrierDeleteResponse +from ..types.carrier_lookup_response import CarrierLookupResponse +from ..types.carrier_update_response import CarrierUpdateResponse +from ..types.carrier_retrieve_response import CarrierRetrieveResponse + +__all__ = ["CarriersResource", "AsyncCarriersResource"] + + +class CarriersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CarriersResourceWithRawResponse: + """ + 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 CarriersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CarriersResourceWithStreamingResponse: + """ + 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 CarriersResourceWithStreamingResponse(self) + + def create( + self, + *, + country: str, + mcc: str, + mnc: str, + operator: str, + company: str | Omit = omit, + country_code: str | Omit = omit, + country_iso: str | Omit = omit, + detail_url: str | Omit = omit, + gsm_bands: str | Omit = omit, + lte_bands: str | Omit = omit, + mobile_prefix: str | Omit = omit, + nsn_size: str | Omit = omit, + number_format: str | Omit = omit, + protocols: str | Omit = omit, + umts_bands: str | Omit = omit, + website: str | 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, + ) -> CarrierCreateResponse: + """ + Create a new carrier + + Args: + country: Country name + + mcc: Mobile Country Code + + mnc: Mobile Network Code + + operator: Operator name + + company: Company name + + country_code: Country dialing code (e.g., +1) + + country_iso: ISO country code + + detail_url: URL to carrier details page + + gsm_bands: Supported GSM bands + + lte_bands: Supported LTE bands + + mobile_prefix: Mobile number prefix + + nsn_size: National Significant Number size + + number_format: Phone number format + + protocols: Supported protocols (comma-separated) + + umts_bands: Supported UMTS bands + + website: Company website + + 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( + "/carriers", + body=maybe_transform( + { + "country": country, + "mcc": mcc, + "mnc": mnc, + "operator": operator, + "company": company, + "country_code": country_code, + "country_iso": country_iso, + "detail_url": detail_url, + "gsm_bands": gsm_bands, + "lte_bands": lte_bands, + "mobile_prefix": mobile_prefix, + "nsn_size": nsn_size, + "number_format": number_format, + "protocols": protocols, + "umts_bands": umts_bands, + "website": website, + }, + carrier_create_params.CarrierCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierCreateResponse, + ) + + def retrieve( + self, + carrier_id: int, + *, + # 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, + ) -> CarrierRetrieveResponse: + """ + Get carrier by ID + + Args: + carrier_id: Carrier ID + + 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( + path_template("/carriers/{carrier_id}", carrier_id=carrier_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierRetrieveResponse, + ) + + def update( + self, + carrier_id: int, + *, + company: str | Omit = omit, + country: str | Omit = omit, + country_code: str | Omit = omit, + country_iso: str | Omit = omit, + detail_url: str | Omit = omit, + gsm_bands: str | Omit = omit, + lte_bands: str | Omit = omit, + mobile_prefix: str | Omit = omit, + nsn_size: str | Omit = omit, + number_format: str | Omit = omit, + operator: str | Omit = omit, + protocols: str | Omit = omit, + umts_bands: str | Omit = omit, + website: str | 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, + ) -> CarrierUpdateResponse: + """ + Update a carrier + + Args: + carrier_id: Carrier ID + + company: Company name + + country: Country name + + country_code: Country dialing code + + country_iso: ISO country code + + detail_url: URL to carrier details + + gsm_bands: Supported GSM bands + + lte_bands: Supported LTE bands + + mobile_prefix: Mobile number prefix + + nsn_size: NSN size + + number_format: Phone number format + + operator: Operator name + + protocols: Supported protocols + + umts_bands: Supported UMTS bands + + website: Company website + + 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._patch( + path_template("/carriers/{carrier_id}", carrier_id=carrier_id), + body=maybe_transform( + { + "company": company, + "country": country, + "country_code": country_code, + "country_iso": country_iso, + "detail_url": detail_url, + "gsm_bands": gsm_bands, + "lte_bands": lte_bands, + "mobile_prefix": mobile_prefix, + "nsn_size": nsn_size, + "number_format": number_format, + "operator": operator, + "protocols": protocols, + "umts_bands": umts_bands, + "website": website, + }, + carrier_update_params.CarrierUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierUpdateResponse, + ) + + def list( + self, + *, + country: str | Omit = omit, + country_iso: str | Omit = omit, + order_by: Literal["id", "mcc", "mnc", "operator", "country", "country_iso"] | Omit = omit, + order_dir: 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, + ) -> CarrierListResponse: + """ + List carriers with pagination + + Args: + country: Filter by country name + + country_iso: Filter by country ISO code + + order_by: Field to order by + + order_dir: Order direction + + page: Page number + + page_size: Items per page + + 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( + "/carriers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "country": country, + "country_iso": country_iso, + "order_by": order_by, + "order_dir": order_dir, + "page": page, + "page_size": page_size, + }, + carrier_list_params.CarrierListParams, + ), + ), + cast_to=CarrierListResponse, + ) + + def delete( + self, + carrier_id: int, + *, + # 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, + ) -> CarrierDeleteResponse: + """ + Delete a carrier + + Args: + carrier_id: Carrier ID + + 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._delete( + path_template("/carriers/{carrier_id}", carrier_id=carrier_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierDeleteResponse, + ) + + def lookup( + self, + *, + mcc: str, + mnc: 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, + ) -> CarrierLookupResponse: + """ + Get carrier by MCC and MNC + + Args: + mcc: Mobile Country Code + + mnc: Mobile Network Code + + 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( + "/carriers/lookup", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "mcc": mcc, + "mnc": mnc, + }, + carrier_lookup_params.CarrierLookupParams, + ), + ), + cast_to=CarrierLookupResponse, + ) + + +class AsyncCarriersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCarriersResourceWithRawResponse: + """ + 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 AsyncCarriersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCarriersResourceWithStreamingResponse: + """ + 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 AsyncCarriersResourceWithStreamingResponse(self) + + async def create( + self, + *, + country: str, + mcc: str, + mnc: str, + operator: str, + company: str | Omit = omit, + country_code: str | Omit = omit, + country_iso: str | Omit = omit, + detail_url: str | Omit = omit, + gsm_bands: str | Omit = omit, + lte_bands: str | Omit = omit, + mobile_prefix: str | Omit = omit, + nsn_size: str | Omit = omit, + number_format: str | Omit = omit, + protocols: str | Omit = omit, + umts_bands: str | Omit = omit, + website: str | 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, + ) -> CarrierCreateResponse: + """ + Create a new carrier + + Args: + country: Country name + + mcc: Mobile Country Code + + mnc: Mobile Network Code + + operator: Operator name + + company: Company name + + country_code: Country dialing code (e.g., +1) + + country_iso: ISO country code + + detail_url: URL to carrier details page + + gsm_bands: Supported GSM bands + + lte_bands: Supported LTE bands + + mobile_prefix: Mobile number prefix + + nsn_size: National Significant Number size + + number_format: Phone number format + + protocols: Supported protocols (comma-separated) + + umts_bands: Supported UMTS bands + + website: Company website + + 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( + "/carriers", + body=await async_maybe_transform( + { + "country": country, + "mcc": mcc, + "mnc": mnc, + "operator": operator, + "company": company, + "country_code": country_code, + "country_iso": country_iso, + "detail_url": detail_url, + "gsm_bands": gsm_bands, + "lte_bands": lte_bands, + "mobile_prefix": mobile_prefix, + "nsn_size": nsn_size, + "number_format": number_format, + "protocols": protocols, + "umts_bands": umts_bands, + "website": website, + }, + carrier_create_params.CarrierCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierCreateResponse, + ) + + async def retrieve( + self, + carrier_id: int, + *, + # 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, + ) -> CarrierRetrieveResponse: + """ + Get carrier by ID + + Args: + carrier_id: Carrier ID + + 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( + path_template("/carriers/{carrier_id}", carrier_id=carrier_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierRetrieveResponse, + ) + + async def update( + self, + carrier_id: int, + *, + company: str | Omit = omit, + country: str | Omit = omit, + country_code: str | Omit = omit, + country_iso: str | Omit = omit, + detail_url: str | Omit = omit, + gsm_bands: str | Omit = omit, + lte_bands: str | Omit = omit, + mobile_prefix: str | Omit = omit, + nsn_size: str | Omit = omit, + number_format: str | Omit = omit, + operator: str | Omit = omit, + protocols: str | Omit = omit, + umts_bands: str | Omit = omit, + website: str | 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, + ) -> CarrierUpdateResponse: + """ + Update a carrier + + Args: + carrier_id: Carrier ID + + company: Company name + + country: Country name + + country_code: Country dialing code + + country_iso: ISO country code + + detail_url: URL to carrier details + + gsm_bands: Supported GSM bands + + lte_bands: Supported LTE bands + + mobile_prefix: Mobile number prefix + + nsn_size: NSN size + + number_format: Phone number format + + operator: Operator name + + protocols: Supported protocols + + umts_bands: Supported UMTS bands + + website: Company website + + 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._patch( + path_template("/carriers/{carrier_id}", carrier_id=carrier_id), + body=await async_maybe_transform( + { + "company": company, + "country": country, + "country_code": country_code, + "country_iso": country_iso, + "detail_url": detail_url, + "gsm_bands": gsm_bands, + "lte_bands": lte_bands, + "mobile_prefix": mobile_prefix, + "nsn_size": nsn_size, + "number_format": number_format, + "operator": operator, + "protocols": protocols, + "umts_bands": umts_bands, + "website": website, + }, + carrier_update_params.CarrierUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierUpdateResponse, + ) + + async def list( + self, + *, + country: str | Omit = omit, + country_iso: str | Omit = omit, + order_by: Literal["id", "mcc", "mnc", "operator", "country", "country_iso"] | Omit = omit, + order_dir: 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, + ) -> CarrierListResponse: + """ + List carriers with pagination + + Args: + country: Filter by country name + + country_iso: Filter by country ISO code + + order_by: Field to order by + + order_dir: Order direction + + page: Page number + + page_size: Items per page + + 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( + "/carriers", + 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, + "country_iso": country_iso, + "order_by": order_by, + "order_dir": order_dir, + "page": page, + "page_size": page_size, + }, + carrier_list_params.CarrierListParams, + ), + ), + cast_to=CarrierListResponse, + ) + + async def delete( + self, + carrier_id: int, + *, + # 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, + ) -> CarrierDeleteResponse: + """ + Delete a carrier + + Args: + carrier_id: Carrier ID + + 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._delete( + path_template("/carriers/{carrier_id}", carrier_id=carrier_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CarrierDeleteResponse, + ) + + async def lookup( + self, + *, + mcc: str, + mnc: 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, + ) -> CarrierLookupResponse: + """ + Get carrier by MCC and MNC + + Args: + mcc: Mobile Country Code + + mnc: Mobile Network Code + + 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( + "/carriers/lookup", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "mcc": mcc, + "mnc": mnc, + }, + carrier_lookup_params.CarrierLookupParams, + ), + ), + cast_to=CarrierLookupResponse, + ) + + +class CarriersResourceWithRawResponse: + def __init__(self, carriers: CarriersResource) -> None: + self._carriers = carriers + + self.create = to_raw_response_wrapper( + carriers.create, + ) + self.retrieve = to_raw_response_wrapper( + carriers.retrieve, + ) + self.update = to_raw_response_wrapper( + carriers.update, + ) + self.list = to_raw_response_wrapper( + carriers.list, + ) + self.delete = to_raw_response_wrapper( + carriers.delete, + ) + self.lookup = to_raw_response_wrapper( + carriers.lookup, + ) + + +class AsyncCarriersResourceWithRawResponse: + def __init__(self, carriers: AsyncCarriersResource) -> None: + self._carriers = carriers + + self.create = async_to_raw_response_wrapper( + carriers.create, + ) + self.retrieve = async_to_raw_response_wrapper( + carriers.retrieve, + ) + self.update = async_to_raw_response_wrapper( + carriers.update, + ) + self.list = async_to_raw_response_wrapper( + carriers.list, + ) + self.delete = async_to_raw_response_wrapper( + carriers.delete, + ) + self.lookup = async_to_raw_response_wrapper( + carriers.lookup, + ) + + +class CarriersResourceWithStreamingResponse: + def __init__(self, carriers: CarriersResource) -> None: + self._carriers = carriers + + self.create = to_streamed_response_wrapper( + carriers.create, + ) + self.retrieve = to_streamed_response_wrapper( + carriers.retrieve, + ) + self.update = to_streamed_response_wrapper( + carriers.update, + ) + self.list = to_streamed_response_wrapper( + carriers.list, + ) + self.delete = to_streamed_response_wrapper( + carriers.delete, + ) + self.lookup = to_streamed_response_wrapper( + carriers.lookup, + ) + + +class AsyncCarriersResourceWithStreamingResponse: + def __init__(self, carriers: AsyncCarriersResource) -> None: + self._carriers = carriers + + self.create = async_to_streamed_response_wrapper( + carriers.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + carriers.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + carriers.update, + ) + self.list = async_to_streamed_response_wrapper( + carriers.list, + ) + self.delete = async_to_streamed_response_wrapper( + carriers.delete, + ) + self.lookup = async_to_streamed_response_wrapper( + carriers.lookup, + ) diff --git a/src/mobilerun_sdk/resources/connect/countries.py b/src/mobilerun_sdk/resources/connect/countries.py index d6d0bf0..2780f0d 100644 --- a/src/mobilerun_sdk/resources/connect/countries.py +++ b/src/mobilerun_sdk/resources/connect/countries.py @@ -48,7 +48,7 @@ def list( *, page: int | Omit = omit, page_size: int | Omit = omit, - type: Literal["residential"] | Omit = omit, + type: Literal["dedicated_residential", "residential", "mobile"] | 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, @@ -119,7 +119,7 @@ async def list( *, page: int | Omit = omit, page_size: int | Omit = omit, - type: Literal["residential"] | Omit = omit, + type: Literal["dedicated_residential", "residential", "mobile"] | 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, diff --git a/src/mobilerun_sdk/resources/connect/proxies.py b/src/mobilerun_sdk/resources/connect/proxies.py index 48d5db0..b274aaa 100644 --- a/src/mobilerun_sdk/resources/connect/proxies.py +++ b/src/mobilerun_sdk/resources/connect/proxies.py @@ -137,7 +137,7 @@ def buy( self, *, country: str, - type: Literal["residential"] | Omit = omit, + type: Literal["dedicated_residential", "residential", "mobile"] | 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, @@ -499,7 +499,7 @@ async def buy( self, *, country: str, - type: Literal["residential"] | Omit = omit, + type: Literal["dedicated_residential", "residential", "mobile"] | 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, diff --git a/src/mobilerun_sdk/resources/devices/__init__.py b/src/mobilerun_sdk/resources/devices/__init__.py new file mode 100644 index 0000000..77ef45e --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/__init__.py @@ -0,0 +1,201 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) +from .esim import ( + EsimResource, + AsyncEsimResource, + EsimResourceWithRawResponse, + AsyncEsimResourceWithRawResponse, + EsimResourceWithStreamingResponse, + AsyncEsimResourceWithStreamingResponse, +) +from .files import ( + FilesResource, + AsyncFilesResource, + FilesResourceWithRawResponse, + AsyncFilesResourceWithRawResponse, + FilesResourceWithStreamingResponse, + AsyncFilesResourceWithStreamingResponse, +) +from .proxy import ( + ProxyResource, + AsyncProxyResource, + ProxyResourceWithRawResponse, + AsyncProxyResourceWithRawResponse, + ProxyResourceWithStreamingResponse, + AsyncProxyResourceWithStreamingResponse, +) +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 .profile import ( + ProfileResource, + AsyncProfileResource, + ProfileResourceWithRawResponse, + AsyncProfileResourceWithRawResponse, + ProfileResourceWithStreamingResponse, + AsyncProfileResourceWithStreamingResponse, +) +from .keyboard import ( + KeyboardResource, + AsyncKeyboardResource, + KeyboardResourceWithRawResponse, + AsyncKeyboardResourceWithRawResponse, + KeyboardResourceWithStreamingResponse, + AsyncKeyboardResourceWithStreamingResponse, +) +from .language import ( + LanguageResource, + AsyncLanguageResource, + LanguageResourceWithRawResponse, + AsyncLanguageResourceWithRawResponse, + LanguageResourceWithStreamingResponse, + AsyncLanguageResourceWithStreamingResponse, +) +from .location import ( + LocationResource, + AsyncLocationResource, + LocationResourceWithRawResponse, + AsyncLocationResourceWithRawResponse, + LocationResourceWithStreamingResponse, + AsyncLocationResourceWithStreamingResponse, +) +from .packages import ( + PackagesResource, + AsyncPackagesResource, + PackagesResourceWithRawResponse, + AsyncPackagesResourceWithRawResponse, + PackagesResourceWithStreamingResponse, + AsyncPackagesResourceWithStreamingResponse, +) +from .timezone import ( + TimezoneResource, + AsyncTimezoneResource, + TimezoneResourceWithRawResponse, + AsyncTimezoneResourceWithRawResponse, + TimezoneResourceWithStreamingResponse, + AsyncTimezoneResourceWithStreamingResponse, +) + +__all__ = [ + "ActionsResource", + "AsyncActionsResource", + "ActionsResourceWithRawResponse", + "AsyncActionsResourceWithRawResponse", + "ActionsResourceWithStreamingResponse", + "AsyncActionsResourceWithStreamingResponse", + "AppsResource", + "AsyncAppsResource", + "AppsResourceWithRawResponse", + "AsyncAppsResourceWithRawResponse", + "AppsResourceWithStreamingResponse", + "AsyncAppsResourceWithStreamingResponse", + "EsimResource", + "AsyncEsimResource", + "EsimResourceWithRawResponse", + "AsyncEsimResourceWithRawResponse", + "EsimResourceWithStreamingResponse", + "AsyncEsimResourceWithStreamingResponse", + "FilesResource", + "AsyncFilesResource", + "FilesResourceWithRawResponse", + "AsyncFilesResourceWithRawResponse", + "FilesResourceWithStreamingResponse", + "AsyncFilesResourceWithStreamingResponse", + "KeyboardResource", + "AsyncKeyboardResource", + "KeyboardResourceWithRawResponse", + "AsyncKeyboardResourceWithRawResponse", + "KeyboardResourceWithStreamingResponse", + "AsyncKeyboardResourceWithStreamingResponse", + "LocationResource", + "AsyncLocationResource", + "LocationResourceWithRawResponse", + "AsyncLocationResourceWithRawResponse", + "LocationResourceWithStreamingResponse", + "AsyncLocationResourceWithStreamingResponse", + "PackagesResource", + "AsyncPackagesResource", + "PackagesResourceWithRawResponse", + "AsyncPackagesResourceWithRawResponse", + "PackagesResourceWithStreamingResponse", + "AsyncPackagesResourceWithStreamingResponse", + "ProfileResource", + "AsyncProfileResource", + "ProfileResourceWithRawResponse", + "AsyncProfileResourceWithRawResponse", + "ProfileResourceWithStreamingResponse", + "AsyncProfileResourceWithStreamingResponse", + "ProxyResource", + "AsyncProxyResource", + "ProxyResourceWithRawResponse", + "AsyncProxyResourceWithRawResponse", + "ProxyResourceWithStreamingResponse", + "AsyncProxyResourceWithStreamingResponse", + "StateResource", + "AsyncStateResource", + "StateResourceWithRawResponse", + "AsyncStateResourceWithRawResponse", + "StateResourceWithStreamingResponse", + "AsyncStateResourceWithStreamingResponse", + "TasksResource", + "AsyncTasksResource", + "TasksResourceWithRawResponse", + "AsyncTasksResourceWithRawResponse", + "TasksResourceWithStreamingResponse", + "AsyncTasksResourceWithStreamingResponse", + "TimezoneResource", + "AsyncTimezoneResource", + "TimezoneResourceWithRawResponse", + "AsyncTimezoneResourceWithRawResponse", + "TimezoneResourceWithStreamingResponse", + "AsyncTimezoneResourceWithStreamingResponse", + "LanguageResource", + "AsyncLanguageResource", + "LanguageResourceWithRawResponse", + "AsyncLanguageResourceWithRawResponse", + "LanguageResourceWithStreamingResponse", + "AsyncLanguageResourceWithStreamingResponse", + "DevicesResource", + "AsyncDevicesResource", + "DevicesResourceWithRawResponse", + "AsyncDevicesResourceWithRawResponse", + "DevicesResourceWithStreamingResponse", + "AsyncDevicesResourceWithStreamingResponse", +] diff --git a/src/mobilerun_sdk/resources/devices/actions.py b/src/mobilerun_sdk/resources/devices/actions.py new file mode 100644 index 0000000..8ebefb6 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/actions.py @@ -0,0 +1,642 @@ +# 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, path_template, 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, + action_set_overlay_visible_params, +) +from ...types.devices.action_overlay_visible_response import ActionOverlayVisibleResponse + +__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: + """ + Performs a global system action on the device, such as navigating back or going + to the home screen, identified by an action code. + + 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( + path_template("/devices/{device_id}/global", device_id=device_id), + 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 overlay_visible( + 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, + ) -> ActionOverlayVisibleResponse: + """ + Returns whether the accessibility overlay is currently visible on the 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 = { + **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( + path_template("/devices/{device_id}/overlay", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionOverlayVisibleResponse, + ) + + def set_overlay_visible( + self, + device_id: str, + *, + visible: bool, + 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: + """ + Shows or hides the accessibility overlay on the device based on the visibility + flag in the request body. + + 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( + path_template("/devices/{device_id}/overlay", device_id=device_id), + body=maybe_transform({"visible": visible}, action_set_overlay_visible_params.ActionSetOverlayVisibleParams), + 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, + stealth: 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, + ) -> None: + """ + Swipes from a start coordinate to an end coordinate over the given duration in + milliseconds. An optional stealth flag applies human-like jitter and curved + paths on devices that support it. + + 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( + path_template("/devices/{device_id}/swipe", device_id=device_id), + body=maybe_transform( + { + "duration": duration, + "end_x": end_x, + "end_y": end_y, + "start_x": start_x, + "start_y": start_y, + "stealth": stealth, + }, + 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, + stealth: 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, + ) -> None: + """Taps the device screen at the given x/y coordinates. + + An optional stealth flag + routes the tap through human-like input on devices that support it. + + 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( + path_template("/devices/{device_id}/tap", device_id=device_id), + body=maybe_transform( + { + "x": x, + "y": y, + "stealth": stealth, + }, + 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: + """ + Performs a global system action on the device, such as navigating back or going + to the home screen, identified by an action code. + + 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( + path_template("/devices/{device_id}/global", device_id=device_id), + 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 overlay_visible( + 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, + ) -> ActionOverlayVisibleResponse: + """ + Returns whether the accessibility overlay is currently visible on the 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 = { + **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( + path_template("/devices/{device_id}/overlay", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ActionOverlayVisibleResponse, + ) + + async def set_overlay_visible( + self, + device_id: str, + *, + visible: bool, + 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: + """ + Shows or hides the accessibility overlay on the device based on the visibility + flag in the request body. + + 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( + path_template("/devices/{device_id}/overlay", device_id=device_id), + body=await async_maybe_transform( + {"visible": visible}, action_set_overlay_visible_params.ActionSetOverlayVisibleParams + ), + 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, + stealth: 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, + ) -> None: + """ + Swipes from a start coordinate to an end coordinate over the given duration in + milliseconds. An optional stealth flag applies human-like jitter and curved + paths on devices that support it. + + 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( + path_template("/devices/{device_id}/swipe", device_id=device_id), + body=await async_maybe_transform( + { + "duration": duration, + "end_x": end_x, + "end_y": end_y, + "start_x": start_x, + "start_y": start_y, + "stealth": stealth, + }, + 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, + stealth: 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, + ) -> None: + """Taps the device screen at the given x/y coordinates. + + An optional stealth flag + routes the tap through human-like input on devices that support it. + + 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( + path_template("/devices/{device_id}/tap", device_id=device_id), + body=await async_maybe_transform( + { + "x": x, + "y": y, + "stealth": stealth, + }, + 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.overlay_visible = to_raw_response_wrapper( + actions.overlay_visible, + ) + self.set_overlay_visible = to_raw_response_wrapper( + actions.set_overlay_visible, + ) + 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.overlay_visible = async_to_raw_response_wrapper( + actions.overlay_visible, + ) + self.set_overlay_visible = async_to_raw_response_wrapper( + actions.set_overlay_visible, + ) + 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.overlay_visible = to_streamed_response_wrapper( + actions.overlay_visible, + ) + self.set_overlay_visible = to_streamed_response_wrapper( + actions.set_overlay_visible, + ) + 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.overlay_visible = async_to_streamed_response_wrapper( + actions.overlay_visible, + ) + self.set_overlay_visible = async_to_streamed_response_wrapper( + actions.set_overlay_visible, + ) + self.swipe = async_to_streamed_response_wrapper( + actions.swipe, + ) + self.tap = async_to_streamed_response_wrapper( + actions.tap, + ) diff --git a/src/mobilerun_sdk/resources/devices/apps.py b/src/mobilerun_sdk/resources/devices/apps.py new file mode 100644 index 0000000..ce91eeb --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/apps.py @@ -0,0 +1,764 @@ +# 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 overload + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import is_given, path_template, required_args, 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_stop_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_protected_apps: bool | Omit = omit, + 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]: + """ + Returns detailed information about apps installed on the device, including + package name and label. System and protected apps are excluded unless the + corresponding query parameters are set. + + 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( + path_template("/devices/{device_id}/apps", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_protected_apps": include_protected_apps, + "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: + """ + Uninstalls the app identified by the path package name from the device. + Protected packages cannot be deleted. + + 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( + path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + @overload + def install( + self, + device_id: str, + *, + bundle_id: str, + package_name: 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: + """Installs an app on the device. + + The request body must supply exactly one of an + Android packageName or an iOS bundleId; protected packages are rejected. + + Args: + bundle_id: iOS bundle identifier (e.g. com.example.app) + + package_name: Android package name (e.g. com.example.app) + + 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 + """ + ... + + @overload + def install( + self, + device_id: str, + *, + package_name: str, + bundle_id: 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: + """Installs an app on the device. + + The request body must supply exactly one of an + Android packageName or an iOS bundleId; protected packages are rejected. + + Args: + package_name: Android package name (e.g. com.example.app) + + bundle_id: iOS bundle identifier (e.g. com.example.app) + + 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 + """ + ... + + @required_args(["bundle_id"], ["package_name"]) + def install( + self, + device_id: str, + *, + bundle_id: str | Omit = omit, + package_name: 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: + 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( + path_template("/devices/{device_id}/apps", device_id=device_id), + body=maybe_transform( + { + "bundle_id": bundle_id, + "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: + """ + Launches the app identified by the path package name, optionally starting a + specific activity given in the request body. Protected packages cannot be + started. + + 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( + path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=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, + ) + + def stop( + self, + package_name: str, + *, + device_id: str, + clear_data: 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, + ) -> None: + """Force-stops the app identified by the path package name. + + When clearData is set + in the request body, the app's data is also cleared. Protected packages cannot + be stopped. + + Args: + clear_data: If true, clears all app data (pm clear) in addition to stopping the app. + + 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._patch( + path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), + body=maybe_transform({"clear_data": clear_data}, app_stop_params.AppStopParams), + 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_protected_apps: bool | Omit = omit, + 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]: + """ + Returns detailed information about apps installed on the device, including + package name and label. System and protected apps are excluded unless the + corresponding query parameters are set. + + 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( + path_template("/devices/{device_id}/apps", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_protected_apps": include_protected_apps, + "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: + """ + Uninstalls the app identified by the path package name from the device. + Protected packages cannot be deleted. + + 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( + path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + @overload + async def install( + self, + device_id: str, + *, + bundle_id: str, + package_name: 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: + """Installs an app on the device. + + The request body must supply exactly one of an + Android packageName or an iOS bundleId; protected packages are rejected. + + Args: + bundle_id: iOS bundle identifier (e.g. com.example.app) + + package_name: Android package name (e.g. com.example.app) + + 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 + """ + ... + + @overload + async def install( + self, + device_id: str, + *, + package_name: str, + bundle_id: 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: + """Installs an app on the device. + + The request body must supply exactly one of an + Android packageName or an iOS bundleId; protected packages are rejected. + + Args: + package_name: Android package name (e.g. com.example.app) + + bundle_id: iOS bundle identifier (e.g. com.example.app) + + 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 + """ + ... + + @required_args(["bundle_id"], ["package_name"]) + async def install( + self, + device_id: str, + *, + bundle_id: str | Omit = omit, + package_name: 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: + 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( + path_template("/devices/{device_id}/apps", device_id=device_id), + body=await async_maybe_transform( + { + "bundle_id": bundle_id, + "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: + """ + Launches the app identified by the path package name, optionally starting a + specific activity given in the request body. Protected packages cannot be + started. + + 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( + path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=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, + ) + + async def stop( + self, + package_name: str, + *, + device_id: str, + clear_data: 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, + ) -> None: + """Force-stops the app identified by the path package name. + + When clearData is set + in the request body, the app's data is also cleared. Protected packages cannot + be stopped. + + Args: + clear_data: If true, clears all app data (pm clear) in addition to stopping the app. + + 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._patch( + path_template("/devices/{device_id}/apps/{package_name}", device_id=device_id, package_name=package_name), + body=await async_maybe_transform({"clear_data": clear_data}, app_stop_params.AppStopParams), + 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, + ) + self.stop = to_raw_response_wrapper( + apps.stop, + ) + + +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, + ) + self.stop = async_to_raw_response_wrapper( + apps.stop, + ) + + +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, + ) + self.stop = to_streamed_response_wrapper( + apps.stop, + ) + + +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, + ) + self.stop = async_to_streamed_response_wrapper( + apps.stop, + ) diff --git a/src/mobilerun_sdk/resources/devices/devices.py b/src/mobilerun_sdk/resources/devices/devices.py new file mode 100644 index 0000000..13a44ce --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/devices.py @@ -0,0 +1,1523 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) +from .esim import ( + EsimResource, + AsyncEsimResource, + EsimResourceWithRawResponse, + AsyncEsimResourceWithRawResponse, + EsimResourceWithStreamingResponse, + AsyncEsimResourceWithStreamingResponse, +) +from .files import ( + FilesResource, + AsyncFilesResource, + FilesResourceWithRawResponse, + AsyncFilesResourceWithRawResponse, + FilesResourceWithStreamingResponse, + AsyncFilesResourceWithStreamingResponse, +) +from .proxy import ( + ProxyResource, + AsyncProxyResource, + ProxyResourceWithRawResponse, + AsyncProxyResourceWithRawResponse, + ProxyResourceWithStreamingResponse, + AsyncProxyResourceWithStreamingResponse, +) +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, device_set_name_params, device_terminate_params +from .actions import ( + ActionsResource, + AsyncActionsResource, + ActionsResourceWithRawResponse, + AsyncActionsResourceWithRawResponse, + ActionsResourceWithStreamingResponse, + AsyncActionsResourceWithStreamingResponse, +) +from .profile import ( + ProfileResource, + AsyncProfileResource, + ProfileResourceWithRawResponse, + AsyncProfileResourceWithRawResponse, + ProfileResourceWithStreamingResponse, + AsyncProfileResourceWithStreamingResponse, +) +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import is_given, path_template, maybe_transform, strip_not_given, async_maybe_transform +from .keyboard import ( + KeyboardResource, + AsyncKeyboardResource, + KeyboardResourceWithRawResponse, + AsyncKeyboardResourceWithRawResponse, + KeyboardResourceWithStreamingResponse, + AsyncKeyboardResourceWithStreamingResponse, +) +from .language import ( + LanguageResource, + AsyncLanguageResource, + LanguageResourceWithRawResponse, + AsyncLanguageResourceWithRawResponse, + LanguageResourceWithStreamingResponse, + AsyncLanguageResourceWithStreamingResponse, +) +from .location import ( + LocationResource, + AsyncLocationResource, + LocationResourceWithRawResponse, + AsyncLocationResourceWithRawResponse, + LocationResourceWithStreamingResponse, + AsyncLocationResourceWithStreamingResponse, +) +from .packages import ( + PackagesResource, + AsyncPackagesResource, + PackagesResourceWithRawResponse, + AsyncPackagesResourceWithRawResponse, + PackagesResourceWithStreamingResponse, + AsyncPackagesResourceWithStreamingResponse, +) +from .timezone import ( + TimezoneResource, + AsyncTimezoneResource, + TimezoneResourceWithRawResponse, + AsyncTimezoneResourceWithRawResponse, + TimezoneResourceWithStreamingResponse, + AsyncTimezoneResourceWithStreamingResponse, +) +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 +from ...types.shared_params.location import Location +from ...types.device_fingerprint_response import DeviceFingerprintResponse +from ...types.shared_params.device_carrier import DeviceCarrier +from ...types.shared_params.device_identifiers import DeviceIdentifiers + +__all__ = ["DevicesResource", "AsyncDevicesResource"] + + +class DevicesResource(SyncAPIResource): + @cached_property + def actions(self) -> ActionsResource: + return ActionsResource(self._client) + + @cached_property + def apps(self) -> AppsResource: + return AppsResource(self._client) + + @cached_property + def esim(self) -> EsimResource: + return EsimResource(self._client) + + @cached_property + def files(self) -> FilesResource: + return FilesResource(self._client) + + @cached_property + def keyboard(self) -> KeyboardResource: + return KeyboardResource(self._client) + + @cached_property + def location(self) -> LocationResource: + return LocationResource(self._client) + + @cached_property + def packages(self) -> PackagesResource: + return PackagesResource(self._client) + + @cached_property + def profile(self) -> ProfileResource: + return ProfileResource(self._client) + + @cached_property + def proxy(self) -> ProxyResource: + return ProxyResource(self._client) + + @cached_property + def state(self) -> StateResource: + return StateResource(self._client) + + @cached_property + def tasks(self) -> TasksResource: + return TasksResource(self._client) + + @cached_property + def timezone(self) -> TimezoneResource: + return TimezoneResource(self._client) + + @cached_property + def language(self) -> LanguageResource: + return LanguageResource(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, + *, + billing: Literal["auto", "subscription", "minute"] | Omit = omit, + query_country: str | Omit = omit, + device_type: Literal[ + "dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device", "dedicated_emulated_device" + ] + | Omit = omit, + profile_id: str | Omit = omit, + android_version: int | Omit = omit, + apps: Optional[SequenceNotStr[str]] | Omit = omit, + carrier: DeviceCarrier | Omit = omit, + body_country: str | Omit = omit, + files: Optional[SequenceNotStr[str]] | Omit = omit, + identifiers: DeviceIdentifiers | Omit = omit, + locale: str | Omit = omit, + location: Location | Omit = omit, + name: str | Omit = omit, + proxy: device_create_params.Proxy | Omit = omit, + timezone: str | 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: + """ + Requests a new device for the authenticated user from the device spec in the + request body. Optional query parameters select the device type, target country, + billing mode, and a profile to use as the base spec; the response returns the + device and its stream token. + + Args: + billing: Billing mode. 'auto' uses a subscription slot when available and otherwise bills + per minute; 'subscription' requires an available subscription slot; 'minute' + bills per minute. Only cloud phone and cloud emulator devices support per-minute + billing. + + query_country: ISO 3166-1 alpha-2 country code. If omitted the system picks the country with + the most availability. + + profile_id: Profile ID to use as device spec + + 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( + { + "android_version": android_version, + "apps": apps, + "carrier": carrier, + "body_country": body_country, + "files": files, + "identifiers": identifiers, + "locale": locale, + "location": location, + "name": name, + "proxy": proxy, + "timezone": timezone, + }, + 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( + { + "billing": billing, + "query_country": query_country, + "device_type": device_type, + "profile_id": profile_id, + }, + 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: + """ + Returns the current state and metadata for a single device, including its + lifecycle state, type, stream URL, billing strategy, and timestamps. A stream + token is included while the device is active. + + 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( + path_template("/devices/{device_id}", device_id=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_id: str | Omit = omit, + state: Optional[ + List[ + Literal[ + "creating", + "assigned", + "ready", + "rebooting", + "migrating", + "resetting", + "terminated", + "maintenance", + "unknown", + ] + ] + ] + | Omit = omit, + type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_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: + """ + Returns a paginated list of the user's devices along with pagination metadata. + + 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_id": provider_id, + "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: + """Returns the number of claimed devices for the user, broken down by device type.""" + 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 fingerprint( + 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, + ) -> DeviceFingerprintResponse: + """ + Returns a live snapshot of the device's spoofed identity, including model, + display, identifiers, and carrier. Devices without fingerprint support return an + unsupported-feature error. + + 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( + path_template("/devices/{device_id}/fingerprint", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeviceFingerprintResponse, + ) + + def reboot( + 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: + """Triggers a reboot of the device. + + The device transitions through its reboot + lifecycle and becomes ready again once the restart completes. + + 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._post( + path_template("/devices/{device_id}/reboot", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def reset( + 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: + """ + Resets the device back to a clean state, clearing installed apps and user data + accumulated during the session. The device transitions through its reset + lifecycle before becoming ready again. + + 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._post( + path_template("/devices/{device_id}/reset", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def set_name( + self, + device_id: str, + *, + name: 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: + """ + Sets the display name for a device from the name in the request body and returns + the updated 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._put( + path_template("/devices/{device_id}/name", device_id=device_id), + body=maybe_transform({"name": name}, device_set_name_params.DeviceSetNameParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Device, + ) + + def terminate( + self, + device_id: str, + *, + previous_device_id: str | Omit = omit, + terminate_at: Union[str, datetime] | 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: + """Terminates the device and releases its resources. + + Termination can be scheduled + for a future time or chained from a previous device via the request body, in + which case a service key is required. + + 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( + path_template("/devices/{device_id}", device_id=device_id), + body=maybe_transform( + { + "previous_device_id": previous_device_id, + "terminate_at": terminate_at, + }, + device_terminate_params.DeviceTerminateParams, + ), + 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: + """ + Blocks until the device reaches the ready state, then returns the same payload + as Get device info. The call returns early with an error if the wait is + cancelled or times out. + + 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( + path_template("/devices/{device_id}/wait", device_id=device_id), + 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 apps(self) -> AsyncAppsResource: + return AsyncAppsResource(self._client) + + @cached_property + def esim(self) -> AsyncEsimResource: + return AsyncEsimResource(self._client) + + @cached_property + def files(self) -> AsyncFilesResource: + return AsyncFilesResource(self._client) + + @cached_property + def keyboard(self) -> AsyncKeyboardResource: + return AsyncKeyboardResource(self._client) + + @cached_property + def location(self) -> AsyncLocationResource: + return AsyncLocationResource(self._client) + + @cached_property + def packages(self) -> AsyncPackagesResource: + return AsyncPackagesResource(self._client) + + @cached_property + def profile(self) -> AsyncProfileResource: + return AsyncProfileResource(self._client) + + @cached_property + def proxy(self) -> AsyncProxyResource: + return AsyncProxyResource(self._client) + + @cached_property + def state(self) -> AsyncStateResource: + return AsyncStateResource(self._client) + + @cached_property + def tasks(self) -> AsyncTasksResource: + return AsyncTasksResource(self._client) + + @cached_property + def timezone(self) -> AsyncTimezoneResource: + return AsyncTimezoneResource(self._client) + + @cached_property + def language(self) -> AsyncLanguageResource: + return AsyncLanguageResource(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, + *, + billing: Literal["auto", "subscription", "minute"] | Omit = omit, + query_country: str | Omit = omit, + device_type: Literal[ + "dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device", "dedicated_emulated_device" + ] + | Omit = omit, + profile_id: str | Omit = omit, + android_version: int | Omit = omit, + apps: Optional[SequenceNotStr[str]] | Omit = omit, + carrier: DeviceCarrier | Omit = omit, + body_country: str | Omit = omit, + files: Optional[SequenceNotStr[str]] | Omit = omit, + identifiers: DeviceIdentifiers | Omit = omit, + locale: str | Omit = omit, + location: Location | Omit = omit, + name: str | Omit = omit, + proxy: device_create_params.Proxy | Omit = omit, + timezone: str | 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: + """ + Requests a new device for the authenticated user from the device spec in the + request body. Optional query parameters select the device type, target country, + billing mode, and a profile to use as the base spec; the response returns the + device and its stream token. + + Args: + billing: Billing mode. 'auto' uses a subscription slot when available and otherwise bills + per minute; 'subscription' requires an available subscription slot; 'minute' + bills per minute. Only cloud phone and cloud emulator devices support per-minute + billing. + + query_country: ISO 3166-1 alpha-2 country code. If omitted the system picks the country with + the most availability. + + profile_id: Profile ID to use as device spec + + 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( + { + "android_version": android_version, + "apps": apps, + "carrier": carrier, + "body_country": body_country, + "files": files, + "identifiers": identifiers, + "locale": locale, + "location": location, + "name": name, + "proxy": proxy, + "timezone": timezone, + }, + 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( + { + "billing": billing, + "query_country": query_country, + "device_type": device_type, + "profile_id": profile_id, + }, + 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: + """ + Returns the current state and metadata for a single device, including its + lifecycle state, type, stream URL, billing strategy, and timestamps. A stream + token is included while the device is active. + + 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( + path_template("/devices/{device_id}", device_id=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_id: str | Omit = omit, + state: Optional[ + List[ + Literal[ + "creating", + "assigned", + "ready", + "rebooting", + "migrating", + "resetting", + "terminated", + "maintenance", + "unknown", + ] + ] + ] + | Omit = omit, + type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_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: + """ + Returns a paginated list of the user's devices along with pagination metadata. + + 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_id": provider_id, + "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: + """Returns the number of claimed devices for the user, broken down by device type.""" + 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 fingerprint( + 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, + ) -> DeviceFingerprintResponse: + """ + Returns a live snapshot of the device's spoofed identity, including model, + display, identifiers, and carrier. Devices without fingerprint support return an + unsupported-feature error. + + 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( + path_template("/devices/{device_id}/fingerprint", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DeviceFingerprintResponse, + ) + + async def reboot( + 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: + """Triggers a reboot of the device. + + The device transitions through its reboot + lifecycle and becomes ready again once the restart completes. + + 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._post( + path_template("/devices/{device_id}/reboot", device_id=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 reset( + 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: + """ + Resets the device back to a clean state, clearing installed apps and user data + accumulated during the session. The device transitions through its reset + lifecycle before becoming ready again. + + 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._post( + path_template("/devices/{device_id}/reset", device_id=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 set_name( + self, + device_id: str, + *, + name: 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: + """ + Sets the display name for a device from the name in the request body and returns + the updated 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._put( + path_template("/devices/{device_id}/name", device_id=device_id), + body=await async_maybe_transform({"name": name}, device_set_name_params.DeviceSetNameParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Device, + ) + + async def terminate( + self, + device_id: str, + *, + previous_device_id: str | Omit = omit, + terminate_at: Union[str, datetime] | 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: + """Terminates the device and releases its resources. + + Termination can be scheduled + for a future time or chained from a previous device via the request body, in + which case a service key is required. + + 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( + path_template("/devices/{device_id}", device_id=device_id), + body=await async_maybe_transform( + { + "previous_device_id": previous_device_id, + "terminate_at": terminate_at, + }, + device_terminate_params.DeviceTerminateParams, + ), + 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: + """ + Blocks until the device reaches the ready state, then returns the same payload + as Get device info. The call returns early with an error if the wait is + cancelled or times out. + + 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( + path_template("/devices/{device_id}/wait", device_id=device_id), + 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.fingerprint = to_raw_response_wrapper( + devices.fingerprint, + ) + self.reboot = to_raw_response_wrapper( + devices.reboot, + ) + self.reset = to_raw_response_wrapper( + devices.reset, + ) + self.set_name = to_raw_response_wrapper( + devices.set_name, + ) + 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 apps(self) -> AppsResourceWithRawResponse: + return AppsResourceWithRawResponse(self._devices.apps) + + @cached_property + def esim(self) -> EsimResourceWithRawResponse: + return EsimResourceWithRawResponse(self._devices.esim) + + @cached_property + def files(self) -> FilesResourceWithRawResponse: + return FilesResourceWithRawResponse(self._devices.files) + + @cached_property + def keyboard(self) -> KeyboardResourceWithRawResponse: + return KeyboardResourceWithRawResponse(self._devices.keyboard) + + @cached_property + def location(self) -> LocationResourceWithRawResponse: + return LocationResourceWithRawResponse(self._devices.location) + + @cached_property + def packages(self) -> PackagesResourceWithRawResponse: + return PackagesResourceWithRawResponse(self._devices.packages) + + @cached_property + def profile(self) -> ProfileResourceWithRawResponse: + return ProfileResourceWithRawResponse(self._devices.profile) + + @cached_property + def proxy(self) -> ProxyResourceWithRawResponse: + return ProxyResourceWithRawResponse(self._devices.proxy) + + @cached_property + def state(self) -> StateResourceWithRawResponse: + return StateResourceWithRawResponse(self._devices.state) + + @cached_property + def tasks(self) -> TasksResourceWithRawResponse: + return TasksResourceWithRawResponse(self._devices.tasks) + + @cached_property + def timezone(self) -> TimezoneResourceWithRawResponse: + return TimezoneResourceWithRawResponse(self._devices.timezone) + + @cached_property + def language(self) -> LanguageResourceWithRawResponse: + return LanguageResourceWithRawResponse(self._devices.language) + + +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.fingerprint = async_to_raw_response_wrapper( + devices.fingerprint, + ) + self.reboot = async_to_raw_response_wrapper( + devices.reboot, + ) + self.reset = async_to_raw_response_wrapper( + devices.reset, + ) + self.set_name = async_to_raw_response_wrapper( + devices.set_name, + ) + 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 apps(self) -> AsyncAppsResourceWithRawResponse: + return AsyncAppsResourceWithRawResponse(self._devices.apps) + + @cached_property + def esim(self) -> AsyncEsimResourceWithRawResponse: + return AsyncEsimResourceWithRawResponse(self._devices.esim) + + @cached_property + def files(self) -> AsyncFilesResourceWithRawResponse: + return AsyncFilesResourceWithRawResponse(self._devices.files) + + @cached_property + def keyboard(self) -> AsyncKeyboardResourceWithRawResponse: + return AsyncKeyboardResourceWithRawResponse(self._devices.keyboard) + + @cached_property + def location(self) -> AsyncLocationResourceWithRawResponse: + return AsyncLocationResourceWithRawResponse(self._devices.location) + + @cached_property + def packages(self) -> AsyncPackagesResourceWithRawResponse: + return AsyncPackagesResourceWithRawResponse(self._devices.packages) + + @cached_property + def profile(self) -> AsyncProfileResourceWithRawResponse: + return AsyncProfileResourceWithRawResponse(self._devices.profile) + + @cached_property + def proxy(self) -> AsyncProxyResourceWithRawResponse: + return AsyncProxyResourceWithRawResponse(self._devices.proxy) + + @cached_property + def state(self) -> AsyncStateResourceWithRawResponse: + return AsyncStateResourceWithRawResponse(self._devices.state) + + @cached_property + def tasks(self) -> AsyncTasksResourceWithRawResponse: + return AsyncTasksResourceWithRawResponse(self._devices.tasks) + + @cached_property + def timezone(self) -> AsyncTimezoneResourceWithRawResponse: + return AsyncTimezoneResourceWithRawResponse(self._devices.timezone) + + @cached_property + def language(self) -> AsyncLanguageResourceWithRawResponse: + return AsyncLanguageResourceWithRawResponse(self._devices.language) + + +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.fingerprint = to_streamed_response_wrapper( + devices.fingerprint, + ) + self.reboot = to_streamed_response_wrapper( + devices.reboot, + ) + self.reset = to_streamed_response_wrapper( + devices.reset, + ) + self.set_name = to_streamed_response_wrapper( + devices.set_name, + ) + 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 apps(self) -> AppsResourceWithStreamingResponse: + return AppsResourceWithStreamingResponse(self._devices.apps) + + @cached_property + def esim(self) -> EsimResourceWithStreamingResponse: + return EsimResourceWithStreamingResponse(self._devices.esim) + + @cached_property + def files(self) -> FilesResourceWithStreamingResponse: + return FilesResourceWithStreamingResponse(self._devices.files) + + @cached_property + def keyboard(self) -> KeyboardResourceWithStreamingResponse: + return KeyboardResourceWithStreamingResponse(self._devices.keyboard) + + @cached_property + def location(self) -> LocationResourceWithStreamingResponse: + return LocationResourceWithStreamingResponse(self._devices.location) + + @cached_property + def packages(self) -> PackagesResourceWithStreamingResponse: + return PackagesResourceWithStreamingResponse(self._devices.packages) + + @cached_property + def profile(self) -> ProfileResourceWithStreamingResponse: + return ProfileResourceWithStreamingResponse(self._devices.profile) + + @cached_property + def proxy(self) -> ProxyResourceWithStreamingResponse: + return ProxyResourceWithStreamingResponse(self._devices.proxy) + + @cached_property + def state(self) -> StateResourceWithStreamingResponse: + return StateResourceWithStreamingResponse(self._devices.state) + + @cached_property + def tasks(self) -> TasksResourceWithStreamingResponse: + return TasksResourceWithStreamingResponse(self._devices.tasks) + + @cached_property + def timezone(self) -> TimezoneResourceWithStreamingResponse: + return TimezoneResourceWithStreamingResponse(self._devices.timezone) + + @cached_property + def language(self) -> LanguageResourceWithStreamingResponse: + return LanguageResourceWithStreamingResponse(self._devices.language) + + +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.fingerprint = async_to_streamed_response_wrapper( + devices.fingerprint, + ) + self.reboot = async_to_streamed_response_wrapper( + devices.reboot, + ) + self.reset = async_to_streamed_response_wrapper( + devices.reset, + ) + self.set_name = async_to_streamed_response_wrapper( + devices.set_name, + ) + 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 apps(self) -> AsyncAppsResourceWithStreamingResponse: + return AsyncAppsResourceWithStreamingResponse(self._devices.apps) + + @cached_property + def esim(self) -> AsyncEsimResourceWithStreamingResponse: + return AsyncEsimResourceWithStreamingResponse(self._devices.esim) + + @cached_property + def files(self) -> AsyncFilesResourceWithStreamingResponse: + return AsyncFilesResourceWithStreamingResponse(self._devices.files) + + @cached_property + def keyboard(self) -> AsyncKeyboardResourceWithStreamingResponse: + return AsyncKeyboardResourceWithStreamingResponse(self._devices.keyboard) + + @cached_property + def location(self) -> AsyncLocationResourceWithStreamingResponse: + return AsyncLocationResourceWithStreamingResponse(self._devices.location) + + @cached_property + def packages(self) -> AsyncPackagesResourceWithStreamingResponse: + return AsyncPackagesResourceWithStreamingResponse(self._devices.packages) + + @cached_property + def profile(self) -> AsyncProfileResourceWithStreamingResponse: + return AsyncProfileResourceWithStreamingResponse(self._devices.profile) + + @cached_property + def proxy(self) -> AsyncProxyResourceWithStreamingResponse: + return AsyncProxyResourceWithStreamingResponse(self._devices.proxy) + + @cached_property + def state(self) -> AsyncStateResourceWithStreamingResponse: + return AsyncStateResourceWithStreamingResponse(self._devices.state) + + @cached_property + def tasks(self) -> AsyncTasksResourceWithStreamingResponse: + return AsyncTasksResourceWithStreamingResponse(self._devices.tasks) + + @cached_property + def timezone(self) -> AsyncTimezoneResourceWithStreamingResponse: + return AsyncTimezoneResourceWithStreamingResponse(self._devices.timezone) + + @cached_property + def language(self) -> AsyncLanguageResourceWithStreamingResponse: + return AsyncLanguageResourceWithStreamingResponse(self._devices.language) diff --git a/src/mobilerun_sdk/resources/devices/esim.py b/src/mobilerun_sdk/resources/devices/esim.py new file mode 100644 index 0000000..06abb25 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/esim.py @@ -0,0 +1,514 @@ +# 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, path_template, 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 esim_enable_params, esim_remove_params, esim_activate_params +from ...types.devices.esim_list_response import EsimListResponse +from ...types.devices.esim_activate_response import EsimActivateResponse + +__all__ = ["EsimResource", "AsyncEsimResource"] + + +class EsimResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EsimResourceWithRawResponse: + """ + 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 EsimResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EsimResourceWithStreamingResponse: + """ + 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 EsimResourceWithStreamingResponse(self) + + def list( + 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, + ) -> Optional[EsimListResponse]: + """ + Returns the eSIM subscriptions currently provisioned on the 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 = { + **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( + path_template("/devices/{device_id}/esim", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EsimListResponse, + ) + + def activate( + self, + device_id: str, + *, + enable: bool, + sm_dp_addr: str, + confirmation_code: str | Omit = omit, + matching_id: 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, + ) -> EsimActivateResponse: + """ + Download profile and/or enable subscription. + + Args: + confirmation_code: Optional carrier-issued confirmation code (the 4th LPA segment). Required only + for plans whose SM-DP+ challenges the device for one. Requires matchingId — the + LPA spec only interprets segment 4 when segment 3 is present. + + 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._post( + path_template("/devices/{device_id}/esim", device_id=device_id), + body=maybe_transform( + { + "enable": enable, + "sm_dp_addr": sm_dp_addr, + "confirmation_code": confirmation_code, + "matching_id": matching_id, + }, + esim_activate_params.EsimActivateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EsimActivateResponse, + ) + + def enable( + self, + device_id: str, + *, + sub_id: 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: + """ + Enables the eSIM subscription identified by the subId in the request body so it + becomes the active subscription. + + 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( + path_template("/devices/{device_id}/esim", device_id=device_id), + body=maybe_transform({"sub_id": sub_id}, esim_enable_params.EsimEnableParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def remove( + self, + device_id: str, + *, + sub_id: 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: + """ + Deletes the eSIM subscription identified by the subId query parameter from the + 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 {})} + 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( + path_template("/devices/{device_id}/esim", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"sub_id": sub_id}, esim_remove_params.EsimRemoveParams), + ), + cast_to=NoneType, + ) + + +class AsyncEsimResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEsimResourceWithRawResponse: + """ + 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 AsyncEsimResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEsimResourceWithStreamingResponse: + """ + 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 AsyncEsimResourceWithStreamingResponse(self) + + async def list( + 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, + ) -> Optional[EsimListResponse]: + """ + Returns the eSIM subscriptions currently provisioned on the 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 = { + **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( + path_template("/devices/{device_id}/esim", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EsimListResponse, + ) + + async def activate( + self, + device_id: str, + *, + enable: bool, + sm_dp_addr: str, + confirmation_code: str | Omit = omit, + matching_id: 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, + ) -> EsimActivateResponse: + """ + Download profile and/or enable subscription. + + Args: + confirmation_code: Optional carrier-issued confirmation code (the 4th LPA segment). Required only + for plans whose SM-DP+ challenges the device for one. Requires matchingId — the + LPA spec only interprets segment 4 when segment 3 is present. + + 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._post( + path_template("/devices/{device_id}/esim", device_id=device_id), + body=await async_maybe_transform( + { + "enable": enable, + "sm_dp_addr": sm_dp_addr, + "confirmation_code": confirmation_code, + "matching_id": matching_id, + }, + esim_activate_params.EsimActivateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EsimActivateResponse, + ) + + async def enable( + self, + device_id: str, + *, + sub_id: 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: + """ + Enables the eSIM subscription identified by the subId in the request body so it + becomes the active subscription. + + 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( + path_template("/devices/{device_id}/esim", device_id=device_id), + body=await async_maybe_transform({"sub_id": sub_id}, esim_enable_params.EsimEnableParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def remove( + self, + device_id: str, + *, + sub_id: 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: + """ + Deletes the eSIM subscription identified by the subId query parameter from the + 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 {})} + 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( + path_template("/devices/{device_id}/esim", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"sub_id": sub_id}, esim_remove_params.EsimRemoveParams), + ), + cast_to=NoneType, + ) + + +class EsimResourceWithRawResponse: + def __init__(self, esim: EsimResource) -> None: + self._esim = esim + + self.list = to_raw_response_wrapper( + esim.list, + ) + self.activate = to_raw_response_wrapper( + esim.activate, + ) + self.enable = to_raw_response_wrapper( + esim.enable, + ) + self.remove = to_raw_response_wrapper( + esim.remove, + ) + + +class AsyncEsimResourceWithRawResponse: + def __init__(self, esim: AsyncEsimResource) -> None: + self._esim = esim + + self.list = async_to_raw_response_wrapper( + esim.list, + ) + self.activate = async_to_raw_response_wrapper( + esim.activate, + ) + self.enable = async_to_raw_response_wrapper( + esim.enable, + ) + self.remove = async_to_raw_response_wrapper( + esim.remove, + ) + + +class EsimResourceWithStreamingResponse: + def __init__(self, esim: EsimResource) -> None: + self._esim = esim + + self.list = to_streamed_response_wrapper( + esim.list, + ) + self.activate = to_streamed_response_wrapper( + esim.activate, + ) + self.enable = to_streamed_response_wrapper( + esim.enable, + ) + self.remove = to_streamed_response_wrapper( + esim.remove, + ) + + +class AsyncEsimResourceWithStreamingResponse: + def __init__(self, esim: AsyncEsimResource) -> None: + self._esim = esim + + self.list = async_to_streamed_response_wrapper( + esim.list, + ) + self.activate = async_to_streamed_response_wrapper( + esim.activate, + ) + self.enable = async_to_streamed_response_wrapper( + esim.enable, + ) + self.remove = async_to_streamed_response_wrapper( + esim.remove, + ) diff --git a/src/mobilerun_sdk/resources/devices/files.py b/src/mobilerun_sdk/resources/devices/files.py new file mode 100644 index 0000000..d39f4a3 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/files.py @@ -0,0 +1,526 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Mapping, cast + +import httpx + +from ..._files import deepcopy_with_paths +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes, omit, not_given +from ..._utils import is_given, extract_files, path_template, 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 file_list_params, file_delete_params, file_upload_params, file_download_params +from ...types.devices.file_list_response import FileListResponse + +__all__ = ["FilesResource", "AsyncFilesResource"] + + +class FilesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FilesResourceWithRawResponse: + """ + 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 FilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FilesResourceWithStreamingResponse: + """ + 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 FilesResourceWithStreamingResponse(self) + + def list( + self, + device_id: str, + *, + path: 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, + ) -> FileListResponse: + """ + Lists the files at the directory path given in the path query parameter, + returning each entry's metadata along with the path and total count. + + 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( + path_template("/devices/{device_id}/files", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"path": path}, file_list_params.FileListParams), + ), + cast_to=FileListResponse, + ) + + def delete( + self, + device_id: str, + *, + path: 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: + """ + Deletes the file at the path given in the path query parameter from the 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 {})} + 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( + path_template("/devices/{device_id}/files", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"path": path}, file_delete_params.FileDeleteParams), + ), + cast_to=NoneType, + ) + + def download( + self, + device_id: str, + *, + path: 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: + """ + Pulls the file at the given path query parameter from the device and returns its + raw bytes as an octet-stream. + + 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( + path_template("/devices/{device_id}/files/download", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"path": path}, file_download_params.FileDownloadParams), + ), + cast_to=str, + ) + + def upload( + self, + device_id: str, + *, + path: str, + file: FileTypes, + 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: + """ + Uploads a file to the device via multipart form data, writing it into the + directory given by the path query parameter using the uploaded file's name. + + 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 {}), + } + body = deepcopy_with_paths({"file": file}, [["file"]]) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers["Content-Type"] = "multipart/form-data" + return self._post( + path_template("/devices/{device_id}/files", device_id=device_id), + body=maybe_transform(body, file_upload_params.FileUploadParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"path": path}, file_upload_params.FileUploadParams), + ), + cast_to=NoneType, + ) + + +class AsyncFilesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: + """ + 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 AsyncFilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: + """ + 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 AsyncFilesResourceWithStreamingResponse(self) + + async def list( + self, + device_id: str, + *, + path: 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, + ) -> FileListResponse: + """ + Lists the files at the directory path given in the path query parameter, + returning each entry's metadata along with the path and total count. + + 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( + path_template("/devices/{device_id}/files", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"path": path}, file_list_params.FileListParams), + ), + cast_to=FileListResponse, + ) + + async def delete( + self, + device_id: str, + *, + path: 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: + """ + Deletes the file at the path given in the path query parameter from the 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 {})} + 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( + path_template("/devices/{device_id}/files", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"path": path}, file_delete_params.FileDeleteParams), + ), + cast_to=NoneType, + ) + + async def download( + self, + device_id: str, + *, + path: 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: + """ + Pulls the file at the given path query parameter from the device and returns its + raw bytes as an octet-stream. + + 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( + path_template("/devices/{device_id}/files/download", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"path": path}, file_download_params.FileDownloadParams), + ), + cast_to=str, + ) + + async def upload( + self, + device_id: str, + *, + path: str, + file: FileTypes, + 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: + """ + Uploads a file to the device via multipart form data, writing it into the + directory given by the path query parameter using the uploaded file's name. + + 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 {}), + } + body = deepcopy_with_paths({"file": file}, [["file"]]) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers["Content-Type"] = "multipart/form-data" + return await self._post( + path_template("/devices/{device_id}/files", device_id=device_id), + body=await async_maybe_transform(body, file_upload_params.FileUploadParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"path": path}, file_upload_params.FileUploadParams), + ), + cast_to=NoneType, + ) + + +class FilesResourceWithRawResponse: + def __init__(self, files: FilesResource) -> None: + self._files = files + + self.list = to_raw_response_wrapper( + files.list, + ) + self.delete = to_raw_response_wrapper( + files.delete, + ) + self.download = to_raw_response_wrapper( + files.download, + ) + self.upload = to_raw_response_wrapper( + files.upload, + ) + + +class AsyncFilesResourceWithRawResponse: + def __init__(self, files: AsyncFilesResource) -> None: + self._files = files + + self.list = async_to_raw_response_wrapper( + files.list, + ) + self.delete = async_to_raw_response_wrapper( + files.delete, + ) + self.download = async_to_raw_response_wrapper( + files.download, + ) + self.upload = async_to_raw_response_wrapper( + files.upload, + ) + + +class FilesResourceWithStreamingResponse: + def __init__(self, files: FilesResource) -> None: + self._files = files + + self.list = to_streamed_response_wrapper( + files.list, + ) + self.delete = to_streamed_response_wrapper( + files.delete, + ) + self.download = to_streamed_response_wrapper( + files.download, + ) + self.upload = to_streamed_response_wrapper( + files.upload, + ) + + +class AsyncFilesResourceWithStreamingResponse: + def __init__(self, files: AsyncFilesResource) -> None: + self._files = files + + self.list = async_to_streamed_response_wrapper( + files.list, + ) + self.delete = async_to_streamed_response_wrapper( + files.delete, + ) + self.download = async_to_streamed_response_wrapper( + files.download, + ) + self.upload = async_to_streamed_response_wrapper( + files.upload, + ) diff --git a/src/mobilerun_sdk/resources/devices/keyboard.py b/src/mobilerun_sdk/resources/devices/keyboard.py new file mode 100644 index 0000000..a1bd8bb --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/keyboard.py @@ -0,0 +1,416 @@ +# 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, path_template, 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: + """ + Clears the contents of the currently focused text input field. + + 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( + path_template("/devices/{device_id}/keyboard", device_id=device_id), + 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: + """ + Sends a single Android key event to the device, identified by its key code. + + 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( + path_template("/devices/{device_id}/keyboard", device_id=device_id), + 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, + *, + text: str, + clear: bool | Omit = omit, + error_rate: float | Omit = omit, + stealth: bool | Omit = omit, + wpm: int | 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: + """Types the given text into the focused input field. + + Supports optionally clearing + the field first and a stealth mode that emulates human typing speed and error + rate on supported devices. + + Args: + error_rate: Per-character mistake rate for humantouch typing. -1 uses server default. + + wpm: Words per minute for stealth typing. 0 uses portal default. + + 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( + path_template("/devices/{device_id}/keyboard", device_id=device_id), + body=maybe_transform( + { + "text": text, + "clear": clear, + "error_rate": error_rate, + "stealth": stealth, + "wpm": wpm, + }, + 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: + """ + Clears the contents of the currently focused text input field. + + 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( + path_template("/devices/{device_id}/keyboard", device_id=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 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: + """ + Sends a single Android key event to the device, identified by its key code. + + 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( + path_template("/devices/{device_id}/keyboard", device_id=device_id), + 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, + *, + text: str, + clear: bool | Omit = omit, + error_rate: float | Omit = omit, + stealth: bool | Omit = omit, + wpm: int | 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: + """Types the given text into the focused input field. + + Supports optionally clearing + the field first and a stealth mode that emulates human typing speed and error + rate on supported devices. + + Args: + error_rate: Per-character mistake rate for humantouch typing. -1 uses server default. + + wpm: Words per minute for stealth typing. 0 uses portal default. + + 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( + path_template("/devices/{device_id}/keyboard", device_id=device_id), + body=await async_maybe_transform( + { + "text": text, + "clear": clear, + "error_rate": error_rate, + "stealth": stealth, + "wpm": wpm, + }, + 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_sdk/resources/devices/language.py b/src/mobilerun_sdk/resources/devices/language.py new file mode 100644 index 0000000..608f612 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/language.py @@ -0,0 +1,309 @@ +# 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, path_template, 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 language_set_params +from ...types.devices.language_get_response import LanguageGetResponse + +__all__ = ["LanguageResource", "AsyncLanguageResource"] + + +class LanguageResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LanguageResourceWithRawResponse: + """ + 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 LanguageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LanguageResourceWithStreamingResponse: + """ + 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 LanguageResourceWithStreamingResponse(self) + + def get( + 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, + ) -> LanguageGetResponse: + """ + Returns the device's current language/locale as a BCP-47 locale string. + + 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( + path_template("/devices/{device_id}/language", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LanguageGetResponse, + ) + + def set( + self, + device_id: str, + *, + locale: str, + restart: 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, + ) -> None: + """Sets the device language/locale to the BCP-47 locale in the request body. + + An + optional restart flag applies the change immediately by restarting the zygote + instead of waiting for the next reboot. + + Args: + locale: BCP-47 locale: a 2–3 letter language tag, optionally followed by a 4-letter + script and/or a 2-letter region (e.g. en-US, de-DE, ja-JP, zh-Hans-CN). + + restart: Restart zygote so the locale change takes full effect immediately. Without it, + the locale is written but won't fully apply until the next reboot. + + 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( + path_template("/devices/{device_id}/language", device_id=device_id), + body=maybe_transform( + { + "locale": locale, + "restart": restart, + }, + language_set_params.LanguageSetParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncLanguageResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLanguageResourceWithRawResponse: + """ + 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 AsyncLanguageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLanguageResourceWithStreamingResponse: + """ + 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 AsyncLanguageResourceWithStreamingResponse(self) + + async def get( + 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, + ) -> LanguageGetResponse: + """ + Returns the device's current language/locale as a BCP-47 locale string. + + 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( + path_template("/devices/{device_id}/language", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LanguageGetResponse, + ) + + async def set( + self, + device_id: str, + *, + locale: str, + restart: 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, + ) -> None: + """Sets the device language/locale to the BCP-47 locale in the request body. + + An + optional restart flag applies the change immediately by restarting the zygote + instead of waiting for the next reboot. + + Args: + locale: BCP-47 locale: a 2–3 letter language tag, optionally followed by a 4-letter + script and/or a 2-letter region (e.g. en-US, de-DE, ja-JP, zh-Hans-CN). + + restart: Restart zygote so the locale change takes full effect immediately. Without it, + the locale is written but won't fully apply until the next reboot. + + 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( + path_template("/devices/{device_id}/language", device_id=device_id), + body=await async_maybe_transform( + { + "locale": locale, + "restart": restart, + }, + language_set_params.LanguageSetParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class LanguageResourceWithRawResponse: + def __init__(self, language: LanguageResource) -> None: + self._language = language + + self.get = to_raw_response_wrapper( + language.get, + ) + self.set = to_raw_response_wrapper( + language.set, + ) + + +class AsyncLanguageResourceWithRawResponse: + def __init__(self, language: AsyncLanguageResource) -> None: + self._language = language + + self.get = async_to_raw_response_wrapper( + language.get, + ) + self.set = async_to_raw_response_wrapper( + language.set, + ) + + +class LanguageResourceWithStreamingResponse: + def __init__(self, language: LanguageResource) -> None: + self._language = language + + self.get = to_streamed_response_wrapper( + language.get, + ) + self.set = to_streamed_response_wrapper( + language.set, + ) + + +class AsyncLanguageResourceWithStreamingResponse: + def __init__(self, language: AsyncLanguageResource) -> None: + self._language = language + + self.get = async_to_streamed_response_wrapper( + language.get, + ) + self.set = async_to_streamed_response_wrapper( + language.set, + ) diff --git a/src/mobilerun_sdk/resources/devices/location.py b/src/mobilerun_sdk/resources/devices/location.py new file mode 100644 index 0000000..1316b3f --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/location.py @@ -0,0 +1,295 @@ +# 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, path_template, 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 location_set_params +from ...types.shared.location import Location + +__all__ = ["LocationResource", "AsyncLocationResource"] + + +class LocationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LocationResourceWithRawResponse: + """ + 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 LocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LocationResourceWithStreamingResponse: + """ + 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 LocationResourceWithStreamingResponse(self) + + def get( + 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, + ) -> Location: + """ + Returns the device's current simulated GPS location as latitude and longitude. + Devices without geo support return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/location", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Location, + ) + + def set( + self, + device_id: str, + *, + latitude: float, + longitude: float, + 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: + """ + Sets the device's simulated GPS location to the latitude and longitude in the + request body. Devices without geo support return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/location", device_id=device_id), + body=maybe_transform( + { + "latitude": latitude, + "longitude": longitude, + }, + location_set_params.LocationSetParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncLocationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLocationResourceWithRawResponse: + """ + 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 AsyncLocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLocationResourceWithStreamingResponse: + """ + 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 AsyncLocationResourceWithStreamingResponse(self) + + async def get( + 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, + ) -> Location: + """ + Returns the device's current simulated GPS location as latitude and longitude. + Devices without geo support return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/location", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Location, + ) + + async def set( + self, + device_id: str, + *, + latitude: float, + longitude: float, + 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: + """ + Sets the device's simulated GPS location to the latitude and longitude in the + request body. Devices without geo support return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/location", device_id=device_id), + body=await async_maybe_transform( + { + "latitude": latitude, + "longitude": longitude, + }, + location_set_params.LocationSetParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class LocationResourceWithRawResponse: + def __init__(self, location: LocationResource) -> None: + self._location = location + + self.get = to_raw_response_wrapper( + location.get, + ) + self.set = to_raw_response_wrapper( + location.set, + ) + + +class AsyncLocationResourceWithRawResponse: + def __init__(self, location: AsyncLocationResource) -> None: + self._location = location + + self.get = async_to_raw_response_wrapper( + location.get, + ) + self.set = async_to_raw_response_wrapper( + location.set, + ) + + +class LocationResourceWithStreamingResponse: + def __init__(self, location: LocationResource) -> None: + self._location = location + + self.get = to_streamed_response_wrapper( + location.get, + ) + self.set = to_streamed_response_wrapper( + location.set, + ) + + +class AsyncLocationResourceWithStreamingResponse: + def __init__(self, location: AsyncLocationResource) -> None: + self._location = location + + self.get = async_to_streamed_response_wrapper( + location.get, + ) + self.set = async_to_streamed_response_wrapper( + location.set, + ) diff --git a/src/mobilerun_sdk/resources/devices/packages.py b/src/mobilerun_sdk/resources/devices/packages.py new file mode 100644 index 0000000..13ff678 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/packages.py @@ -0,0 +1,209 @@ +# 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, path_template, 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_protected_packages: bool | Omit = omit, + 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]: + """Returns the package names of apps installed on the device. + + System and protected + packages are excluded unless the corresponding query parameters are set. + + 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( + path_template("/devices/{device_id}/packages", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_protected_packages": include_protected_packages, + "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_protected_packages: bool | Omit = omit, + 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]: + """Returns the package names of apps installed on the device. + + System and protected + packages are excluded unless the corresponding query parameters are set. + + 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( + path_template("/devices/{device_id}/packages", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_protected_packages": include_protected_packages, + "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_sdk/resources/devices/profile.py b/src/mobilerun_sdk/resources/devices/profile.py new file mode 100644 index 0000000..d48b092 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/profile.py @@ -0,0 +1,188 @@ +# 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, path_template, 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 profile_update_params + +__all__ = ["ProfileResource", "AsyncProfileResource"] + + +class ProfileResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ProfileResourceWithRawResponse: + """ + 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 ProfileResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProfileResourceWithStreamingResponse: + """ + 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 ProfileResourceWithStreamingResponse(self) + + def update( + self, + device_id: str, + *, + profile_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: + """ + Apply a profile to a device + + Args: + profile_id: ID of the profile to apply + + 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( + path_template("/devices/{device_id}/profile", device_id=device_id), + body=maybe_transform({"profile_id": profile_id}, profile_update_params.ProfileUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncProfileResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncProfileResourceWithRawResponse: + """ + 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 AsyncProfileResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProfileResourceWithStreamingResponse: + """ + 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 AsyncProfileResourceWithStreamingResponse(self) + + async def update( + self, + device_id: str, + *, + profile_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: + """ + Apply a profile to a device + + Args: + profile_id: ID of the profile to apply + + 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( + path_template("/devices/{device_id}/profile", device_id=device_id), + body=await async_maybe_transform({"profile_id": profile_id}, profile_update_params.ProfileUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class ProfileResourceWithRawResponse: + def __init__(self, profile: ProfileResource) -> None: + self._profile = profile + + self.update = to_raw_response_wrapper( + profile.update, + ) + + +class AsyncProfileResourceWithRawResponse: + def __init__(self, profile: AsyncProfileResource) -> None: + self._profile = profile + + self.update = async_to_raw_response_wrapper( + profile.update, + ) + + +class ProfileResourceWithStreamingResponse: + def __init__(self, profile: ProfileResource) -> None: + self._profile = profile + + self.update = to_streamed_response_wrapper( + profile.update, + ) + + +class AsyncProfileResourceWithStreamingResponse: + def __init__(self, profile: AsyncProfileResource) -> None: + self._profile = profile + + self.update = async_to_streamed_response_wrapper( + profile.update, + ) diff --git a/src/mobilerun_sdk/resources/devices/proxy.py b/src/mobilerun_sdk/resources/devices/proxy.py new file mode 100644 index 0000000..4510147 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/proxy.py @@ -0,0 +1,421 @@ +# 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, path_template, 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 proxy_connect_params +from ...types.devices.proxy_status_response import ProxyStatusResponse + +__all__ = ["ProxyResource", "AsyncProxyResource"] + + +class ProxyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ProxyResourceWithRawResponse: + """ + 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 ProxyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProxyResourceWithStreamingResponse: + """ + 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 ProxyResourceWithStreamingResponse(self) + + def connect( + self, + device_id: str, + *, + host: str | Omit = omit, + name: str | Omit = omit, + password: str | Omit = omit, + port: int | Omit = omit, + smart_ip: bool | Omit = omit, + socks5: proxy_connect_params.Socks5 | Omit = omit, + user: 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: + """ + Routes the device's traffic through a SOCKS5 proxy supplied in the request body, + replacing any existing connection. A smartIp option can be used to select an IP + automatically; the legacy flat host/port/user/password fields remain supported. + + Args: + name: Proxy name + + socks5: SOCKS5 proxy configuration (required for socks5). + + 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( + path_template("/devices/{device_id}/proxy", device_id=device_id), + body=maybe_transform( + { + "host": host, + "name": name, + "password": password, + "port": port, + "smart_ip": smart_ip, + "socks5": socks5, + "user": user, + }, + proxy_connect_params.ProxyConnectParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def disconnect( + 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: + """ + Disconnects the device's active proxy connection and clears its stored proxy + state. Returns successfully if no proxy is connected. + + 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( + path_template("/devices/{device_id}/proxy", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def status( + 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, + ) -> ProxyStatusResponse: + """ + Returns the device's current proxy connection state, including whether a proxy + is connected and its protocol and name. + + 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( + path_template("/devices/{device_id}/proxy", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProxyStatusResponse, + ) + + +class AsyncProxyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncProxyResourceWithRawResponse: + """ + 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 AsyncProxyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProxyResourceWithStreamingResponse: + """ + 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 AsyncProxyResourceWithStreamingResponse(self) + + async def connect( + self, + device_id: str, + *, + host: str | Omit = omit, + name: str | Omit = omit, + password: str | Omit = omit, + port: int | Omit = omit, + smart_ip: bool | Omit = omit, + socks5: proxy_connect_params.Socks5 | Omit = omit, + user: 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: + """ + Routes the device's traffic through a SOCKS5 proxy supplied in the request body, + replacing any existing connection. A smartIp option can be used to select an IP + automatically; the legacy flat host/port/user/password fields remain supported. + + Args: + name: Proxy name + + socks5: SOCKS5 proxy configuration (required for socks5). + + 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( + path_template("/devices/{device_id}/proxy", device_id=device_id), + body=await async_maybe_transform( + { + "host": host, + "name": name, + "password": password, + "port": port, + "smart_ip": smart_ip, + "socks5": socks5, + "user": user, + }, + proxy_connect_params.ProxyConnectParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def disconnect( + 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: + """ + Disconnects the device's active proxy connection and clears its stored proxy + state. Returns successfully if no proxy is connected. + + 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( + path_template("/devices/{device_id}/proxy", device_id=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 status( + 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, + ) -> ProxyStatusResponse: + """ + Returns the device's current proxy connection state, including whether a proxy + is connected and its protocol and name. + + 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( + path_template("/devices/{device_id}/proxy", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProxyStatusResponse, + ) + + +class ProxyResourceWithRawResponse: + def __init__(self, proxy: ProxyResource) -> None: + self._proxy = proxy + + self.connect = to_raw_response_wrapper( + proxy.connect, + ) + self.disconnect = to_raw_response_wrapper( + proxy.disconnect, + ) + self.status = to_raw_response_wrapper( + proxy.status, + ) + + +class AsyncProxyResourceWithRawResponse: + def __init__(self, proxy: AsyncProxyResource) -> None: + self._proxy = proxy + + self.connect = async_to_raw_response_wrapper( + proxy.connect, + ) + self.disconnect = async_to_raw_response_wrapper( + proxy.disconnect, + ) + self.status = async_to_raw_response_wrapper( + proxy.status, + ) + + +class ProxyResourceWithStreamingResponse: + def __init__(self, proxy: ProxyResource) -> None: + self._proxy = proxy + + self.connect = to_streamed_response_wrapper( + proxy.connect, + ) + self.disconnect = to_streamed_response_wrapper( + proxy.disconnect, + ) + self.status = to_streamed_response_wrapper( + proxy.status, + ) + + +class AsyncProxyResourceWithStreamingResponse: + def __init__(self, proxy: AsyncProxyResource) -> None: + self._proxy = proxy + + self.connect = async_to_streamed_response_wrapper( + proxy.connect, + ) + self.disconnect = async_to_streamed_response_wrapper( + proxy.disconnect, + ) + self.status = async_to_streamed_response_wrapper( + proxy.status, + ) diff --git a/src/mobilerun_sdk/resources/devices/state.py b/src/mobilerun_sdk/resources/devices/state.py new file mode 100644 index 0000000..ab30287 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/state.py @@ -0,0 +1,393 @@ +# 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, path_template, 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: + """Captures the device screen and returns it as a PNG image. + + An optional + hideOverlay query parameter excludes the accessibility overlay from the capture. + + 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( + path_template("/devices/{device_id}/screenshot", device_id=device_id), + 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: + """ + Returns the device's current wall-clock time as an RFC 3339 timestamp. + + 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( + path_template("/devices/{device_id}/time", device_id=device_id), + 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: + """ + Returns the current accessibility UI state of the device as a structured tree of + on-screen elements. An optional filter query reduces the result to interactive + elements. + + 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( + path_template("/devices/{device_id}/ui-state", device_id=device_id), + 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: + """Captures the device screen and returns it as a PNG image. + + An optional + hideOverlay query parameter excludes the accessibility overlay from the capture. + + 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( + path_template("/devices/{device_id}/screenshot", device_id=device_id), + 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: + """ + Returns the device's current wall-clock time as an RFC 3339 timestamp. + + 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( + path_template("/devices/{device_id}/time", device_id=device_id), + 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: + """ + Returns the current accessibility UI state of the device as a structured tree of + on-screen elements. An optional filter query reduces the result to interactive + elements. + + 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( + path_template("/devices/{device_id}/ui-state", device_id=device_id), + 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_sdk/resources/devices/tasks.py b/src/mobilerun_sdk/resources/devices/tasks.py new file mode 100644 index 0000000..7267e7a --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/tasks.py @@ -0,0 +1,201 @@ +# 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 path_template, 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: + """ + Returns a paginated list of tasks that have run on the device, along with + pagination metadata. + + 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( + path_template("/devices/{device_id}/tasks", device_id=device_id), + 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: + """ + Returns a paginated list of tasks that have run on the device, along with + pagination metadata. + + 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( + path_template("/devices/{device_id}/tasks", device_id=device_id), + 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_sdk/resources/devices/timezone.py b/src/mobilerun_sdk/resources/devices/timezone.py new file mode 100644 index 0000000..0ac8240 --- /dev/null +++ b/src/mobilerun_sdk/resources/devices/timezone.py @@ -0,0 +1,285 @@ +# 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, path_template, 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 timezone_set_params +from ...types.devices.timezone_get_response import TimezoneGetResponse + +__all__ = ["TimezoneResource", "AsyncTimezoneResource"] + + +class TimezoneResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TimezoneResourceWithRawResponse: + """ + 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 TimezoneResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TimezoneResourceWithStreamingResponse: + """ + 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 TimezoneResourceWithStreamingResponse(self) + + def get( + 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, + ) -> TimezoneGetResponse: + """Returns the device's current timezone identifier. + + Devices that do not support + timezone control return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/timezone", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TimezoneGetResponse, + ) + + def set( + self, + device_id: str, + *, + timezone: 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: + """Sets the device timezone to the identifier in the request body. + + Devices that do + not support timezone control return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/timezone", device_id=device_id), + body=maybe_transform({"timezone": timezone}, timezone_set_params.TimezoneSetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncTimezoneResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTimezoneResourceWithRawResponse: + """ + 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 AsyncTimezoneResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTimezoneResourceWithStreamingResponse: + """ + 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 AsyncTimezoneResourceWithStreamingResponse(self) + + async def get( + 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, + ) -> TimezoneGetResponse: + """Returns the device's current timezone identifier. + + Devices that do not support + timezone control return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/timezone", device_id=device_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TimezoneGetResponse, + ) + + async def set( + self, + device_id: str, + *, + timezone: 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: + """Sets the device timezone to the identifier in the request body. + + Devices that do + not support timezone control return an unsupported-feature error. + + 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( + path_template("/devices/{device_id}/timezone", device_id=device_id), + body=await async_maybe_transform({"timezone": timezone}, timezone_set_params.TimezoneSetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class TimezoneResourceWithRawResponse: + def __init__(self, timezone: TimezoneResource) -> None: + self._timezone = timezone + + self.get = to_raw_response_wrapper( + timezone.get, + ) + self.set = to_raw_response_wrapper( + timezone.set, + ) + + +class AsyncTimezoneResourceWithRawResponse: + def __init__(self, timezone: AsyncTimezoneResource) -> None: + self._timezone = timezone + + self.get = async_to_raw_response_wrapper( + timezone.get, + ) + self.set = async_to_raw_response_wrapper( + timezone.set, + ) + + +class TimezoneResourceWithStreamingResponse: + def __init__(self, timezone: TimezoneResource) -> None: + self._timezone = timezone + + self.get = to_streamed_response_wrapper( + timezone.get, + ) + self.set = to_streamed_response_wrapper( + timezone.set, + ) + + +class AsyncTimezoneResourceWithStreamingResponse: + def __init__(self, timezone: AsyncTimezoneResource) -> None: + self._timezone = timezone + + self.get = async_to_streamed_response_wrapper( + timezone.get, + ) + self.set = async_to_streamed_response_wrapper( + timezone.set, + ) diff --git a/src/mobilerun_sdk/resources/profiles.py b/src/mobilerun_sdk/resources/profiles.py new file mode 100644 index 0000000..5d2c498 --- /dev/null +++ b/src/mobilerun_sdk/resources/profiles.py @@ -0,0 +1,558 @@ +# 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 profile_list_params, profile_create_params, profile_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, 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.profile import Profile +from ..types.profile_list_response import ProfileListResponse +from ..types.profile_delete_response import ProfileDeleteResponse +from ..types.shared_params.device_spec import DeviceSpec + +__all__ = ["ProfilesResource", "AsyncProfilesResource"] + + +class ProfilesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ProfilesResourceWithRawResponse: + """ + 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 ProfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProfilesResourceWithStreamingResponse: + """ + 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 ProfilesResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + spec: DeviceSpec, + # 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, + ) -> Profile: + """ + Create a new device profile + + Args: + name: Profile name + + spec: Device specification + + 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( + "/profiles", + body=maybe_transform( + { + "name": name, + "spec": spec, + }, + profile_create_params.ProfileCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Profile, + ) + + def retrieve( + self, + profile_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, + ) -> Profile: + """ + Get device profile by ID + + 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 profile_id: + raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") + return self._get( + path_template("/profiles/{profile_id}", profile_id=profile_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Profile, + ) + + def update( + self, + profile_id: str, + *, + name: str, + spec: DeviceSpec, + # 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, + ) -> Profile: + """ + Update a device profile + + Args: + name: Profile name + + spec: Device specification + + 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 profile_id: + raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") + return self._put( + path_template("/profiles/{profile_id}", profile_id=profile_id), + body=maybe_transform( + { + "name": name, + "spec": spec, + }, + profile_update_params.ProfileUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Profile, + ) + + def list( + self, + *, + name: str | Omit = omit, + order_by: Literal["name", "created_at", "updated_at"] | 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, + ) -> ProfileListResponse: + """ + List device profiles + + 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( + "/profiles", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "name": name, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + }, + profile_list_params.ProfileListParams, + ), + ), + cast_to=ProfileListResponse, + ) + + def delete( + self, + profile_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, + ) -> ProfileDeleteResponse: + """ + Delete a device profile + + 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 profile_id: + raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") + return self._delete( + path_template("/profiles/{profile_id}", profile_id=profile_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProfileDeleteResponse, + ) + + +class AsyncProfilesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: + """ + 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 AsyncProfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProfilesResourceWithStreamingResponse: + """ + 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 AsyncProfilesResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + spec: DeviceSpec, + # 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, + ) -> Profile: + """ + Create a new device profile + + Args: + name: Profile name + + spec: Device specification + + 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( + "/profiles", + body=await async_maybe_transform( + { + "name": name, + "spec": spec, + }, + profile_create_params.ProfileCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Profile, + ) + + async def retrieve( + self, + profile_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, + ) -> Profile: + """ + Get device profile by ID + + 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 profile_id: + raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") + return await self._get( + path_template("/profiles/{profile_id}", profile_id=profile_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Profile, + ) + + async def update( + self, + profile_id: str, + *, + name: str, + spec: DeviceSpec, + # 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, + ) -> Profile: + """ + Update a device profile + + Args: + name: Profile name + + spec: Device specification + + 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 profile_id: + raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") + return await self._put( + path_template("/profiles/{profile_id}", profile_id=profile_id), + body=await async_maybe_transform( + { + "name": name, + "spec": spec, + }, + profile_update_params.ProfileUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Profile, + ) + + async def list( + self, + *, + name: str | Omit = omit, + order_by: Literal["name", "created_at", "updated_at"] | 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, + ) -> ProfileListResponse: + """ + List device profiles + + 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( + "/profiles", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "name": name, + "order_by": order_by, + "order_by_direction": order_by_direction, + "page": page, + "page_size": page_size, + }, + profile_list_params.ProfileListParams, + ), + ), + cast_to=ProfileListResponse, + ) + + async def delete( + self, + profile_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, + ) -> ProfileDeleteResponse: + """ + Delete a device profile + + 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 profile_id: + raise ValueError(f"Expected a non-empty value for `profile_id` but received {profile_id!r}") + return await self._delete( + path_template("/profiles/{profile_id}", profile_id=profile_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProfileDeleteResponse, + ) + + +class ProfilesResourceWithRawResponse: + def __init__(self, profiles: ProfilesResource) -> None: + self._profiles = profiles + + self.create = to_raw_response_wrapper( + profiles.create, + ) + self.retrieve = to_raw_response_wrapper( + profiles.retrieve, + ) + self.update = to_raw_response_wrapper( + profiles.update, + ) + self.list = to_raw_response_wrapper( + profiles.list, + ) + self.delete = to_raw_response_wrapper( + profiles.delete, + ) + + +class AsyncProfilesResourceWithRawResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: + self._profiles = profiles + + self.create = async_to_raw_response_wrapper( + profiles.create, + ) + self.retrieve = async_to_raw_response_wrapper( + profiles.retrieve, + ) + self.update = async_to_raw_response_wrapper( + profiles.update, + ) + self.list = async_to_raw_response_wrapper( + profiles.list, + ) + self.delete = async_to_raw_response_wrapper( + profiles.delete, + ) + + +class ProfilesResourceWithStreamingResponse: + def __init__(self, profiles: ProfilesResource) -> None: + self._profiles = profiles + + self.create = to_streamed_response_wrapper( + profiles.create, + ) + self.retrieve = to_streamed_response_wrapper( + profiles.retrieve, + ) + self.update = to_streamed_response_wrapper( + profiles.update, + ) + self.list = to_streamed_response_wrapper( + profiles.list, + ) + self.delete = to_streamed_response_wrapper( + profiles.delete, + ) + + +class AsyncProfilesResourceWithStreamingResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: + self._profiles = profiles + + self.create = async_to_streamed_response_wrapper( + profiles.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + profiles.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + profiles.update, + ) + self.list = async_to_streamed_response_wrapper( + profiles.list, + ) + self.delete = async_to_streamed_response_wrapper( + profiles.delete, + ) diff --git a/src/mobilerun_sdk/resources/proxies.py b/src/mobilerun_sdk/resources/proxies.py index eb8bcc6..45a990d 100644 --- a/src/mobilerun_sdk/resources/proxies.py +++ b/src/mobilerun_sdk/resources/proxies.py @@ -6,7 +6,7 @@ import httpx -from ..types import proxy_list_params, proxy_create_params, proxy_update_params +from ..types import proxy_list_params, proxy_create_params, proxy_lookup_params, proxy_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import path_template, required_args, maybe_transform, async_maybe_transform from .._compat import cached_property @@ -21,6 +21,7 @@ from ..types.proxy_list_response import ProxyListResponse from ..types.proxy_create_response import ProxyCreateResponse from ..types.proxy_delete_response import ProxyDeleteResponse +from ..types.proxy_lookup_response import ProxyLookupResponse from ..types.proxy_update_response import ProxyUpdateResponse from ..types.proxy_retrieve_response import ProxyRetrieveResponse @@ -367,6 +368,40 @@ def delete( cast_to=ProxyDeleteResponse, ) + def lookup( + self, + *, + socks5: proxy_lookup_params.Socks5, + # 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, + ) -> ProxyLookupResponse: + """ + Lookup proxy location + + Args: + socks5: SOCKS5 proxy configuration. + + 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( + "/proxies/lookup", + body=maybe_transform({"socks5": socks5}, proxy_lookup_params.ProxyLookupParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProxyLookupResponse, + ) + class AsyncProxiesResource(AsyncAPIResource): @cached_property @@ -708,6 +743,40 @@ async def delete( cast_to=ProxyDeleteResponse, ) + async def lookup( + self, + *, + socks5: proxy_lookup_params.Socks5, + # 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, + ) -> ProxyLookupResponse: + """ + Lookup proxy location + + Args: + socks5: SOCKS5 proxy configuration. + + 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( + "/proxies/lookup", + body=await async_maybe_transform({"socks5": socks5}, proxy_lookup_params.ProxyLookupParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProxyLookupResponse, + ) + class ProxiesResourceWithRawResponse: def __init__(self, proxies: ProxiesResource) -> None: @@ -728,6 +797,9 @@ def __init__(self, proxies: ProxiesResource) -> None: self.delete = to_raw_response_wrapper( proxies.delete, ) + self.lookup = to_raw_response_wrapper( + proxies.lookup, + ) class AsyncProxiesResourceWithRawResponse: @@ -749,6 +821,9 @@ def __init__(self, proxies: AsyncProxiesResource) -> None: self.delete = async_to_raw_response_wrapper( proxies.delete, ) + self.lookup = async_to_raw_response_wrapper( + proxies.lookup, + ) class ProxiesResourceWithStreamingResponse: @@ -770,6 +845,9 @@ def __init__(self, proxies: ProxiesResource) -> None: self.delete = to_streamed_response_wrapper( proxies.delete, ) + self.lookup = to_streamed_response_wrapper( + proxies.lookup, + ) class AsyncProxiesResourceWithStreamingResponse: @@ -791,3 +869,6 @@ def __init__(self, proxies: AsyncProxiesResource) -> None: self.delete = async_to_streamed_response_wrapper( proxies.delete, ) + self.lookup = async_to_streamed_response_wrapper( + proxies.lookup, + ) diff --git a/src/mobilerun_sdk/types/__init__.py b/src/mobilerun_sdk/types/__init__.py index ee48455..ecf96d9 100644 --- a/src/mobilerun_sdk/types/__init__.py +++ b/src/mobilerun_sdk/types/__init__.py @@ -2,9 +2,23 @@ from __future__ import annotations +from . import devices +from .. import _compat from .flow import Flow as Flow from .task import Task as Task -from .shared import Pagination as Pagination, PaginationMeta as PaginationMeta +from .device import Device as Device +from .shared import ( + Meta as Meta, + Socks5 as Socks5, + Location as Location, + DeviceSpec as DeviceSpec, + Pagination as Pagination, + DeviceCarrier as DeviceCarrier, + PermissionSet as PermissionSet, + PaginationMeta as PaginationMeta, + DeviceIdentifiers as DeviceIdentifiers, +) +from .profile import Profile as Profile from .task_status import TaskStatus as TaskStatus from .proxy_config import ProxyConfig as ProxyConfig from .usage_result import UsageResult as UsageResult @@ -14,24 +28,46 @@ from .app_list_response import AppListResponse as AppListResponse from .proxy_list_params import ProxyListParams as ProxyListParams from .task_run_response import TaskRunResponse as TaskRunResponse +from .device_list_params import DeviceListParams as DeviceListParams from .task_list_response import TaskListResponse as TaskListResponse from .task_stop_response import TaskStopResponse as TaskStopResponse from .app_delete_response import AppDeleteResponse as AppDeleteResponse +from .carrier_list_params import CarrierListParams as CarrierListParams from .model_list_response import ModelListResponse as ModelListResponse from .package_credentials import PackageCredentials as PackageCredentials +from .profile_list_params import ProfileListParams as ProfileListParams from .proxy_create_params import ProxyCreateParams as ProxyCreateParams from .proxy_list_response import ProxyListResponse as ProxyListResponse +from .proxy_lookup_params import ProxyLookupParams as ProxyLookupParams from .proxy_update_params import ProxyUpdateParams as ProxyUpdateParams from .webhook_list_params import WebhookListParams as WebhookListParams +from .device_create_params import DeviceCreateParams as DeviceCreateParams +from .device_list_response import DeviceListResponse as DeviceListResponse from .app_retrieve_response import AppRetrieveResponse as AppRetrieveResponse +from .carrier_create_params import CarrierCreateParams as CarrierCreateParams +from .carrier_list_response import CarrierListResponse as CarrierListResponse +from .carrier_lookup_params import CarrierLookupParams as CarrierLookupParams +from .carrier_update_params import CarrierUpdateParams as CarrierUpdateParams +from .device_count_response import DeviceCountResponse as DeviceCountResponse +from .profile_create_params import ProfileCreateParams as ProfileCreateParams +from .profile_list_response import ProfileListResponse as ProfileListResponse +from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams from .proxy_create_response import ProxyCreateResponse as ProxyCreateResponse from .proxy_delete_response import ProxyDeleteResponse as ProxyDeleteResponse +from .proxy_lookup_response import ProxyLookupResponse as ProxyLookupResponse from .proxy_update_response import ProxyUpdateResponse as ProxyUpdateResponse from .webhook_create_params import WebhookCreateParams as WebhookCreateParams from .webhook_list_response import WebhookListResponse as WebhookListResponse from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams from .credential_list_params import CredentialListParams as CredentialListParams +from .device_set_name_params import DeviceSetNameParams as DeviceSetNameParams from .task_retrieve_response import TaskRetrieveResponse as TaskRetrieveResponse +from .carrier_create_response import CarrierCreateResponse as CarrierCreateResponse +from .carrier_delete_response import CarrierDeleteResponse as CarrierDeleteResponse +from .carrier_lookup_response import CarrierLookupResponse as CarrierLookupResponse +from .carrier_update_response import CarrierUpdateResponse as CarrierUpdateResponse +from .device_terminate_params import DeviceTerminateParams as DeviceTerminateParams +from .profile_delete_response import ProfileDeleteResponse as ProfileDeleteResponse from .proxy_retrieve_response import ProxyRetrieveResponse as ProxyRetrieveResponse from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse @@ -40,14 +76,27 @@ from .task_get_status_response import TaskGetStatusResponse as TaskGetStatusResponse from .task_run_streamed_params import TaskRunStreamedParams as TaskRunStreamedParams from .task_send_message_params import TaskSendMessageParams as TaskSendMessageParams +from .carrier_retrieve_response import CarrierRetrieveResponse as CarrierRetrieveResponse from .package_credentials_param import PackageCredentialsParam as PackageCredentialsParam from .webhook_retrieve_response import WebhookRetrieveResponse as WebhookRetrieveResponse from .app_list_versions_response import AppListVersionsResponse as AppListVersionsResponse from .task_send_message_response import TaskSendMessageResponse as TaskSendMessageResponse from .app_confirm_upload_response import AppConfirmUploadResponse as AppConfirmUploadResponse +from .device_fingerprint_response import DeviceFingerprintResponse as DeviceFingerprintResponse from .task_get_trajectory_response import TaskGetTrajectoryResponse as TaskGetTrajectoryResponse from .webhook_event_types_response import WebhookEventTypesResponse as WebhookEventTypesResponse from .webhook_rotate_secret_response import WebhookRotateSecretResponse as WebhookRotateSecretResponse from .webhook_test_delivery_response import WebhookTestDeliveryResponse as WebhookTestDeliveryResponse from .app_create_signed_upload_url_params import AppCreateSignedUploadURLParams as AppCreateSignedUploadURLParams from .app_create_signed_upload_url_response import AppCreateSignedUploadURLResponse as AppCreateSignedUploadURLResponse + +# Rebuild cyclical models only after all modules are imported. +# This ensures that, when building the deferred (due to cyclical references) model schema, +# Pydantic can resolve the necessary references. +# See: https://github.com/pydantic/pydantic/issues/11250 for more context. +if _compat.PYDANTIC_V1: + devices.a11_y_node.A11YNode.update_forward_refs() # type: ignore + devices.state_ui_response.StateUiResponse.update_forward_refs() # type: ignore +else: + devices.a11_y_node.A11YNode.model_rebuild(_parent_namespace_depth=0) + devices.state_ui_response.StateUiResponse.model_rebuild(_parent_namespace_depth=0) diff --git a/src/mobilerun_sdk/types/carrier_create_params.py b/src/mobilerun_sdk/types/carrier_create_params.py new file mode 100644 index 0000000..3b6c6c7 --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_create_params.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CarrierCreateParams"] + + +class CarrierCreateParams(TypedDict, total=False): + country: Required[str] + """Country name""" + + mcc: Required[str] + """Mobile Country Code""" + + mnc: Required[str] + """Mobile Network Code""" + + operator: Required[str] + """Operator name""" + + company: str + """Company name""" + + country_code: str + """Country dialing code (e.g., +1)""" + + country_iso: str + """ISO country code""" + + detail_url: str + """URL to carrier details page""" + + gsm_bands: str + """Supported GSM bands""" + + lte_bands: str + """Supported LTE bands""" + + mobile_prefix: str + """Mobile number prefix""" + + nsn_size: str + """National Significant Number size""" + + number_format: str + """Phone number format""" + + protocols: str + """Supported protocols (comma-separated)""" + + umts_bands: str + """Supported UMTS bands""" + + website: str + """Company website""" diff --git a/src/mobilerun_sdk/types/carrier_create_response.py b/src/mobilerun_sdk/types/carrier_create_response.py new file mode 100644 index 0000000..643be23 --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_create_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["CarrierCreateResponse"] + + +class CarrierCreateResponse(BaseModel): + id: int + + company: str + + country: str + + country_code: str + + country_iso: str + + created_at: datetime + + detail_url: str + + gsm_bands: str + + lte_bands: str + + mcc: str + + mnc: str + + mobile_prefix: str + + nsn_size: str + + number_format: str + + operator: str + + protocols: str + + umts_bands: str + + website: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_delete_response.py b/src/mobilerun_sdk/types/carrier_delete_response.py new file mode 100644 index 0000000..ccb2aea --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_delete_response.py @@ -0,0 +1,16 @@ +# 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__ = ["CarrierDeleteResponse"] + + +class CarrierDeleteResponse(BaseModel): + message: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_list_params.py b/src/mobilerun_sdk/types/carrier_list_params.py new file mode 100644 index 0000000..8cd3723 --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_list_params.py @@ -0,0 +1,31 @@ +# 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__ = ["CarrierListParams"] + + +class CarrierListParams(TypedDict, total=False): + country: str + """Filter by country name""" + + country_iso: Annotated[str, PropertyInfo(alias="countryISO")] + """Filter by country ISO code""" + + order_by: Annotated[ + Literal["id", "mcc", "mnc", "operator", "country", "country_iso"], PropertyInfo(alias="orderBy") + ] + """Field to order by""" + + order_dir: Annotated[Literal["asc", "desc"], PropertyInfo(alias="orderDir")] + """Order direction""" + + page: int + """Page number""" + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + """Items per page""" diff --git a/src/mobilerun_sdk/types/carrier_list_response.py b/src/mobilerun_sdk/types/carrier_list_response.py new file mode 100644 index 0000000..098754a --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_list_response.py @@ -0,0 +1,61 @@ +# 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 +from .shared.meta import Meta + +__all__ = ["CarrierListResponse", "Item"] + + +class Item(BaseModel): + id: int + + company: str + + country: str + + country_code: str + + country_iso: str + + created_at: datetime + + detail_url: str + + gsm_bands: str + + lte_bands: str + + mcc: str + + mnc: str + + mobile_prefix: str + + nsn_size: str + + number_format: str + + operator: str + + protocols: str + + umts_bands: str + + website: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" + + +class CarrierListResponse(BaseModel): + items: Optional[List[Item]] = None + + pagination: Meta + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_lookup_params.py b/src/mobilerun_sdk/types/carrier_lookup_params.py new file mode 100644 index 0000000..bf51578 --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_lookup_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, TypedDict + +__all__ = ["CarrierLookupParams"] + + +class CarrierLookupParams(TypedDict, total=False): + mcc: Required[str] + """Mobile Country Code""" + + mnc: Required[str] + """Mobile Network Code""" diff --git a/src/mobilerun_sdk/types/carrier_lookup_response.py b/src/mobilerun_sdk/types/carrier_lookup_response.py new file mode 100644 index 0000000..925e0d6 --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_lookup_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["CarrierLookupResponse"] + + +class CarrierLookupResponse(BaseModel): + id: int + + company: str + + country: str + + country_code: str + + country_iso: str + + created_at: datetime + + detail_url: str + + gsm_bands: str + + lte_bands: str + + mcc: str + + mnc: str + + mobile_prefix: str + + nsn_size: str + + number_format: str + + operator: str + + protocols: str + + umts_bands: str + + website: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_retrieve_response.py b/src/mobilerun_sdk/types/carrier_retrieve_response.py new file mode 100644 index 0000000..f4bf58c --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_retrieve_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["CarrierRetrieveResponse"] + + +class CarrierRetrieveResponse(BaseModel): + id: int + + company: str + + country: str + + country_code: str + + country_iso: str + + created_at: datetime + + detail_url: str + + gsm_bands: str + + lte_bands: str + + mcc: str + + mnc: str + + mobile_prefix: str + + nsn_size: str + + number_format: str + + operator: str + + protocols: str + + umts_bands: str + + website: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/carrier_update_params.py b/src/mobilerun_sdk/types/carrier_update_params.py new file mode 100644 index 0000000..aa98473 --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_update_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CarrierUpdateParams"] + + +class CarrierUpdateParams(TypedDict, total=False): + company: str + """Company name""" + + country: str + """Country name""" + + country_code: str + """Country dialing code""" + + country_iso: str + """ISO country code""" + + detail_url: str + """URL to carrier details""" + + gsm_bands: str + """Supported GSM bands""" + + lte_bands: str + """Supported LTE bands""" + + mobile_prefix: str + """Mobile number prefix""" + + nsn_size: str + """NSN size""" + + number_format: str + """Phone number format""" + + operator: str + """Operator name""" + + protocols: str + """Supported protocols""" + + umts_bands: str + """Supported UMTS bands""" + + website: str + """Company website""" diff --git a/src/mobilerun_sdk/types/carrier_update_response.py b/src/mobilerun_sdk/types/carrier_update_response.py new file mode 100644 index 0000000..ba0d7ef --- /dev/null +++ b/src/mobilerun_sdk/types/carrier_update_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["CarrierUpdateResponse"] + + +class CarrierUpdateResponse(BaseModel): + id: int + + company: str + + country: str + + country_code: str + + country_iso: str + + created_at: datetime + + detail_url: str + + gsm_bands: str + + lte_bands: str + + mcc: str + + mnc: str + + mobile_prefix: str + + nsn_size: str + + number_format: str + + operator: str + + protocols: str + + umts_bands: str + + website: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/connect/country_list_params.py b/src/mobilerun_sdk/types/connect/country_list_params.py index b3819a9..a08049f 100644 --- a/src/mobilerun_sdk/types/connect/country_list_params.py +++ b/src/mobilerun_sdk/types/connect/country_list_params.py @@ -16,5 +16,5 @@ class CountryListParams(TypedDict, total=False): page_size: Annotated[int, PropertyInfo(alias="pageSize")] """Number of items per page.""" - type: Literal["residential"] + type: Literal["dedicated_residential", "residential", "mobile"] """Filter to countries offering this proxy type.""" diff --git a/src/mobilerun_sdk/types/connect/country_list_response.py b/src/mobilerun_sdk/types/connect/country_list_response.py index cc2b650..ad5dfd6 100644 --- a/src/mobilerun_sdk/types/connect/country_list_response.py +++ b/src/mobilerun_sdk/types/connect/country_list_response.py @@ -16,7 +16,7 @@ class Item(BaseModel): name: str - proxy_types: List[Literal["residential"]] = FieldInfo(alias="proxyTypes") + proxy_types: List[Literal["dedicated_residential", "residential", "mobile"]] = FieldInfo(alias="proxyTypes") """Proxy types available to provision in this country.""" diff --git a/src/mobilerun_sdk/types/connect/proxy_buy_params.py b/src/mobilerun_sdk/types/connect/proxy_buy_params.py index 77b9ded..7bace18 100644 --- a/src/mobilerun_sdk/types/connect/proxy_buy_params.py +++ b/src/mobilerun_sdk/types/connect/proxy_buy_params.py @@ -11,4 +11,4 @@ class ProxyBuyParams(TypedDict, total=False): country: Required[str] """ISO 3166-1 alpha-2 country code to provision the proxy in.""" - type: Literal["residential"] + type: Literal["dedicated_residential", "residential", "mobile"] diff --git a/src/mobilerun_sdk/types/connect/proxy_buy_response.py b/src/mobilerun_sdk/types/connect/proxy_buy_response.py index 52cf24d..403a8d8 100644 --- a/src/mobilerun_sdk/types/connect/proxy_buy_response.py +++ b/src/mobilerun_sdk/types/connect/proxy_buy_response.py @@ -37,7 +37,7 @@ class ProxyBuyResponse(BaseModel): attempt. """ - type: Literal["residential"] + type: Literal["dedicated_residential", "residential", "mobile"] username: str diff --git a/src/mobilerun_sdk/types/connect/proxy_list_response.py b/src/mobilerun_sdk/types/connect/proxy_list_response.py index b46e7ec..26135dc 100644 --- a/src/mobilerun_sdk/types/connect/proxy_list_response.py +++ b/src/mobilerun_sdk/types/connect/proxy_list_response.py @@ -35,7 +35,7 @@ class Item(BaseModel): attempt. """ - type: Literal["residential"] + type: Literal["dedicated_residential", "residential", "mobile"] username: str diff --git a/src/mobilerun_sdk/types/connect/proxy_retrieve_response.py b/src/mobilerun_sdk/types/connect/proxy_retrieve_response.py index f594cb5..be8cd87 100644 --- a/src/mobilerun_sdk/types/connect/proxy_retrieve_response.py +++ b/src/mobilerun_sdk/types/connect/proxy_retrieve_response.py @@ -37,7 +37,7 @@ class ProxyRetrieveResponse(BaseModel): attempt. """ - type: Literal["residential"] + type: Literal["dedicated_residential", "residential", "mobile"] username: str diff --git a/src/mobilerun_sdk/types/device.py b/src/mobilerun_sdk/types/device.py new file mode 100644 index 0000000..e332501 --- /dev/null +++ b/src/mobilerun_sdk/types/device.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["Device"] + + +class Device(BaseModel): + id: str + + active_task_id: str = FieldInfo(alias="activeTaskId") + + assigned_at: Optional[datetime] = FieldInfo(alias="assignedAt", default=None) + + created_at: datetime = FieldInfo(alias="createdAt") + + name: str + + state: str + + state_message: str = FieldInfo(alias="stateMessage") + + stream_url: str = FieldInfo(alias="streamUrl") + + task_count: int = FieldInfo(alias="taskCount") + + terminates_at: Optional[datetime] = FieldInfo(alias="terminatesAt", default=None) + + type: str + + updated_at: datetime = FieldInfo(alias="updatedAt") + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" + + billing_strategy: Optional[str] = FieldInfo(alias="billingStrategy", default=None) + + provider_id: Optional[str] = FieldInfo(alias="providerId", default=None) + + stream_token: Optional[str] = FieldInfo(alias="streamToken", default=None) + + user_id: Optional[str] = FieldInfo(alias="userId", default=None) diff --git a/src/mobilerun_sdk/types/device_count_response.py b/src/mobilerun_sdk/types/device_count_response.py new file mode 100644 index 0000000..966ff68 --- /dev/null +++ b/src/mobilerun_sdk/types/device_count_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["DeviceCountResponse"] + +DeviceCountResponse: TypeAlias = Dict[str, int] diff --git a/src/mobilerun_sdk/types/device_create_params.py b/src/mobilerun_sdk/types/device_create_params.py new file mode 100644 index 0000000..f6b7a1c --- /dev/null +++ b/src/mobilerun_sdk/types/device_create_params.py @@ -0,0 +1,71 @@ +# 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, Annotated, TypedDict + +from .._types import SequenceNotStr +from .._utils import PropertyInfo +from .shared_params.socks5 import Socks5 +from .shared_params.location import Location +from .shared_params.device_carrier import DeviceCarrier +from .shared_params.device_identifiers import DeviceIdentifiers + +__all__ = ["DeviceCreateParams", "Proxy"] + + +class DeviceCreateParams(TypedDict, total=False): + billing: Literal["auto", "subscription", "minute"] + """Billing mode. + + 'auto' uses a subscription slot when available and otherwise bills per minute; + 'subscription' requires an available subscription slot; 'minute' bills per + minute. Only cloud phone and cloud emulator devices support per-minute billing. + """ + + query_country: Annotated[str, PropertyInfo(alias="country")] + """ISO 3166-1 alpha-2 country code. + + If omitted the system picks the country with the most availability. + """ + + device_type: Annotated[ + Literal[ + "dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device", "dedicated_emulated_device" + ], + PropertyInfo(alias="deviceType"), + ] + + profile_id: Annotated[str, PropertyInfo(alias="profileId")] + """Profile ID to use as device spec""" + + android_version: Annotated[int, PropertyInfo(alias="androidVersion")] + + apps: Optional[SequenceNotStr[str]] + + carrier: DeviceCarrier + + body_country: Annotated[str, PropertyInfo(alias="country")] + + files: Optional[SequenceNotStr[str]] + + identifiers: DeviceIdentifiers + + locale: str + + location: Location + + name: str + + proxy: Proxy + + timezone: str + + +class Proxy(TypedDict, total=False): + name: str + + smart_ip: Annotated[bool, PropertyInfo(alias="smartIp")] + + socks5: Socks5 diff --git a/src/mobilerun_sdk/types/device_fingerprint_response.py b/src/mobilerun_sdk/types/device_fingerprint_response.py new file mode 100644 index 0000000..4f8f410 --- /dev/null +++ b/src/mobilerun_sdk/types/device_fingerprint_response.py @@ -0,0 +1,48 @@ +# 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 +from .shared.device_carrier import DeviceCarrier +from .shared.device_identifiers import DeviceIdentifiers + +__all__ = ["DeviceFingerprintResponse", "Display", "Model"] + + +class Display(BaseModel): + density_dpi: Optional[int] = FieldInfo(alias="densityDpi", default=None) + + height: Optional[int] = None + + width: Optional[int] = None + + +class Model(BaseModel): + aosp_version: Optional[str] = FieldInfo(alias="aospVersion", default=None) + + brand: Optional[str] = None + + device: Optional[str] = None + + hardware: Optional[str] = None + + image_repository: Optional[str] = FieldInfo(alias="imageRepository", default=None) + + manufacturer: Optional[str] = None + + model: Optional[str] = None + + +class DeviceFingerprintResponse(BaseModel): + carrier: DeviceCarrier + + display: Display + + identifiers: DeviceIdentifiers + + model: Model + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/device_list_params.py b/src/mobilerun_sdk/types/device_list_params.py new file mode 100644 index 0000000..fcec1bb --- /dev/null +++ b/src/mobilerun_sdk/types/device_list_params.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +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_id: Annotated[str, PropertyInfo(alias="providerId")] + + state: Optional[ + List[ + Literal[ + "creating", + "assigned", + "ready", + "rebooting", + "migrating", + "resetting", + "terminated", + "maintenance", + "unknown", + ] + ] + ] + + type: Literal["dedicated_physical_device", "dedicated_premium_device", "dedicated_ios_device"] diff --git a/src/mobilerun_sdk/types/device_list_response.py b/src/mobilerun_sdk/types/device_list_response.py new file mode 100644 index 0000000..e748a8e --- /dev/null +++ b/src/mobilerun_sdk/types/device_list_response.py @@ -0,0 +1,20 @@ +# 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 +from .shared.meta import Meta + +__all__ = ["DeviceListResponse"] + + +class DeviceListResponse(BaseModel): + items: Optional[List[Device]] = None + + pagination: Meta + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/device_set_name_params.py b/src/mobilerun_sdk/types/device_set_name_params.py new file mode 100644 index 0000000..03cb2f6 --- /dev/null +++ b/src/mobilerun_sdk/types/device_set_name_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["DeviceSetNameParams"] + + +class DeviceSetNameParams(TypedDict, total=False): + name: Required[str] diff --git a/src/mobilerun_sdk/types/device_terminate_params.py b/src/mobilerun_sdk/types/device_terminate_params.py new file mode 100644 index 0000000..f4a7660 --- /dev/null +++ b/src/mobilerun_sdk/types/device_terminate_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 import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["DeviceTerminateParams"] + + +class DeviceTerminateParams(TypedDict, total=False): + previous_device_id: Annotated[str, PropertyInfo(alias="previousDeviceId")] + + terminate_at: Annotated[Union[str, datetime], PropertyInfo(alias="terminateAt", format="iso8601")] diff --git a/src/mobilerun_sdk/types/devices/__init__.py b/src/mobilerun_sdk/types/devices/__init__.py index f8ee8b1..dcd2cfa 100644 --- a/src/mobilerun_sdk/types/devices/__init__.py +++ b/src/mobilerun_sdk/types/devices/__init__.py @@ -1,3 +1,47 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .rect import Rect as Rect +from .file_info import FileInfo as FileInfo +from .a11_y_node import A11YNode as A11YNode +from .app_list_params import AppListParams as AppListParams +from .app_stop_params import AppStopParams as AppStopParams +from .state_ui_params import StateUiParams as StateUiParams +from .app_start_params import AppStartParams as AppStartParams +from .file_list_params import FileListParams as FileListParams +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 .esim_enable_params import EsimEnableParams as EsimEnableParams +from .esim_list_response import EsimListResponse as EsimListResponse +from .esim_remove_params import EsimRemoveParams as EsimRemoveParams +from .file_delete_params import FileDeleteParams as FileDeleteParams +from .file_list_response import FileListResponse as FileListResponse +from .file_upload_params import FileUploadParams as FileUploadParams +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 .language_set_params import LanguageSetParams as LanguageSetParams +from .location_set_params import LocationSetParams as LocationSetParams +from .package_list_params import PackageListParams as PackageListParams +from .state_time_response import StateTimeResponse as StateTimeResponse +from .timezone_set_params import TimezoneSetParams as TimezoneSetParams +from .action_global_params import ActionGlobalParams as ActionGlobalParams +from .esim_activate_params import EsimActivateParams as EsimActivateParams +from .file_download_params import FileDownloadParams as FileDownloadParams +from .proxy_connect_params import ProxyConnectParams as ProxyConnectParams +from .keyboard_write_params import KeyboardWriteParams as KeyboardWriteParams +from .language_get_response import LanguageGetResponse as LanguageGetResponse +from .package_list_response import PackageListResponse as PackageListResponse +from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams +from .proxy_status_response import ProxyStatusResponse as ProxyStatusResponse +from .timezone_get_response import TimezoneGetResponse as TimezoneGetResponse +from .esim_activate_response import EsimActivateResponse as EsimActivateResponse +from .file_download_response import FileDownloadResponse as FileDownloadResponse +from .state_screenshot_params import StateScreenshotParams as StateScreenshotParams +from .state_screenshot_response import StateScreenshotResponse as StateScreenshotResponse +from .action_overlay_visible_response import ActionOverlayVisibleResponse as ActionOverlayVisibleResponse +from .action_set_overlay_visible_params import ActionSetOverlayVisibleParams as ActionSetOverlayVisibleParams diff --git a/src/mobilerun_sdk/types/devices/a11_y_node.py b/src/mobilerun_sdk/types/devices/a11_y_node.py new file mode 100644 index 0000000..aa4eb12 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/a11_y_node.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["A11YNode", "BoundsInScreen"] + + +class BoundsInScreen(BaseModel): + bottom: int + + left: int + + right: int + + top: int + + +class A11YNode(BaseModel): + bounds_in_screen: BoundsInScreen = FieldInfo(alias="boundsInScreen") + + children: Optional[List["A11YNode"]] = None + + class_name: str = FieldInfo(alias="className") + + content_description: str = FieldInfo(alias="contentDescription") + + is_checkable: bool = FieldInfo(alias="isCheckable") + + is_checked: bool = FieldInfo(alias="isChecked") + + is_clickable: bool = FieldInfo(alias="isClickable") + + is_enabled: bool = FieldInfo(alias="isEnabled") + + is_focusable: bool = FieldInfo(alias="isFocusable") + + is_focused: bool = FieldInfo(alias="isFocused") + + is_long_clickable: bool = FieldInfo(alias="isLongClickable") + + is_password: bool = FieldInfo(alias="isPassword") + + is_scrollable: bool = FieldInfo(alias="isScrollable") + + is_selected: bool = FieldInfo(alias="isSelected") + + package_name: str = FieldInfo(alias="packageName") + + resource_id: str = FieldInfo(alias="resourceId") + + text: str diff --git a/src/mobilerun_sdk/types/devices/action_global_params.py b/src/mobilerun_sdk/types/devices/action_global_params.py new file mode 100644 index 0000000..a8fca37 --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/action_overlay_visible_response.py b/src/mobilerun_sdk/types/devices/action_overlay_visible_response.py new file mode 100644 index 0000000..1ad6161 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/action_overlay_visible_response.py @@ -0,0 +1,16 @@ +# 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__ = ["ActionOverlayVisibleResponse"] + + +class ActionOverlayVisibleResponse(BaseModel): + visible: bool + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/action_set_overlay_visible_params.py b/src/mobilerun_sdk/types/devices/action_set_overlay_visible_params.py new file mode 100644 index 0000000..ff1d216 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/action_set_overlay_visible_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__ = ["ActionSetOverlayVisibleParams"] + + +class ActionSetOverlayVisibleParams(TypedDict, total=False): + visible: Required[bool] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/action_swipe_params.py b/src/mobilerun_sdk/types/devices/action_swipe_params.py new file mode 100644 index 0000000..180d1db --- /dev/null +++ b/src/mobilerun_sdk/types/devices/action_swipe_params.py @@ -0,0 +1,26 @@ +# 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")]] + + stealth: bool + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/action_tap_params.py b/src/mobilerun_sdk/types/devices/action_tap_params.py new file mode 100644 index 0000000..749d2d2 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/action_tap_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 Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ActionTapParams"] + + +class ActionTapParams(TypedDict, total=False): + x: Required[int] + + y: Required[int] + + stealth: bool + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/app_install_params.py b/src/mobilerun_sdk/types/devices/app_install_params.py new file mode 100644 index 0000000..8db67fe --- /dev/null +++ b/src/mobilerun_sdk/types/devices/app_install_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AppInstallParams", "Variant0", "Variant1"] + + +class Variant0(TypedDict, total=False): + bundle_id: Required[Annotated[str, PropertyInfo(alias="bundleId")]] + """iOS bundle identifier (e.g. com.example.app)""" + + package_name: Annotated[str, PropertyInfo(alias="packageName")] + """Android package name (e.g. com.example.app)""" + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] + + +class Variant1(TypedDict, total=False): + package_name: Required[Annotated[str, PropertyInfo(alias="packageName")]] + """Android package name (e.g. com.example.app)""" + + bundle_id: Annotated[str, PropertyInfo(alias="bundleId")] + """iOS bundle identifier (e.g. com.example.app)""" + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] + + +AppInstallParams: TypeAlias = Union[Variant0, Variant1] diff --git a/src/mobilerun_sdk/types/devices/app_list_params.py b/src/mobilerun_sdk/types/devices/app_list_params.py new file mode 100644 index 0000000..9e6b98c --- /dev/null +++ b/src/mobilerun_sdk/types/devices/app_list_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 Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AppListParams"] + + +class AppListParams(TypedDict, total=False): + include_protected_apps: Annotated[bool, PropertyInfo(alias="includeProtectedApps")] + + 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_sdk/types/devices/app_list_response.py b/src/mobilerun_sdk/types/devices/app_list_response.py new file mode 100644 index 0000000..c8f8f4e --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/app_start_params.py b/src/mobilerun_sdk/types/devices/app_start_params.py new file mode 100644 index 0000000..f5761f1 --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/app_stop_params.py b/src/mobilerun_sdk/types/devices/app_stop_params.py new file mode 100644 index 0000000..08dcece --- /dev/null +++ b/src/mobilerun_sdk/types/devices/app_stop_params.py @@ -0,0 +1,18 @@ +# 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__ = ["AppStopParams"] + + +class AppStopParams(TypedDict, total=False): + device_id: Required[Annotated[str, PropertyInfo(alias="deviceId")]] + + clear_data: Annotated[bool, PropertyInfo(alias="clearData")] + """If true, clears all app data (pm clear) in addition to stopping the app.""" + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/esim_activate_params.py b/src/mobilerun_sdk/types/devices/esim_activate_params.py new file mode 100644 index 0000000..e5c9e74 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/esim_activate_params.py @@ -0,0 +1,26 @@ +# 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__ = ["EsimActivateParams"] + + +class EsimActivateParams(TypedDict, total=False): + enable: Required[bool] + + sm_dp_addr: Required[Annotated[str, PropertyInfo(alias="smDpAddr")]] + + confirmation_code: Annotated[str, PropertyInfo(alias="confirmationCode")] + """Optional carrier-issued confirmation code (the 4th LPA segment). + + Required only for plans whose SM-DP+ challenges the device for one. Requires + matchingId — the LPA spec only interprets segment 4 when segment 3 is present. + """ + + matching_id: Annotated[str, PropertyInfo(alias="matchingId")] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/esim_activate_response.py b/src/mobilerun_sdk/types/devices/esim_activate_response.py new file mode 100644 index 0000000..517c0ba --- /dev/null +++ b/src/mobilerun_sdk/types/devices/esim_activate_response.py @@ -0,0 +1,28 @@ +# 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__ = ["EsimActivateResponse"] + + +class EsimActivateResponse(BaseModel): + carrier: str + + display_name: str = FieldInfo(alias="displayName") + + iccid: str + + is_embedded: bool = FieldInfo(alias="isEmbedded") + + slot: int + + sub_id: int = FieldInfo(alias="subId") + + type: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/esim_enable_params.py b/src/mobilerun_sdk/types/devices/esim_enable_params.py new file mode 100644 index 0000000..25e8fdd --- /dev/null +++ b/src/mobilerun_sdk/types/devices/esim_enable_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__ = ["EsimEnableParams"] + + +class EsimEnableParams(TypedDict, total=False): + sub_id: Required[Annotated[int, PropertyInfo(alias="subId")]] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/esim_list_response.py b/src/mobilerun_sdk/types/devices/esim_list_response.py new file mode 100644 index 0000000..6aa50af --- /dev/null +++ b/src/mobilerun_sdk/types/devices/esim_list_response.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["EsimListResponse", "EsimListResponseItem"] + + +class EsimListResponseItem(BaseModel): + carrier: str + + display_name: str = FieldInfo(alias="displayName") + + iccid: str + + is_embedded: bool = FieldInfo(alias="isEmbedded") + + slot: int + + sub_id: int = FieldInfo(alias="subId") + + type: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" + + +EsimListResponse: TypeAlias = List[EsimListResponseItem] diff --git a/src/mobilerun_sdk/types/devices/esim_remove_params.py b/src/mobilerun_sdk/types/devices/esim_remove_params.py new file mode 100644 index 0000000..e73c1a6 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/esim_remove_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__ = ["EsimRemoveParams"] + + +class EsimRemoveParams(TypedDict, total=False): + sub_id: Required[Annotated[int, PropertyInfo(alias="subId")]] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_delete_params.py b/src/mobilerun_sdk/types/devices/file_delete_params.py new file mode 100644 index 0000000..33a0dc0 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/file_delete_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__ = ["FileDeleteParams"] + + +class FileDeleteParams(TypedDict, total=False): + path: Required[str] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_download_params.py b/src/mobilerun_sdk/types/devices/file_download_params.py new file mode 100644 index 0000000..6919c17 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/file_download_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__ = ["FileDownloadParams"] + + +class FileDownloadParams(TypedDict, total=False): + path: Required[str] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_download_response.py b/src/mobilerun_sdk/types/devices/file_download_response.py new file mode 100644 index 0000000..7dcee00 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/file_download_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__ = ["FileDownloadResponse"] + +FileDownloadResponse: TypeAlias = str diff --git a/src/mobilerun_sdk/types/devices/file_info.py b/src/mobilerun_sdk/types/devices/file_info.py new file mode 100644 index 0000000..ed09c7b --- /dev/null +++ b/src/mobilerun_sdk/types/devices/file_info.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from ..shared.permission_set import PermissionSet + +__all__ = ["FileInfo", "Permissions", "PermissionsSpecial"] + + +class PermissionsSpecial(BaseModel): + set_gid: bool = FieldInfo(alias="setGid") + + set_uid: bool = FieldInfo(alias="setUid") + + sticky: bool + + +class Permissions(BaseModel): + group: PermissionSet + + others: PermissionSet + + owner: PermissionSet + + special: PermissionsSpecial + + +class FileInfo(BaseModel): + extended_attributes: bool = FieldInfo(alias="extendedAttributes") + + group: str + + hard_links: int = FieldInfo(alias="hardLinks") + + modified_at: datetime = FieldInfo(alias="modifiedAt") + + name: str + + owner: str + + permissions: Permissions + + size: int + + type: str + + symlink_target: Optional[str] = FieldInfo(alias="symlinkTarget", default=None) diff --git a/src/mobilerun_sdk/types/devices/file_list_params.py b/src/mobilerun_sdk/types/devices/file_list_params.py new file mode 100644 index 0000000..6284a3a --- /dev/null +++ b/src/mobilerun_sdk/types/devices/file_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 Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["FileListParams"] + + +class FileListParams(TypedDict, total=False): + path: Required[str] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/file_list_response.py b/src/mobilerun_sdk/types/devices/file_list_response.py new file mode 100644 index 0000000..527b7fa --- /dev/null +++ b/src/mobilerun_sdk/types/devices/file_list_response.py @@ -0,0 +1,21 @@ +# 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 ..._models import BaseModel +from .file_info import FileInfo + +__all__ = ["FileListResponse"] + + +class FileListResponse(BaseModel): + files: Optional[List[FileInfo]] = None + + path: str + + total: int + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/file_upload_params.py b/src/mobilerun_sdk/types/devices/file_upload_params.py new file mode 100644 index 0000000..e6112d1 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/file_upload_params.py @@ -0,0 +1,18 @@ +# 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 ..._types import FileTypes +from ..._utils import PropertyInfo + +__all__ = ["FileUploadParams"] + + +class FileUploadParams(TypedDict, total=False): + path: Required[str] + + file: Required[FileTypes] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/keyboard_key_params.py b/src/mobilerun_sdk/types/devices/keyboard_key_params.py new file mode 100644 index 0000000..85854de --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/keyboard_write_params.py b/src/mobilerun_sdk/types/devices/keyboard_write_params.py new file mode 100644 index 0000000..c1340d7 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/keyboard_write_params.py @@ -0,0 +1,25 @@ +# 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): + text: Required[str] + + clear: bool + + error_rate: Annotated[float, PropertyInfo(alias="errorRate")] + """Per-character mistake rate for humantouch typing. -1 uses server default.""" + + stealth: bool + + wpm: int + """Words per minute for stealth typing. 0 uses portal default.""" + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/language_get_response.py b/src/mobilerun_sdk/types/devices/language_get_response.py new file mode 100644 index 0000000..22c2c78 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/language_get_response.py @@ -0,0 +1,16 @@ +# 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__ = ["LanguageGetResponse"] + + +class LanguageGetResponse(BaseModel): + locale: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/language_set_params.py b/src/mobilerun_sdk/types/devices/language_set_params.py new file mode 100644 index 0000000..1cfb643 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/language_set_params.py @@ -0,0 +1,25 @@ +# 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__ = ["LanguageSetParams"] + + +class LanguageSetParams(TypedDict, total=False): + locale: Required[str] + """ + BCP-47 locale: a 2–3 letter language tag, optionally followed by a 4-letter + script and/or a 2-letter region (e.g. en-US, de-DE, ja-JP, zh-Hans-CN). + """ + + restart: bool + """Restart zygote so the locale change takes full effect immediately. + + Without it, the locale is written but won't fully apply until the next reboot. + """ + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/location_set_params.py b/src/mobilerun_sdk/types/devices/location_set_params.py new file mode 100644 index 0000000..6a51626 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/location_set_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__ = ["LocationSetParams"] + + +class LocationSetParams(TypedDict, total=False): + latitude: Required[float] + + longitude: Required[float] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/package_list_params.py b/src/mobilerun_sdk/types/devices/package_list_params.py new file mode 100644 index 0000000..662043e --- /dev/null +++ b/src/mobilerun_sdk/types/devices/package_list_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 Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["PackageListParams"] + + +class PackageListParams(TypedDict, total=False): + include_protected_packages: Annotated[bool, PropertyInfo(alias="includeProtectedPackages")] + + 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_sdk/types/devices/package_list_response.py b/src/mobilerun_sdk/types/devices/package_list_response.py new file mode 100644 index 0000000..0ab9e4b --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/profile_update_params.py b/src/mobilerun_sdk/types/devices/profile_update_params.py new file mode 100644 index 0000000..8bab1e8 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/profile_update_params.py @@ -0,0 +1,16 @@ +# 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__ = ["ProfileUpdateParams"] + + +class ProfileUpdateParams(TypedDict, total=False): + profile_id: Required[Annotated[str, PropertyInfo(alias="profileId")]] + """ID of the profile to apply""" + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/devices/proxy_connect_params.py b/src/mobilerun_sdk/types/devices/proxy_connect_params.py new file mode 100644 index 0000000..5afc504 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/proxy_connect_params.py @@ -0,0 +1,41 @@ +# 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__ = ["ProxyConnectParams", "Socks5"] + + +class ProxyConnectParams(TypedDict, total=False): + host: str + + name: str + """Proxy name""" + + password: str + + port: int + + smart_ip: Annotated[bool, PropertyInfo(alias="smartIp")] + + socks5: Socks5 + """SOCKS5 proxy configuration (required for socks5).""" + + user: str + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] + + +class Socks5(TypedDict, total=False): + """SOCKS5 proxy configuration (required for socks5).""" + + host: Required[str] + + port: Required[int] + + password: str + + user: str diff --git a/src/mobilerun_sdk/types/devices/proxy_status_response.py b/src/mobilerun_sdk/types/devices/proxy_status_response.py new file mode 100644 index 0000000..668f612 --- /dev/null +++ b/src/mobilerun_sdk/types/devices/proxy_status_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__ = ["ProxyStatusResponse"] + + +class ProxyStatusResponse(BaseModel): + connected: bool + + name: Optional[str] = None + """Active proxy name""" + + protocol: Optional[str] = None + """Active proxy protocol (socks5).""" + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/rect.py b/src/mobilerun_sdk/types/devices/rect.py new file mode 100644 index 0000000..1199a0e --- /dev/null +++ b/src/mobilerun_sdk/types/devices/rect.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Rect"] + + +class Rect(BaseModel): + height: int + + width: int diff --git a/src/mobilerun_sdk/types/devices/state_screenshot_params.py b/src/mobilerun_sdk/types/devices/state_screenshot_params.py new file mode 100644 index 0000000..fa4d0bd --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/state_screenshot_response.py b/src/mobilerun_sdk/types/devices/state_screenshot_response.py new file mode 100644 index 0000000..aaa4a93 --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/state_time_response.py b/src/mobilerun_sdk/types/devices/state_time_response.py new file mode 100644 index 0000000..6aed1eb --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/state_ui_params.py b/src/mobilerun_sdk/types/devices/state_ui_params.py new file mode 100644 index 0000000..de012d2 --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/state_ui_response.py b/src/mobilerun_sdk/types/devices/state_ui_response.py new file mode 100644 index 0000000..54fa0bc --- /dev/null +++ b/src/mobilerun_sdk/types/devices/state_ui_response.py @@ -0,0 +1,83 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .rect import Rect +from ..._models import BaseModel + +__all__ = [ + "StateUiResponse", + "DeviceContext", + "DeviceContextDisplayMetrics", + "DeviceContextFilteringParams", + "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 DeviceContext(BaseModel): + display_metrics: DeviceContextDisplayMetrics + + filtering_params: DeviceContextFilteringParams + + screen_bounds: Rect + + +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: "A11YNode" + + device_context: DeviceContext + + ime_tree: "A11YNode" + + phone_state: PhoneState + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" + + +from .a11_y_node import A11YNode diff --git a/src/mobilerun_sdk/types/devices/task_list_params.py b/src/mobilerun_sdk/types/devices/task_list_params.py new file mode 100644 index 0000000..6c98a67 --- /dev/null +++ b/src/mobilerun_sdk/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_sdk/types/devices/task_list_response.py b/src/mobilerun_sdk/types/devices/task_list_response.py new file mode 100644 index 0000000..a7243ed --- /dev/null +++ b/src/mobilerun_sdk/types/devices/task_list_response.py @@ -0,0 +1,28 @@ +# 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 +from ..shared.meta import Meta + +__all__ = ["TaskListResponse", "Item"] + + +class Item(BaseModel): + created_at: datetime = FieldInfo(alias="createdAt") + + task_id: str = FieldInfo(alias="taskId") + + updated_at: datetime = FieldInfo(alias="updatedAt") + + +class TaskListResponse(BaseModel): + items: Optional[List[Item]] = None + + pagination: Meta + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/timezone_get_response.py b/src/mobilerun_sdk/types/devices/timezone_get_response.py new file mode 100644 index 0000000..2eaa30d --- /dev/null +++ b/src/mobilerun_sdk/types/devices/timezone_get_response.py @@ -0,0 +1,16 @@ +# 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__ = ["TimezoneGetResponse"] + + +class TimezoneGetResponse(BaseModel): + timezone: Optional[str] = None + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/devices/timezone_set_params.py b/src/mobilerun_sdk/types/devices/timezone_set_params.py new file mode 100644 index 0000000..87172dc --- /dev/null +++ b/src/mobilerun_sdk/types/devices/timezone_set_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__ = ["TimezoneSetParams"] + + +class TimezoneSetParams(TypedDict, total=False): + timezone: Required[str] + + x_device_display_id: Annotated[int, PropertyInfo(alias="X-Device-Display-ID")] diff --git a/src/mobilerun_sdk/types/profile.py b/src/mobilerun_sdk/types/profile.py new file mode 100644 index 0000000..339eeb2 --- /dev/null +++ b/src/mobilerun_sdk/types/profile.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.device_spec import DeviceSpec + +__all__ = ["Profile"] + + +class Profile(BaseModel): + id: str + + created_at: datetime = FieldInfo(alias="createdAt") + + name: str + + spec: DeviceSpec + + updated_at: datetime = FieldInfo(alias="updatedAt") + + user_id: str = FieldInfo(alias="userId") + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/profile_create_params.py b/src/mobilerun_sdk/types/profile_create_params.py new file mode 100644 index 0000000..10e349a --- /dev/null +++ b/src/mobilerun_sdk/types/profile_create_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, TypedDict + +from .shared_params.device_spec import DeviceSpec + +__all__ = ["ProfileCreateParams"] + + +class ProfileCreateParams(TypedDict, total=False): + name: Required[str] + """Profile name""" + + spec: Required[DeviceSpec] + """Device specification""" diff --git a/src/mobilerun_sdk/types/profile_delete_response.py b/src/mobilerun_sdk/types/profile_delete_response.py new file mode 100644 index 0000000..319a3f4 --- /dev/null +++ b/src/mobilerun_sdk/types/profile_delete_response.py @@ -0,0 +1,16 @@ +# 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__ = ["ProfileDeleteResponse"] + + +class ProfileDeleteResponse(BaseModel): + message: str + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/profile_list_params.py b/src/mobilerun_sdk/types/profile_list_params.py new file mode 100644 index 0000000..db0a7a3 --- /dev/null +++ b/src/mobilerun_sdk/types/profile_list_params.py @@ -0,0 +1,21 @@ +# 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__ = ["ProfileListParams"] + + +class ProfileListParams(TypedDict, total=False): + name: str + + order_by: Annotated[Literal["name", "created_at", "updated_at"], 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_sdk/types/profile_list_response.py b/src/mobilerun_sdk/types/profile_list_response.py new file mode 100644 index 0000000..279dcbe --- /dev/null +++ b/src/mobilerun_sdk/types/profile_list_response.py @@ -0,0 +1,20 @@ +# 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 .profile import Profile +from .._models import BaseModel +from .shared.meta import Meta + +__all__ = ["ProfileListResponse"] + + +class ProfileListResponse(BaseModel): + items: Optional[List[Profile]] = None + + pagination: Meta + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/profile_update_params.py b/src/mobilerun_sdk/types/profile_update_params.py new file mode 100644 index 0000000..c332a19 --- /dev/null +++ b/src/mobilerun_sdk/types/profile_update_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, TypedDict + +from .shared_params.device_spec import DeviceSpec + +__all__ = ["ProfileUpdateParams"] + + +class ProfileUpdateParams(TypedDict, total=False): + name: Required[str] + """Profile name""" + + spec: Required[DeviceSpec] + """Device specification""" diff --git a/src/mobilerun_sdk/types/proxy_lookup_params.py b/src/mobilerun_sdk/types/proxy_lookup_params.py new file mode 100644 index 0000000..43b7464 --- /dev/null +++ b/src/mobilerun_sdk/types/proxy_lookup_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, TypedDict + +__all__ = ["ProxyLookupParams", "Socks5"] + + +class ProxyLookupParams(TypedDict, total=False): + socks5: Required[Socks5] + """SOCKS5 proxy configuration.""" + + +class Socks5(TypedDict, total=False): + """SOCKS5 proxy configuration.""" + + host: Required[str] + + port: Required[int] + + password: str + + user: str diff --git a/src/mobilerun_sdk/types/proxy_lookup_response.py b/src/mobilerun_sdk/types/proxy_lookup_response.py new file mode 100644 index 0000000..6e4e88f --- /dev/null +++ b/src/mobilerun_sdk/types/proxy_lookup_response.py @@ -0,0 +1,57 @@ +# 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__ = ["ProxyLookupResponse", "Carrier"] + + +class Carrier(BaseModel): + """Mobile carrier information.""" + + mcc: Optional[str] = None + """Mobile Country Code.""" + + mnc: Optional[str] = None + """Mobile Network Code.""" + + name: Optional[str] = None + """Carrier name.""" + + +class ProxyLookupResponse(BaseModel): + ip: str + """IP address of the proxy.""" + + is_mobile: bool = FieldInfo(alias="isMobile") + """Whether the IP is a mobile connection.""" + + latitude: float + """Latitude of the proxy.""" + + longitude: float + """Longitude of the proxy.""" + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" + + carrier: Optional[Carrier] = None + """Mobile carrier information.""" + + city: Optional[str] = None + """City of the proxy.""" + + country: Optional[str] = None + """Country of the proxy.""" + + country_code: Optional[str] = FieldInfo(alias="countryCode", default=None) + """ISO country code.""" + + region: Optional[str] = None + """Region of the proxy.""" + + timezone: Optional[str] = None + """Timezone of the proxy.""" diff --git a/src/mobilerun_sdk/types/shared/__init__.py b/src/mobilerun_sdk/types/shared/__init__.py index 90fbaba..7d0f116 100644 --- a/src/mobilerun_sdk/types/shared/__init__.py +++ b/src/mobilerun_sdk/types/shared/__init__.py @@ -1,4 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .meta import Meta as Meta +from .socks5 import Socks5 as Socks5 +from .location import Location as Location from .pagination import Pagination as Pagination +from .device_spec import DeviceSpec as DeviceSpec +from .device_carrier import DeviceCarrier as DeviceCarrier +from .permission_set import PermissionSet as PermissionSet from .pagination_meta import PaginationMeta as PaginationMeta +from .device_identifiers import DeviceIdentifiers as DeviceIdentifiers diff --git a/src/mobilerun_sdk/types/shared/device_carrier.py b/src/mobilerun_sdk/types/shared/device_carrier.py new file mode 100644 index 0000000..55e9d45 --- /dev/null +++ b/src/mobilerun_sdk/types/shared/device_carrier.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["DeviceCarrier"] + + +class DeviceCarrier(BaseModel): + gsm_operator_alpha: str = FieldInfo(alias="GsmOperatorAlpha") + + gsm_operator_numeric: int = FieldInfo(alias="GsmOperatorNumeric") + + gsm_sim_operator_alpha: str = FieldInfo(alias="GsmSimOperatorAlpha") + + gsm_sim_operator_iso_country: str = FieldInfo(alias="GsmSimOperatorIsoCountry") + + gsm_sim_operator_numeric: int = FieldInfo(alias="GsmSimOperatorNumeric") + + persist_sys_timezone: str = FieldInfo(alias="PersistSysTimezone") diff --git a/src/mobilerun_sdk/types/shared/device_identifiers.py b/src/mobilerun_sdk/types/shared/device_identifiers.py new file mode 100644 index 0000000..90d4bf1 --- /dev/null +++ b/src/mobilerun_sdk/types/shared/device_identifiers.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["DeviceIdentifiers"] + + +class DeviceIdentifiers(BaseModel): + bootloader_serial_number: str = FieldInfo(alias="BootloaderSerialNumber") + + identifier_android_id: str = FieldInfo(alias="IdentifierAndroidID") + + identifier_app_set_id: str = FieldInfo(alias="IdentifierAppSetID") + + identifier_bluetooth_mac: str = FieldInfo(alias="IdentifierBluetoothMAC") + + identifier_gaid: str = FieldInfo(alias="IdentifierGAID") + + identifier_gsfid: str = FieldInfo(alias="IdentifierGSFID") + + identifier_iccid: str = FieldInfo(alias="IdentifierICCID") + + identifier_imei: str = FieldInfo(alias="IdentifierIMEI") + + identifier_imsi: str = FieldInfo(alias="IdentifierIMSI") + + identifier_media_drmid: str = FieldInfo(alias="IdentifierMediaDRMID") + + identifier_meid: str = FieldInfo(alias="IdentifierMEID") + + identifier_phone_number: str = FieldInfo(alias="IdentifierPhoneNumber") + + identifier_serial: str = FieldInfo(alias="IdentifierSerial") + + identifier_wifi_mac: str = FieldInfo(alias="IdentifierWifiMAC") + + serial_number: str = FieldInfo(alias="SerialNumber") diff --git a/src/mobilerun_sdk/types/shared/device_spec.py b/src/mobilerun_sdk/types/shared/device_spec.py new file mode 100644 index 0000000..64614c9 --- /dev/null +++ b/src/mobilerun_sdk/types/shared/device_spec.py @@ -0,0 +1,48 @@ +# 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 .socks5 import Socks5 +from .location import Location +from ..._models import BaseModel +from .device_carrier import DeviceCarrier +from .device_identifiers import DeviceIdentifiers + +__all__ = ["DeviceSpec", "Proxy"] + + +class Proxy(BaseModel): + name: Optional[str] = None + + smart_ip: Optional[bool] = FieldInfo(alias="smartIp", default=None) + + socks5: Optional[Socks5] = None + + +class DeviceSpec(BaseModel): + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" + + android_version: Optional[int] = FieldInfo(alias="androidVersion", default=None) + + apps: Optional[List[str]] = None + + carrier: Optional[DeviceCarrier] = None + + country: Optional[str] = None + + files: Optional[List[str]] = None + + identifiers: Optional[DeviceIdentifiers] = None + + locale: Optional[str] = None + + location: Optional[Location] = None + + name: Optional[str] = None + + proxy: Optional[Proxy] = None + + timezone: Optional[str] = None diff --git a/src/mobilerun_sdk/types/shared/location.py b/src/mobilerun_sdk/types/shared/location.py new file mode 100644 index 0000000..bf0a32a --- /dev/null +++ b/src/mobilerun_sdk/types/shared/location.py @@ -0,0 +1,18 @@ +# 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__ = ["Location"] + + +class Location(BaseModel): + latitude: float + + longitude: float + + schema_: Optional[str] = FieldInfo(alias="$schema", default=None) + """A URL to the JSON Schema for this object.""" diff --git a/src/mobilerun_sdk/types/shared/meta.py b/src/mobilerun_sdk/types/shared/meta.py new file mode 100644 index 0000000..cf6beca --- /dev/null +++ b/src/mobilerun_sdk/types/shared/meta.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["Meta"] + + +class Meta(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 diff --git a/src/mobilerun_sdk/types/shared/permission_set.py b/src/mobilerun_sdk/types/shared/permission_set.py new file mode 100644 index 0000000..79284d2 --- /dev/null +++ b/src/mobilerun_sdk/types/shared/permission_set.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["PermissionSet"] + + +class PermissionSet(BaseModel): + execute: bool + + read: bool + + write: bool diff --git a/src/mobilerun_sdk/types/shared/socks5.py b/src/mobilerun_sdk/types/shared/socks5.py new file mode 100644 index 0000000..36791bd --- /dev/null +++ b/src/mobilerun_sdk/types/shared/socks5.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Socks5"] + + +class Socks5(BaseModel): + host: str + + password: str + + port: int + + user: str diff --git a/src/mobilerun_sdk/types/shared_params/__init__.py b/src/mobilerun_sdk/types/shared_params/__init__.py new file mode 100644 index 0000000..0b4dbfb --- /dev/null +++ b/src/mobilerun_sdk/types/shared_params/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .socks5 import Socks5 as Socks5 +from .location import Location as Location +from .device_spec import DeviceSpec as DeviceSpec +from .device_carrier import DeviceCarrier as DeviceCarrier +from .device_identifiers import DeviceIdentifiers as DeviceIdentifiers diff --git a/src/mobilerun_sdk/types/shared_params/device_carrier.py b/src/mobilerun_sdk/types/shared_params/device_carrier.py new file mode 100644 index 0000000..0b0c162 --- /dev/null +++ b/src/mobilerun_sdk/types/shared_params/device_carrier.py @@ -0,0 +1,23 @@ +# 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__ = ["DeviceCarrier"] + + +class DeviceCarrier(TypedDict, total=False): + gsm_operator_alpha: Required[Annotated[str, PropertyInfo(alias="GsmOperatorAlpha")]] + + gsm_operator_numeric: Required[Annotated[int, PropertyInfo(alias="GsmOperatorNumeric")]] + + gsm_sim_operator_alpha: Required[Annotated[str, PropertyInfo(alias="GsmSimOperatorAlpha")]] + + gsm_sim_operator_iso_country: Required[Annotated[str, PropertyInfo(alias="GsmSimOperatorIsoCountry")]] + + gsm_sim_operator_numeric: Required[Annotated[int, PropertyInfo(alias="GsmSimOperatorNumeric")]] + + persist_sys_timezone: Required[Annotated[str, PropertyInfo(alias="PersistSysTimezone")]] diff --git a/src/mobilerun_sdk/types/shared_params/device_identifiers.py b/src/mobilerun_sdk/types/shared_params/device_identifiers.py new file mode 100644 index 0000000..528ae53 --- /dev/null +++ b/src/mobilerun_sdk/types/shared_params/device_identifiers.py @@ -0,0 +1,41 @@ +# 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__ = ["DeviceIdentifiers"] + + +class DeviceIdentifiers(TypedDict, total=False): + bootloader_serial_number: Required[Annotated[str, PropertyInfo(alias="BootloaderSerialNumber")]] + + identifier_android_id: Required[Annotated[str, PropertyInfo(alias="IdentifierAndroidID")]] + + identifier_app_set_id: Required[Annotated[str, PropertyInfo(alias="IdentifierAppSetID")]] + + identifier_bluetooth_mac: Required[Annotated[str, PropertyInfo(alias="IdentifierBluetoothMAC")]] + + identifier_gaid: Required[Annotated[str, PropertyInfo(alias="IdentifierGAID")]] + + identifier_gsfid: Required[Annotated[str, PropertyInfo(alias="IdentifierGSFID")]] + + identifier_iccid: Required[Annotated[str, PropertyInfo(alias="IdentifierICCID")]] + + identifier_imei: Required[Annotated[str, PropertyInfo(alias="IdentifierIMEI")]] + + identifier_imsi: Required[Annotated[str, PropertyInfo(alias="IdentifierIMSI")]] + + identifier_media_drmid: Required[Annotated[str, PropertyInfo(alias="IdentifierMediaDRMID")]] + + identifier_meid: Required[Annotated[str, PropertyInfo(alias="IdentifierMEID")]] + + identifier_phone_number: Required[Annotated[str, PropertyInfo(alias="IdentifierPhoneNumber")]] + + identifier_serial: Required[Annotated[str, PropertyInfo(alias="IdentifierSerial")]] + + identifier_wifi_mac: Required[Annotated[str, PropertyInfo(alias="IdentifierWifiMAC")]] + + serial_number: Required[Annotated[str, PropertyInfo(alias="SerialNumber")]] diff --git a/src/mobilerun_sdk/types/shared_params/device_spec.py b/src/mobilerun_sdk/types/shared_params/device_spec.py new file mode 100644 index 0000000..7d1a43e --- /dev/null +++ b/src/mobilerun_sdk/types/shared_params/device_spec.py @@ -0,0 +1,47 @@ +# 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 Annotated, TypedDict + +from .socks5 import Socks5 +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo +from .location import Location +from .device_carrier import DeviceCarrier +from .device_identifiers import DeviceIdentifiers + +__all__ = ["DeviceSpec", "Proxy"] + + +class Proxy(TypedDict, total=False): + name: str + + smart_ip: Annotated[bool, PropertyInfo(alias="smartIp")] + + socks5: Socks5 + + +class DeviceSpec(TypedDict, total=False): + android_version: Annotated[int, PropertyInfo(alias="androidVersion")] + + apps: Optional[SequenceNotStr[str]] + + carrier: DeviceCarrier + + country: str + + files: Optional[SequenceNotStr[str]] + + identifiers: DeviceIdentifiers + + locale: str + + location: Location + + name: str + + proxy: Proxy + + timezone: str diff --git a/src/mobilerun_sdk/types/shared_params/location.py b/src/mobilerun_sdk/types/shared_params/location.py new file mode 100644 index 0000000..49198dc --- /dev/null +++ b/src/mobilerun_sdk/types/shared_params/location.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["Location"] + + +class Location(TypedDict, total=False): + latitude: Required[float] + + longitude: Required[float] diff --git a/src/mobilerun_sdk/types/shared_params/socks5.py b/src/mobilerun_sdk/types/shared_params/socks5.py new file mode 100644 index 0000000..0e56d16 --- /dev/null +++ b/src/mobilerun_sdk/types/shared_params/socks5.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, TypedDict + +__all__ = ["Socks5"] + + +class Socks5(TypedDict, total=False): + host: Required[str] + + password: Required[str] + + port: Required[int] + + user: Required[str] diff --git a/tests/api_resources/connect/test_countries.py b/tests/api_resources/connect/test_countries.py index e7d88fc..dc5b792 100644 --- a/tests/api_resources/connect/test_countries.py +++ b/tests/api_resources/connect/test_countries.py @@ -29,7 +29,7 @@ def test_method_list_with_all_params(self, client: Mobilerun) -> None: country = client.connect.countries.list( page=1, page_size=1, - type="residential", + type="dedicated_residential", ) assert_matches_type(CountryListResponse, country, path=["response"]) @@ -73,7 +73,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) - country = await async_client.connect.countries.list( page=1, page_size=1, - type="residential", + type="dedicated_residential", ) assert_matches_type(CountryListResponse, country, path=["response"]) diff --git a/tests/api_resources/connect/test_proxies.py b/tests/api_resources/connect/test_proxies.py index 6442710..a3094d5 100644 --- a/tests/api_resources/connect/test_proxies.py +++ b/tests/api_resources/connect/test_proxies.py @@ -117,7 +117,7 @@ def test_method_buy(self, client: Mobilerun) -> None: def test_method_buy_with_all_params(self, client: Mobilerun) -> None: proxy = client.connect.proxies.buy( country="country", - type="residential", + type="dedicated_residential", ) assert_matches_type(ProxyBuyResponse, proxy, path=["response"]) @@ -405,7 +405,7 @@ async def test_method_buy(self, async_client: AsyncMobilerun) -> None: async def test_method_buy_with_all_params(self, async_client: AsyncMobilerun) -> None: proxy = await async_client.connect.proxies.buy( country="country", - type="residential", + type="dedicated_residential", ) assert_matches_type(ProxyBuyResponse, proxy, path=["response"]) 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..bec389f --- /dev/null +++ b/tests/api_resources/devices/test_actions.py @@ -0,0 +1,630 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.devices import ( + ActionOverlayVisibleResponse, +) + +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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + def test_method_overlay_visible(self, client: Mobilerun) -> None: + action = client.devices.actions.overlay_visible( + device_id="deviceId", + ) + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_overlay_visible_with_all_params(self, client: Mobilerun) -> None: + action = client.devices.actions.overlay_visible( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_overlay_visible(self, client: Mobilerun) -> None: + response = client.devices.actions.with_raw_response.overlay_visible( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = response.parse() + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_overlay_visible(self, client: Mobilerun) -> None: + with client.devices.actions.with_streaming_response.overlay_visible( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = response.parse() + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_overlay_visible(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.overlay_visible( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set_overlay_visible(self, client: Mobilerun) -> None: + action = client.devices.actions.set_overlay_visible( + device_id="deviceId", + visible=True, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set_overlay_visible_with_all_params(self, client: Mobilerun) -> None: + action = client.devices.actions.set_overlay_visible( + device_id="deviceId", + visible=True, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_set_overlay_visible(self, client: Mobilerun) -> None: + response = client.devices.actions.with_raw_response.set_overlay_visible( + device_id="deviceId", + visible=True, + ) + + 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="Mock server tests are disabled") + @parametrize + def test_streaming_response_set_overlay_visible(self, client: Mobilerun) -> None: + with client.devices.actions.with_streaming_response.set_overlay_visible( + device_id="deviceId", + visible=True, + ) 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="Mock server tests are disabled") + @parametrize + def test_path_params_set_overlay_visible(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.set_overlay_visible( + device_id="", + visible=True, + ) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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, + stealth=True, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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, + stealth=True, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + async def test_method_overlay_visible(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.overlay_visible( + device_id="deviceId", + ) + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_overlay_visible_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.overlay_visible( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_overlay_visible(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.actions.with_raw_response.overlay_visible( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + action = await response.parse() + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_overlay_visible(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.actions.with_streaming_response.overlay_visible( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + action = await response.parse() + assert_matches_type(ActionOverlayVisibleResponse, action, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_overlay_visible(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.overlay_visible( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set_overlay_visible(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.set_overlay_visible( + device_id="deviceId", + visible=True, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set_overlay_visible_with_all_params(self, async_client: AsyncMobilerun) -> None: + action = await async_client.devices.actions.set_overlay_visible( + device_id="deviceId", + visible=True, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_set_overlay_visible(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.actions.with_raw_response.set_overlay_visible( + device_id="deviceId", + visible=True, + ) + + 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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_set_overlay_visible(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.actions.with_streaming_response.set_overlay_visible( + device_id="deviceId", + visible=True, + ) 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="Mock server tests are disabled") + @parametrize + async def test_path_params_set_overlay_visible(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.set_overlay_visible( + device_id="", + visible=True, + ) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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, + stealth=True, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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, + stealth=True, + x_device_display_id=0, + ) + assert action is None + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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..1826542 --- /dev/null +++ b/tests/api_resources/devices/test_apps.py @@ -0,0 +1,736 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.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="Mock server 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="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + app = client.devices.apps.list( + device_id="deviceId", + include_protected_apps=True, + include_system_apps=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + def test_method_install_overload_1(self, client: Mobilerun) -> None: + app = client.devices.apps.install( + device_id="deviceId", + bundle_id="x", + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_install_with_all_params_overload_1(self, client: Mobilerun) -> None: + app = client.devices.apps.install( + device_id="deviceId", + bundle_id="x", + package_name="x", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_install_overload_1(self, client: Mobilerun) -> None: + response = client.devices.apps.with_raw_response.install( + device_id="deviceId", + bundle_id="x", + ) + + 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="Mock server tests are disabled") + @parametrize + def test_streaming_response_install_overload_1(self, client: Mobilerun) -> None: + with client.devices.apps.with_streaming_response.install( + device_id="deviceId", + bundle_id="x", + ) 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="Mock server tests are disabled") + @parametrize + def test_path_params_install_overload_1(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="", + bundle_id="x", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_install_overload_2(self, client: Mobilerun) -> None: + app = client.devices.apps.install( + device_id="deviceId", + package_name="x", + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_install_with_all_params_overload_2(self, client: Mobilerun) -> None: + app = client.devices.apps.install( + device_id="deviceId", + package_name="x", + bundle_id="x", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_install_overload_2(self, client: Mobilerun) -> None: + response = client.devices.apps.with_raw_response.install( + device_id="deviceId", + package_name="x", + ) + + 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="Mock server tests are disabled") + @parametrize + def test_streaming_response_install_overload_2(self, client: Mobilerun) -> None: + with client.devices.apps.with_streaming_response.install( + device_id="deviceId", + package_name="x", + ) 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="Mock server tests are disabled") + @parametrize + def test_path_params_install_overload_2(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="x", + ) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_stop(self, client: Mobilerun) -> None: + app = client.devices.apps.stop( + package_name="packageName", + device_id="deviceId", + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_stop_with_all_params(self, client: Mobilerun) -> None: + app = client.devices.apps.stop( + package_name="packageName", + device_id="deviceId", + clear_data=True, + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_stop(self, client: Mobilerun) -> None: + response = client.devices.apps.with_raw_response.stop( + 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="Mock server tests are disabled") + @parametrize + def test_streaming_response_stop(self, client: Mobilerun) -> None: + with client.devices.apps.with_streaming_response.stop( + 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="Mock server tests are disabled") + @parametrize + def test_path_params_stop(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.stop( + 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.stop( + 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="Mock server 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="Mock server 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_protected_apps=True, + include_system_apps=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[AppListResponse], app, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + async def test_method_install_overload_1(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.install( + device_id="deviceId", + bundle_id="x", + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_install_with_all_params_overload_1(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.install( + device_id="deviceId", + bundle_id="x", + package_name="x", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_install_overload_1(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.apps.with_raw_response.install( + device_id="deviceId", + bundle_id="x", + ) + + 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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_install_overload_1(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.apps.with_streaming_response.install( + device_id="deviceId", + bundle_id="x", + ) 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="Mock server tests are disabled") + @parametrize + async def test_path_params_install_overload_1(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="", + bundle_id="x", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_install_overload_2(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.install( + device_id="deviceId", + package_name="x", + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_install_with_all_params_overload_2(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.install( + device_id="deviceId", + package_name="x", + bundle_id="x", + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_install_overload_2(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.apps.with_raw_response.install( + device_id="deviceId", + package_name="x", + ) + + 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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_install_overload_2(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.apps.with_streaming_response.install( + device_id="deviceId", + package_name="x", + ) 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="Mock server tests are disabled") + @parametrize + async def test_path_params_install_overload_2(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="x", + ) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_stop(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.stop( + package_name="packageName", + device_id="deviceId", + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_stop_with_all_params(self, async_client: AsyncMobilerun) -> None: + app = await async_client.devices.apps.stop( + package_name="packageName", + device_id="deviceId", + clear_data=True, + x_device_display_id=0, + ) + assert app is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_stop(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.apps.with_raw_response.stop( + 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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_stop(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.apps.with_streaming_response.stop( + 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="Mock server tests are disabled") + @parametrize + async def test_path_params_stop(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.stop( + 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.stop( + package_name="", + device_id="deviceId", + ) diff --git a/tests/api_resources/devices/test_esim.py b/tests/api_resources/devices/test_esim.py new file mode 100644 index 0000000..3ff9449 --- /dev/null +++ b/tests/api_resources/devices/test_esim.py @@ -0,0 +1,479 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.devices import ( + EsimListResponse, + EsimActivateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEsim: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + esim = client.devices.esim.list( + device_id="deviceId", + ) + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + esim = client.devices.esim.list( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.devices.esim.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = response.parse() + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.devices.esim.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = response.parse() + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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.esim.with_raw_response.list( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_activate(self, client: Mobilerun) -> None: + esim = client.devices.esim.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + ) + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_activate_with_all_params(self, client: Mobilerun) -> None: + esim = client.devices.esim.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + confirmation_code="confirmationCode", + matching_id="matchingId", + x_device_display_id=0, + ) + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_activate(self, client: Mobilerun) -> None: + response = client.devices.esim.with_raw_response.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = response.parse() + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_activate(self, client: Mobilerun) -> None: + with client.devices.esim.with_streaming_response.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = response.parse() + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_activate(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.esim.with_raw_response.activate( + device_id="", + enable=True, + sm_dp_addr="smDpAddr", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_enable(self, client: Mobilerun) -> None: + esim = client.devices.esim.enable( + device_id="deviceId", + sub_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_enable_with_all_params(self, client: Mobilerun) -> None: + esim = client.devices.esim.enable( + device_id="deviceId", + sub_id=0, + x_device_display_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_enable(self, client: Mobilerun) -> None: + response = client.devices.esim.with_raw_response.enable( + device_id="deviceId", + sub_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = response.parse() + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_enable(self, client: Mobilerun) -> None: + with client.devices.esim.with_streaming_response.enable( + device_id="deviceId", + sub_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = response.parse() + assert esim is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_enable(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.esim.with_raw_response.enable( + device_id="", + sub_id=0, + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_remove(self, client: Mobilerun) -> None: + esim = client.devices.esim.remove( + device_id="deviceId", + sub_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_remove_with_all_params(self, client: Mobilerun) -> None: + esim = client.devices.esim.remove( + device_id="deviceId", + sub_id=0, + x_device_display_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_remove(self, client: Mobilerun) -> None: + response = client.devices.esim.with_raw_response.remove( + device_id="deviceId", + sub_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = response.parse() + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_remove(self, client: Mobilerun) -> None: + with client.devices.esim.with_streaming_response.remove( + device_id="deviceId", + sub_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = response.parse() + assert esim is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_remove(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.esim.with_raw_response.remove( + device_id="", + sub_id=0, + ) + + +class TestAsyncEsim: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.list( + device_id="deviceId", + ) + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.list( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.esim.with_raw_response.list( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = await response.parse() + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.esim.with_streaming_response.list( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = await response.parse() + assert_matches_type(Optional[EsimListResponse], esim, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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.esim.with_raw_response.list( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_activate(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + ) + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_activate_with_all_params(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + confirmation_code="confirmationCode", + matching_id="matchingId", + x_device_display_id=0, + ) + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_activate(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.esim.with_raw_response.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = await response.parse() + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_activate(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.esim.with_streaming_response.activate( + device_id="deviceId", + enable=True, + sm_dp_addr="smDpAddr", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = await response.parse() + assert_matches_type(EsimActivateResponse, esim, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_activate(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.esim.with_raw_response.activate( + device_id="", + enable=True, + sm_dp_addr="smDpAddr", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_enable(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.enable( + device_id="deviceId", + sub_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_enable_with_all_params(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.enable( + device_id="deviceId", + sub_id=0, + x_device_display_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_enable(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.esim.with_raw_response.enable( + device_id="deviceId", + sub_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = await response.parse() + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_enable(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.esim.with_streaming_response.enable( + device_id="deviceId", + sub_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = await response.parse() + assert esim is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_enable(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.esim.with_raw_response.enable( + device_id="", + sub_id=0, + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_remove(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.remove( + device_id="deviceId", + sub_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_remove_with_all_params(self, async_client: AsyncMobilerun) -> None: + esim = await async_client.devices.esim.remove( + device_id="deviceId", + sub_id=0, + x_device_display_id=0, + ) + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_remove(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.esim.with_raw_response.remove( + device_id="deviceId", + sub_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + esim = await response.parse() + assert esim is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_remove(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.esim.with_streaming_response.remove( + device_id="deviceId", + sub_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + esim = await response.parse() + assert esim is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_remove(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.esim.with_raw_response.remove( + device_id="", + sub_id=0, + ) diff --git a/tests/api_resources/devices/test_files.py b/tests/api_resources/devices/test_files.py new file mode 100644 index 0000000..1b56622 --- /dev/null +++ b/tests/api_resources/devices/test_files.py @@ -0,0 +1,484 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.devices import ( + FileListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFiles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + file = client.devices.files.list( + device_id="deviceId", + path="path", + ) + assert_matches_type(FileListResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + file = client.devices.files.list( + device_id="deviceId", + path="path", + x_device_display_id=0, + ) + assert_matches_type(FileListResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.devices.files.with_raw_response.list( + device_id="deviceId", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(FileListResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.devices.files.with_streaming_response.list( + device_id="deviceId", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileListResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.list( + device_id="", + path="path", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete(self, client: Mobilerun) -> None: + file = client.devices.files.delete( + device_id="deviceId", + path="path", + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete_with_all_params(self, client: Mobilerun) -> None: + file = client.devices.files.delete( + device_id="deviceId", + path="path", + x_device_display_id=0, + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Mobilerun) -> None: + response = client.devices.files.with_raw_response.delete( + device_id="deviceId", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Mobilerun) -> None: + with client.devices.files.with_streaming_response.delete( + device_id="deviceId", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert file is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.delete( + device_id="", + path="path", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_download(self, client: Mobilerun) -> None: + file = client.devices.files.download( + device_id="deviceId", + path="path", + ) + assert_matches_type(str, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_download_with_all_params(self, client: Mobilerun) -> None: + file = client.devices.files.download( + device_id="deviceId", + path="path", + x_device_display_id=0, + ) + assert_matches_type(str, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_download(self, client: Mobilerun) -> None: + response = client.devices.files.with_raw_response.download( + device_id="deviceId", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(str, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_download(self, client: Mobilerun) -> None: + with client.devices.files.with_streaming_response.download( + device_id="deviceId", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(str, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_download(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.files.with_raw_response.download( + device_id="", + path="path", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_upload(self, client: Mobilerun) -> None: + file = client.devices.files.upload( + device_id="deviceId", + path="path", + file=b"Example data", + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_upload_with_all_params(self, client: Mobilerun) -> None: + file = client.devices.files.upload( + device_id="deviceId", + path="path", + file=b"Example data", + x_device_display_id=0, + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_upload(self, client: Mobilerun) -> None: + response = client.devices.files.with_raw_response.upload( + device_id="deviceId", + path="path", + file=b"Example data", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_upload(self, client: Mobilerun) -> None: + with client.devices.files.with_streaming_response.upload( + device_id="deviceId", + path="path", + file=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert file is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_upload(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.files.with_raw_response.upload( + device_id="", + path="path", + file=b"Example data", + ) + + +class TestAsyncFiles: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.list( + device_id="deviceId", + path="path", + ) + assert_matches_type(FileListResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.list( + device_id="deviceId", + path="path", + x_device_display_id=0, + ) + assert_matches_type(FileListResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.files.with_raw_response.list( + device_id="deviceId", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(FileListResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.files.with_streaming_response.list( + device_id="deviceId", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileListResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.list( + device_id="", + path="path", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.delete( + device_id="deviceId", + path="path", + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.delete( + device_id="deviceId", + path="path", + x_device_display_id=0, + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.files.with_raw_response.delete( + device_id="deviceId", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.files.with_streaming_response.delete( + device_id="deviceId", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert file is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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.files.with_raw_response.delete( + device_id="", + path="path", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_download(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.download( + device_id="deviceId", + path="path", + ) + assert_matches_type(str, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_download_with_all_params(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.download( + device_id="deviceId", + path="path", + x_device_display_id=0, + ) + assert_matches_type(str, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_download(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.files.with_raw_response.download( + device_id="deviceId", + path="path", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(str, file, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_download(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.files.with_streaming_response.download( + device_id="deviceId", + path="path", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(str, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_download(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.files.with_raw_response.download( + device_id="", + path="path", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_upload(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.upload( + device_id="deviceId", + path="path", + file=b"Example data", + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_upload_with_all_params(self, async_client: AsyncMobilerun) -> None: + file = await async_client.devices.files.upload( + device_id="deviceId", + path="path", + file=b"Example data", + x_device_display_id=0, + ) + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_upload(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.files.with_raw_response.upload( + device_id="deviceId", + path="path", + file=b"Example data", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert file is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_upload(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.files.with_streaming_response.upload( + device_id="deviceId", + path="path", + file=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert file is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_upload(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.files.with_raw_response.upload( + device_id="", + path="path", + file=b"Example data", + ) diff --git a/tests/api_resources/devices/test_keyboard.py b/tests/api_resources/devices/test_keyboard.py new file mode 100644 index 0000000..766a63b --- /dev/null +++ b/tests/api_resources/devices/test_keyboard.py @@ -0,0 +1,356 @@ +# 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_sdk 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + def test_method_write(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.write( + device_id="deviceId", + text="text", + ) + assert keyboard is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_write_with_all_params(self, client: Mobilerun) -> None: + keyboard = client.devices.keyboard.write( + device_id="deviceId", + text="text", + clear=True, + error_rate=0, + stealth=True, + wpm=0, + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_write(self, client: Mobilerun) -> None: + response = client.devices.keyboard.with_raw_response.write( + device_id="deviceId", + 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="Mock server tests are disabled") + @parametrize + def test_streaming_response_write(self, client: Mobilerun) -> None: + with client.devices.keyboard.with_streaming_response.write( + device_id="deviceId", + 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="Mock server 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="", + 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + async def test_method_write(self, async_client: AsyncMobilerun) -> None: + keyboard = await async_client.devices.keyboard.write( + device_id="deviceId", + text="text", + ) + assert keyboard is None + + @pytest.mark.skip(reason="Mock server 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", + text="text", + clear=True, + error_rate=0, + stealth=True, + wpm=0, + x_device_display_id=0, + ) + assert keyboard is None + + @pytest.mark.skip(reason="Mock server 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", + 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="Mock server 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", + 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="Mock server 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="", + text="text", + ) diff --git a/tests/api_resources/devices/test_language.py b/tests/api_resources/devices/test_language.py new file mode 100644 index 0000000..c38f4dd --- /dev/null +++ b/tests/api_resources/devices/test_language.py @@ -0,0 +1,240 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.devices import LanguageGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLanguage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get(self, client: Mobilerun) -> None: + language = client.devices.language.get( + device_id="deviceId", + ) + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get_with_all_params(self, client: Mobilerun) -> None: + language = client.devices.language.get( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_get(self, client: Mobilerun) -> None: + response = client.devices.language.with_raw_response.get( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = response.parse() + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_get(self, client: Mobilerun) -> None: + with client.devices.language.with_streaming_response.get( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = response.parse() + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_get(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.language.with_raw_response.get( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set(self, client: Mobilerun) -> None: + language = client.devices.language.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + ) + assert language is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set_with_all_params(self, client: Mobilerun) -> None: + language = client.devices.language.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + restart=True, + x_device_display_id=0, + ) + assert language is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_set(self, client: Mobilerun) -> None: + response = client.devices.language.with_raw_response.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = response.parse() + assert language is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_set(self, client: Mobilerun) -> None: + with client.devices.language.with_streaming_response.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = response.parse() + assert language is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_set(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.language.with_raw_response.set( + device_id="", + locale="sqf-Kkif-BB", + ) + + +class TestAsyncLanguage: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncMobilerun) -> None: + language = await async_client.devices.language.get( + device_id="deviceId", + ) + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncMobilerun) -> None: + language = await async_client.devices.language.get( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.language.with_raw_response.get( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = await response.parse() + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.language.with_streaming_response.get( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = await response.parse() + assert_matches_type(LanguageGetResponse, language, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_get(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.language.with_raw_response.get( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set(self, async_client: AsyncMobilerun) -> None: + language = await async_client.devices.language.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + ) + assert language is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set_with_all_params(self, async_client: AsyncMobilerun) -> None: + language = await async_client.devices.language.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + restart=True, + x_device_display_id=0, + ) + assert language is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_set(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.language.with_raw_response.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + language = await response.parse() + assert language is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_set(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.language.with_streaming_response.set( + device_id="deviceId", + locale="sqf-Kkif-BB", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + language = await response.parse() + assert language is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_set(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.language.with_raw_response.set( + device_id="", + locale="sqf-Kkif-BB", + ) diff --git a/tests/api_resources/devices/test_location.py b/tests/api_resources/devices/test_location.py new file mode 100644 index 0000000..2ec5cb0 --- /dev/null +++ b/tests/api_resources/devices/test_location.py @@ -0,0 +1,248 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.shared import Location + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLocation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get(self, client: Mobilerun) -> None: + location = client.devices.location.get( + device_id="deviceId", + ) + assert_matches_type(Location, location, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get_with_all_params(self, client: Mobilerun) -> None: + location = client.devices.location.get( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(Location, location, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_get(self, client: Mobilerun) -> None: + response = client.devices.location.with_raw_response.get( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = response.parse() + assert_matches_type(Location, location, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_get(self, client: Mobilerun) -> None: + with client.devices.location.with_streaming_response.get( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = response.parse() + assert_matches_type(Location, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_get(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.location.with_raw_response.get( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set(self, client: Mobilerun) -> None: + location = client.devices.location.set( + device_id="deviceId", + latitude=0, + longitude=0, + ) + assert location is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set_with_all_params(self, client: Mobilerun) -> None: + location = client.devices.location.set( + device_id="deviceId", + latitude=0, + longitude=0, + x_device_display_id=0, + ) + assert location is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_set(self, client: Mobilerun) -> None: + response = client.devices.location.with_raw_response.set( + device_id="deviceId", + latitude=0, + longitude=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = response.parse() + assert location is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_set(self, client: Mobilerun) -> None: + with client.devices.location.with_streaming_response.set( + device_id="deviceId", + latitude=0, + longitude=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = response.parse() + assert location is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_set(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.location.with_raw_response.set( + device_id="", + latitude=0, + longitude=0, + ) + + +class TestAsyncLocation: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncMobilerun) -> None: + location = await async_client.devices.location.get( + device_id="deviceId", + ) + assert_matches_type(Location, location, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncMobilerun) -> None: + location = await async_client.devices.location.get( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(Location, location, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.location.with_raw_response.get( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = await response.parse() + assert_matches_type(Location, location, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.location.with_streaming_response.get( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = await response.parse() + assert_matches_type(Location, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_get(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.location.with_raw_response.get( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set(self, async_client: AsyncMobilerun) -> None: + location = await async_client.devices.location.set( + device_id="deviceId", + latitude=0, + longitude=0, + ) + assert location is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set_with_all_params(self, async_client: AsyncMobilerun) -> None: + location = await async_client.devices.location.set( + device_id="deviceId", + latitude=0, + longitude=0, + x_device_display_id=0, + ) + assert location is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_set(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.location.with_raw_response.set( + device_id="deviceId", + latitude=0, + longitude=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = await response.parse() + assert location is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_set(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.location.with_streaming_response.set( + device_id="deviceId", + latitude=0, + longitude=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = await response.parse() + assert location is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_set(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.location.with_raw_response.set( + device_id="", + latitude=0, + longitude=0, + ) diff --git a/tests/api_resources/devices/test_packages.py b/tests/api_resources/devices/test_packages.py new file mode 100644 index 0000000..dbfc3cb --- /dev/null +++ b/tests/api_resources/devices/test_packages.py @@ -0,0 +1,130 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.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="Mock server 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="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + package = client.devices.packages.list( + device_id="deviceId", + include_protected_packages=True, + include_system_packages=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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_protected_packages=True, + include_system_packages=True, + x_device_display_id=0, + ) + assert_matches_type(Optional[PackageListResponse], package, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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_profile.py b/tests/api_resources/devices/test_profile.py new file mode 100644 index 0000000..3bec114 --- /dev/null +++ b/tests/api_resources/devices/test_profile.py @@ -0,0 +1,134 @@ +# 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_sdk import Mobilerun, AsyncMobilerun + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestProfile: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update(self, client: Mobilerun) -> None: + profile = client.devices.profile.update( + device_id="deviceId", + profile_id="profileId", + ) + assert profile is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Mobilerun) -> None: + profile = client.devices.profile.update( + device_id="deviceId", + profile_id="profileId", + x_device_display_id=0, + ) + assert profile is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update(self, client: Mobilerun) -> None: + response = client.devices.profile.with_raw_response.update( + device_id="deviceId", + profile_id="profileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert profile is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Mobilerun) -> None: + with client.devices.profile.with_streaming_response.update( + device_id="deviceId", + profile_id="profileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert profile is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.profile.with_raw_response.update( + device_id="", + profile_id="profileId", + ) + + +class TestAsyncProfile: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.devices.profile.update( + device_id="deviceId", + profile_id="profileId", + ) + assert profile is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.devices.profile.update( + device_id="deviceId", + profile_id="profileId", + x_device_display_id=0, + ) + assert profile is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.profile.with_raw_response.update( + device_id="deviceId", + profile_id="profileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert profile is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.profile.with_streaming_response.update( + device_id="deviceId", + profile_id="profileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert profile is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update(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.profile.with_raw_response.update( + device_id="", + profile_id="profileId", + ) diff --git a/tests/api_resources/devices/test_proxy.py b/tests/api_resources/devices/test_proxy.py new file mode 100644 index 0000000..914b3e3 --- /dev/null +++ b/tests/api_resources/devices/test_proxy.py @@ -0,0 +1,354 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.devices import ProxyStatusResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestProxy: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_connect(self, client: Mobilerun) -> None: + proxy = client.devices.proxy.connect( + device_id="deviceId", + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_connect_with_all_params(self, client: Mobilerun) -> None: + proxy = client.devices.proxy.connect( + device_id="deviceId", + host="host", + name="name", + password="password", + port=1, + smart_ip=True, + socks5={ + "host": "host", + "port": 1, + "password": "password", + "user": "user", + }, + user="user", + x_device_display_id=0, + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_connect(self, client: Mobilerun) -> None: + response = client.devices.proxy.with_raw_response.connect( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = response.parse() + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_connect(self, client: Mobilerun) -> None: + with client.devices.proxy.with_streaming_response.connect( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = response.parse() + assert proxy is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_connect(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.proxy.with_raw_response.connect( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_disconnect(self, client: Mobilerun) -> None: + proxy = client.devices.proxy.disconnect( + device_id="deviceId", + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_disconnect_with_all_params(self, client: Mobilerun) -> None: + proxy = client.devices.proxy.disconnect( + device_id="deviceId", + x_device_display_id=0, + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_disconnect(self, client: Mobilerun) -> None: + response = client.devices.proxy.with_raw_response.disconnect( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = response.parse() + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_disconnect(self, client: Mobilerun) -> None: + with client.devices.proxy.with_streaming_response.disconnect( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = response.parse() + assert proxy is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_disconnect(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.proxy.with_raw_response.disconnect( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_status(self, client: Mobilerun) -> None: + proxy = client.devices.proxy.status( + device_id="deviceId", + ) + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_status_with_all_params(self, client: Mobilerun) -> None: + proxy = client.devices.proxy.status( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_status(self, client: Mobilerun) -> None: + response = client.devices.proxy.with_raw_response.status( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = response.parse() + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_status(self, client: Mobilerun) -> None: + with client.devices.proxy.with_streaming_response.status( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = response.parse() + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_status(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.proxy.with_raw_response.status( + device_id="", + ) + + +class TestAsyncProxy: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_connect(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.devices.proxy.connect( + device_id="deviceId", + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_connect_with_all_params(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.devices.proxy.connect( + device_id="deviceId", + host="host", + name="name", + password="password", + port=1, + smart_ip=True, + socks5={ + "host": "host", + "port": 1, + "password": "password", + "user": "user", + }, + user="user", + x_device_display_id=0, + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_connect(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.proxy.with_raw_response.connect( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = await response.parse() + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_connect(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.proxy.with_streaming_response.connect( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = await response.parse() + assert proxy is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_connect(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.proxy.with_raw_response.connect( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_disconnect(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.devices.proxy.disconnect( + device_id="deviceId", + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_disconnect_with_all_params(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.devices.proxy.disconnect( + device_id="deviceId", + x_device_display_id=0, + ) + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_disconnect(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.proxy.with_raw_response.disconnect( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = await response.parse() + assert proxy is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_disconnect(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.proxy.with_streaming_response.disconnect( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = await response.parse() + assert proxy is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_disconnect(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.proxy.with_raw_response.disconnect( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_status(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.devices.proxy.status( + device_id="deviceId", + ) + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_status_with_all_params(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.devices.proxy.status( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_status(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.proxy.with_raw_response.status( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = await response.parse() + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_status(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.proxy.with_streaming_response.status( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = await response.parse() + assert_matches_type(ProxyStatusResponse, proxy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_status(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.proxy.with_raw_response.status( + 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..64d94ec --- /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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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..aa53bcf --- /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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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/devices/test_timezone.py b/tests/api_resources/devices/test_timezone.py new file mode 100644 index 0000000..6902ac4 --- /dev/null +++ b/tests/api_resources/devices/test_timezone.py @@ -0,0 +1,238 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types.devices import TimezoneGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTimezone: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get(self, client: Mobilerun) -> None: + timezone = client.devices.timezone.get( + device_id="deviceId", + ) + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_get_with_all_params(self, client: Mobilerun) -> None: + timezone = client.devices.timezone.get( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_get(self, client: Mobilerun) -> None: + response = client.devices.timezone.with_raw_response.get( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + timezone = response.parse() + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_get(self, client: Mobilerun) -> None: + with client.devices.timezone.with_streaming_response.get( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + timezone = response.parse() + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_get(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.timezone.with_raw_response.get( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set(self, client: Mobilerun) -> None: + timezone = client.devices.timezone.set( + device_id="deviceId", + timezone="timezone", + ) + assert timezone is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set_with_all_params(self, client: Mobilerun) -> None: + timezone = client.devices.timezone.set( + device_id="deviceId", + timezone="timezone", + x_device_display_id=0, + ) + assert timezone is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_set(self, client: Mobilerun) -> None: + response = client.devices.timezone.with_raw_response.set( + device_id="deviceId", + timezone="timezone", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + timezone = response.parse() + assert timezone is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_set(self, client: Mobilerun) -> None: + with client.devices.timezone.with_streaming_response.set( + device_id="deviceId", + timezone="timezone", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + timezone = response.parse() + assert timezone is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_set(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `device_id` but received ''"): + client.devices.timezone.with_raw_response.set( + device_id="", + timezone="timezone", + ) + + +class TestAsyncTimezone: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncMobilerun) -> None: + timezone = await async_client.devices.timezone.get( + device_id="deviceId", + ) + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncMobilerun) -> None: + timezone = await async_client.devices.timezone.get( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.timezone.with_raw_response.get( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + timezone = await response.parse() + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.timezone.with_streaming_response.get( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + timezone = await response.parse() + assert_matches_type(TimezoneGetResponse, timezone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_get(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.timezone.with_raw_response.get( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set(self, async_client: AsyncMobilerun) -> None: + timezone = await async_client.devices.timezone.set( + device_id="deviceId", + timezone="timezone", + ) + assert timezone is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set_with_all_params(self, async_client: AsyncMobilerun) -> None: + timezone = await async_client.devices.timezone.set( + device_id="deviceId", + timezone="timezone", + x_device_display_id=0, + ) + assert timezone is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_set(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.timezone.with_raw_response.set( + device_id="deviceId", + timezone="timezone", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + timezone = await response.parse() + assert timezone is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_set(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.timezone.with_streaming_response.set( + device_id="deviceId", + timezone="timezone", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + timezone = await response.parse() + assert timezone is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_set(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.timezone.with_raw_response.set( + device_id="", + timezone="timezone", + ) diff --git a/tests/api_resources/test_carriers.py b/tests/api_resources/test_carriers.py new file mode 100644 index 0000000..537784a --- /dev/null +++ b/tests/api_resources/test_carriers.py @@ -0,0 +1,567 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types import ( + CarrierListResponse, + CarrierCreateResponse, + CarrierDeleteResponse, + CarrierLookupResponse, + CarrierUpdateResponse, + CarrierRetrieveResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCarriers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create(self, client: Mobilerun) -> None: + carrier = client.carriers.create( + country="x", + mcc="x", + mnc="x", + operator="x", + ) + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Mobilerun) -> None: + carrier = client.carriers.create( + country="x", + mcc="x", + mnc="x", + operator="x", + company="company", + country_code="country_code", + country_iso="xx", + detail_url="detail_url", + gsm_bands="gsm_bands", + lte_bands="lte_bands", + mobile_prefix="mobile_prefix", + nsn_size="nsn_size", + number_format="number_format", + protocols="protocols", + umts_bands="umts_bands", + website="website", + ) + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_create(self, client: Mobilerun) -> None: + response = client.carriers.with_raw_response.create( + country="x", + mcc="x", + mnc="x", + operator="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = response.parse() + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Mobilerun) -> None: + with client.carriers.with_streaming_response.create( + country="x", + mcc="x", + mnc="x", + operator="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = response.parse() + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + carrier = client.carriers.retrieve( + 1, + ) + assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.carriers.with_raw_response.retrieve( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = response.parse() + assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.carriers.with_streaming_response.retrieve( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = response.parse() + assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update(self, client: Mobilerun) -> None: + carrier = client.carriers.update( + carrier_id=1, + ) + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Mobilerun) -> None: + carrier = client.carriers.update( + carrier_id=1, + company="company", + country="country", + country_code="country_code", + country_iso="xx", + detail_url="detail_url", + gsm_bands="gsm_bands", + lte_bands="lte_bands", + mobile_prefix="mobile_prefix", + nsn_size="nsn_size", + number_format="number_format", + operator="operator", + protocols="protocols", + umts_bands="umts_bands", + website="website", + ) + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update(self, client: Mobilerun) -> None: + response = client.carriers.with_raw_response.update( + carrier_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = response.parse() + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Mobilerun) -> None: + with client.carriers.with_streaming_response.update( + carrier_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = response.parse() + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + carrier = client.carriers.list() + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + carrier = client.carriers.list( + country="country", + country_iso="xx", + order_by="id", + order_dir="asc", + page=1, + page_size=1, + ) + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.carriers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = response.parse() + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.carriers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = response.parse() + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete(self, client: Mobilerun) -> None: + carrier = client.carriers.delete( + 1, + ) + assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Mobilerun) -> None: + response = client.carriers.with_raw_response.delete( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = response.parse() + assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Mobilerun) -> None: + with client.carriers.with_streaming_response.delete( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = response.parse() + assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_lookup(self, client: Mobilerun) -> None: + carrier = client.carriers.lookup( + mcc="x", + mnc="x", + ) + assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_lookup(self, client: Mobilerun) -> None: + response = client.carriers.with_raw_response.lookup( + mcc="x", + mnc="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = response.parse() + assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_lookup(self, client: Mobilerun) -> None: + with client.carriers.with_streaming_response.lookup( + mcc="x", + mnc="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = response.parse() + assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCarriers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.create( + country="x", + mcc="x", + mnc="x", + operator="x", + ) + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.create( + country="x", + mcc="x", + mnc="x", + operator="x", + company="company", + country_code="country_code", + country_iso="xx", + detail_url="detail_url", + gsm_bands="gsm_bands", + lte_bands="lte_bands", + mobile_prefix="mobile_prefix", + nsn_size="nsn_size", + number_format="number_format", + protocols="protocols", + umts_bands="umts_bands", + website="website", + ) + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: + response = await async_client.carriers.with_raw_response.create( + country="x", + mcc="x", + mnc="x", + operator="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = await response.parse() + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: + async with async_client.carriers.with_streaming_response.create( + country="x", + mcc="x", + mnc="x", + operator="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = await response.parse() + assert_matches_type(CarrierCreateResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.retrieve( + 1, + ) + assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.carriers.with_raw_response.retrieve( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = await response.parse() + assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.carriers.with_streaming_response.retrieve( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = await response.parse() + assert_matches_type(CarrierRetrieveResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.update( + carrier_id=1, + ) + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.update( + carrier_id=1, + company="company", + country="country", + country_code="country_code", + country_iso="xx", + detail_url="detail_url", + gsm_bands="gsm_bands", + lte_bands="lte_bands", + mobile_prefix="mobile_prefix", + nsn_size="nsn_size", + number_format="number_format", + operator="operator", + protocols="protocols", + umts_bands="umts_bands", + website="website", + ) + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: + response = await async_client.carriers.with_raw_response.update( + carrier_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = await response.parse() + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: + async with async_client.carriers.with_streaming_response.update( + carrier_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = await response.parse() + assert_matches_type(CarrierUpdateResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.list() + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.list( + country="country", + country_iso="xx", + order_by="id", + order_dir="asc", + page=1, + page_size=1, + ) + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.carriers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = await response.parse() + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.carriers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = await response.parse() + assert_matches_type(CarrierListResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.delete( + 1, + ) + assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: + response = await async_client.carriers.with_raw_response.delete( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = await response.parse() + assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: + async with async_client.carriers.with_streaming_response.delete( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = await response.parse() + assert_matches_type(CarrierDeleteResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_lookup(self, async_client: AsyncMobilerun) -> None: + carrier = await async_client.carriers.lookup( + mcc="x", + mnc="x", + ) + assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_lookup(self, async_client: AsyncMobilerun) -> None: + response = await async_client.carriers.with_raw_response.lookup( + mcc="x", + mnc="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + carrier = await response.parse() + assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_lookup(self, async_client: AsyncMobilerun) -> None: + async with async_client.carriers.with_streaming_response.lookup( + mcc="x", + mnc="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + carrier = await response.parse() + assert_matches_type(CarrierLookupResponse, carrier, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_devices.py b/tests/api_resources/test_devices.py new file mode 100644 index 0000000..8980435 --- /dev/null +++ b/tests/api_resources/test_devices.py @@ -0,0 +1,978 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types import ( + Device, + DeviceListResponse, + DeviceCountResponse, + DeviceFingerprintResponse, +) +from mobilerun_sdk._utils import parse_datetime + +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="Mock server 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="Mock server tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Mobilerun) -> None: + device = client.devices.create( + billing="auto", + query_country="country", + device_type="dedicated_physical_device", + profile_id="profileId", + android_version=0, + apps=["string"], + carrier={ + "gsm_operator_alpha": "GsmOperatorAlpha", + "gsm_operator_numeric": 0, + "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", + "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", + "gsm_sim_operator_numeric": 0, + "persist_sys_timezone": "PersistSysTimezone", + }, + body_country="country", + files=["string"], + identifiers={ + "bootloader_serial_number": "BootloaderSerialNumber", + "identifier_android_id": "IdentifierAndroidID", + "identifier_app_set_id": "IdentifierAppSetID", + "identifier_bluetooth_mac": "IdentifierBluetoothMAC", + "identifier_gaid": "IdentifierGAID", + "identifier_gsfid": "IdentifierGSFID", + "identifier_iccid": "IdentifierICCID", + "identifier_imei": "IdentifierIMEI", + "identifier_imsi": "IdentifierIMSI", + "identifier_media_drmid": "IdentifierMediaDRMID", + "identifier_meid": "IdentifierMEID", + "identifier_phone_number": "IdentifierPhoneNumber", + "identifier_serial": "IdentifierSerial", + "identifier_wifi_mac": "IdentifierWifiMAC", + "serial_number": "SerialNumber", + }, + locale="locale", + location={ + "latitude": 0, + "longitude": 0, + }, + name="name", + proxy={ + "name": "name", + "smart_ip": True, + "socks5": { + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + }, + timezone="timezone", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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_id="providerId", + state=["creating"], + type="dedicated_physical_device", + ) + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + def test_method_fingerprint(self, client: Mobilerun) -> None: + device = client.devices.fingerprint( + device_id="deviceId", + ) + assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_fingerprint_with_all_params(self, client: Mobilerun) -> None: + device = client.devices.fingerprint( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_fingerprint(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.fingerprint( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = response.parse() + assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_fingerprint(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.fingerprint( + device_id="deviceId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + device = response.parse() + assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_fingerprint(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.fingerprint( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_reboot(self, client: Mobilerun) -> None: + device = client.devices.reboot( + "deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_reboot(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.reboot( + "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="Mock server tests are disabled") + @parametrize + def test_streaming_response_reboot(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.reboot( + "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="Mock server tests are disabled") + @parametrize + def test_path_params_reboot(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.reboot( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_reset(self, client: Mobilerun) -> None: + device = client.devices.reset( + "deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_reset(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.reset( + "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="Mock server tests are disabled") + @parametrize + def test_streaming_response_reset(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.reset( + "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="Mock server tests are disabled") + @parametrize + def test_path_params_reset(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.reset( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_set_name(self, client: Mobilerun) -> None: + device = client.devices.set_name( + device_id="deviceId", + name="x", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_set_name(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.set_name( + device_id="deviceId", + name="x", + ) + + 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="Mock server tests are disabled") + @parametrize + def test_streaming_response_set_name(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.set_name( + device_id="deviceId", + name="x", + ) 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="Mock server tests are disabled") + @parametrize + def test_path_params_set_name(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.set_name( + device_id="", + name="x", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_terminate(self, client: Mobilerun) -> None: + device = client.devices.terminate( + device_id="deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_terminate_with_all_params(self, client: Mobilerun) -> None: + device = client.devices.terminate( + device_id="deviceId", + previous_device_id="previousDeviceId", + terminate_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_terminate(self, client: Mobilerun) -> None: + response = client.devices.with_raw_response.terminate( + device_id="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="Mock server tests are disabled") + @parametrize + def test_streaming_response_terminate(self, client: Mobilerun) -> None: + with client.devices.with_streaming_response.terminate( + device_id="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="Mock server 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( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.create( + billing="auto", + query_country="country", + device_type="dedicated_physical_device", + profile_id="profileId", + android_version=0, + apps=["string"], + carrier={ + "gsm_operator_alpha": "GsmOperatorAlpha", + "gsm_operator_numeric": 0, + "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", + "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", + "gsm_sim_operator_numeric": 0, + "persist_sys_timezone": "PersistSysTimezone", + }, + body_country="country", + files=["string"], + identifiers={ + "bootloader_serial_number": "BootloaderSerialNumber", + "identifier_android_id": "IdentifierAndroidID", + "identifier_app_set_id": "IdentifierAppSetID", + "identifier_bluetooth_mac": "IdentifierBluetoothMAC", + "identifier_gaid": "IdentifierGAID", + "identifier_gsfid": "IdentifierGSFID", + "identifier_iccid": "IdentifierICCID", + "identifier_imei": "IdentifierIMEI", + "identifier_imsi": "IdentifierIMSI", + "identifier_media_drmid": "IdentifierMediaDRMID", + "identifier_meid": "IdentifierMEID", + "identifier_phone_number": "IdentifierPhoneNumber", + "identifier_serial": "IdentifierSerial", + "identifier_wifi_mac": "IdentifierWifiMAC", + "serial_number": "SerialNumber", + }, + locale="locale", + location={ + "latitude": 0, + "longitude": 0, + }, + name="name", + proxy={ + "name": "name", + "smart_ip": True, + "socks5": { + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + }, + timezone="timezone", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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_id="providerId", + state=["creating"], + type="dedicated_physical_device", + ) + assert_matches_type(DeviceListResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server 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="Mock server tests are disabled") + @parametrize + async def test_method_fingerprint(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.fingerprint( + device_id="deviceId", + ) + assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_fingerprint_with_all_params(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.fingerprint( + device_id="deviceId", + x_device_display_id=0, + ) + assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_fingerprint(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.fingerprint( + device_id="deviceId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + device = await response.parse() + assert_matches_type(DeviceFingerprintResponse, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_fingerprint(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.fingerprint( + device_id="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(DeviceFingerprintResponse, device, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_fingerprint(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.fingerprint( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_reboot(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.reboot( + "deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_reboot(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.reboot( + "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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_reboot(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.reboot( + "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="Mock server tests are disabled") + @parametrize + async def test_path_params_reboot(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.reboot( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_reset(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.reset( + "deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_reset(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.reset( + "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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_reset(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.reset( + "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="Mock server tests are disabled") + @parametrize + async def test_path_params_reset(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.reset( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_set_name(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.set_name( + device_id="deviceId", + name="x", + ) + assert_matches_type(Device, device, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_set_name(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.set_name( + device_id="deviceId", + name="x", + ) + + 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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_set_name(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.set_name( + device_id="deviceId", + name="x", + ) 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="Mock server tests are disabled") + @parametrize + async def test_path_params_set_name(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.set_name( + device_id="", + name="x", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_terminate(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.terminate( + device_id="deviceId", + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_terminate_with_all_params(self, async_client: AsyncMobilerun) -> None: + device = await async_client.devices.terminate( + device_id="deviceId", + previous_device_id="previousDeviceId", + terminate_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert device is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_terminate(self, async_client: AsyncMobilerun) -> None: + response = await async_client.devices.with_raw_response.terminate( + device_id="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="Mock server tests are disabled") + @parametrize + async def test_streaming_response_terminate(self, async_client: AsyncMobilerun) -> None: + async with async_client.devices.with_streaming_response.terminate( + device_id="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="Mock server 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( + device_id="", + ) + + @pytest.mark.skip(reason="Mock server 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="Mock server 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="Mock server 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="Mock server 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( + "", + ) diff --git a/tests/api_resources/test_profiles.py b/tests/api_resources/test_profiles.py new file mode 100644 index 0000000..404e8d8 --- /dev/null +++ b/tests/api_resources/test_profiles.py @@ -0,0 +1,676 @@ +# 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 tests.utils import assert_matches_type +from mobilerun_sdk import Mobilerun, AsyncMobilerun +from mobilerun_sdk.types import ( + Profile, + ProfileListResponse, + ProfileDeleteResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestProfiles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create(self, client: Mobilerun) -> None: + profile = client.profiles.create( + name="x", + spec={}, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Mobilerun) -> None: + profile = client.profiles.create( + name="x", + spec={ + "android_version": 0, + "apps": ["string"], + "carrier": { + "gsm_operator_alpha": "GsmOperatorAlpha", + "gsm_operator_numeric": 0, + "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", + "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", + "gsm_sim_operator_numeric": 0, + "persist_sys_timezone": "PersistSysTimezone", + }, + "country": "country", + "files": ["string"], + "identifiers": { + "bootloader_serial_number": "BootloaderSerialNumber", + "identifier_android_id": "IdentifierAndroidID", + "identifier_app_set_id": "IdentifierAppSetID", + "identifier_bluetooth_mac": "IdentifierBluetoothMAC", + "identifier_gaid": "IdentifierGAID", + "identifier_gsfid": "IdentifierGSFID", + "identifier_iccid": "IdentifierICCID", + "identifier_imei": "IdentifierIMEI", + "identifier_imsi": "IdentifierIMSI", + "identifier_media_drmid": "IdentifierMediaDRMID", + "identifier_meid": "IdentifierMEID", + "identifier_phone_number": "IdentifierPhoneNumber", + "identifier_serial": "IdentifierSerial", + "identifier_wifi_mac": "IdentifierWifiMAC", + "serial_number": "SerialNumber", + }, + "locale": "locale", + "location": { + "latitude": 0, + "longitude": 0, + }, + "name": "name", + "proxy": { + "name": "name", + "smart_ip": True, + "socks5": { + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + }, + "timezone": "timezone", + }, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_create(self, client: Mobilerun) -> None: + response = client.profiles.with_raw_response.create( + name="x", + spec={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Mobilerun) -> None: + with client.profiles.with_streaming_response.create( + name="x", + spec={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve(self, client: Mobilerun) -> None: + profile = client.profiles.retrieve( + "profileId", + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Mobilerun) -> None: + response = client.profiles.with_raw_response.retrieve( + "profileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Mobilerun) -> None: + with client.profiles.with_streaming_response.retrieve( + "profileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): + client.profiles.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update(self, client: Mobilerun) -> None: + profile = client.profiles.update( + profile_id="profileId", + name="x", + spec={}, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Mobilerun) -> None: + profile = client.profiles.update( + profile_id="profileId", + name="x", + spec={ + "android_version": 0, + "apps": ["string"], + "carrier": { + "gsm_operator_alpha": "GsmOperatorAlpha", + "gsm_operator_numeric": 0, + "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", + "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", + "gsm_sim_operator_numeric": 0, + "persist_sys_timezone": "PersistSysTimezone", + }, + "country": "country", + "files": ["string"], + "identifiers": { + "bootloader_serial_number": "BootloaderSerialNumber", + "identifier_android_id": "IdentifierAndroidID", + "identifier_app_set_id": "IdentifierAppSetID", + "identifier_bluetooth_mac": "IdentifierBluetoothMAC", + "identifier_gaid": "IdentifierGAID", + "identifier_gsfid": "IdentifierGSFID", + "identifier_iccid": "IdentifierICCID", + "identifier_imei": "IdentifierIMEI", + "identifier_imsi": "IdentifierIMSI", + "identifier_media_drmid": "IdentifierMediaDRMID", + "identifier_meid": "IdentifierMEID", + "identifier_phone_number": "IdentifierPhoneNumber", + "identifier_serial": "IdentifierSerial", + "identifier_wifi_mac": "IdentifierWifiMAC", + "serial_number": "SerialNumber", + }, + "locale": "locale", + "location": { + "latitude": 0, + "longitude": 0, + }, + "name": "name", + "proxy": { + "name": "name", + "smart_ip": True, + "socks5": { + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + }, + "timezone": "timezone", + }, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update(self, client: Mobilerun) -> None: + response = client.profiles.with_raw_response.update( + profile_id="profileId", + name="x", + spec={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Mobilerun) -> None: + with client.profiles.with_streaming_response.update( + profile_id="profileId", + name="x", + spec={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update(self, client: Mobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): + client.profiles.with_raw_response.update( + profile_id="", + name="x", + spec={}, + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list(self, client: Mobilerun) -> None: + profile = client.profiles.list() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Mobilerun) -> None: + profile = client.profiles.list( + name="name", + order_by="name", + order_by_direction="asc", + page=0, + page_size=0, + ) + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list(self, client: Mobilerun) -> None: + response = client.profiles.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Mobilerun) -> None: + with client.profiles.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete(self, client: Mobilerun) -> None: + profile = client.profiles.delete( + "profileId", + ) + assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Mobilerun) -> None: + response = client.profiles.with_raw_response.delete( + "profileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Mobilerun) -> None: + with client.profiles.with_streaming_response.delete( + "profileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): + client.profiles.with_raw_response.delete( + "", + ) + + +class TestAsyncProfiles: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.create( + name="x", + spec={}, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.create( + name="x", + spec={ + "android_version": 0, + "apps": ["string"], + "carrier": { + "gsm_operator_alpha": "GsmOperatorAlpha", + "gsm_operator_numeric": 0, + "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", + "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", + "gsm_sim_operator_numeric": 0, + "persist_sys_timezone": "PersistSysTimezone", + }, + "country": "country", + "files": ["string"], + "identifiers": { + "bootloader_serial_number": "BootloaderSerialNumber", + "identifier_android_id": "IdentifierAndroidID", + "identifier_app_set_id": "IdentifierAppSetID", + "identifier_bluetooth_mac": "IdentifierBluetoothMAC", + "identifier_gaid": "IdentifierGAID", + "identifier_gsfid": "IdentifierGSFID", + "identifier_iccid": "IdentifierICCID", + "identifier_imei": "IdentifierIMEI", + "identifier_imsi": "IdentifierIMSI", + "identifier_media_drmid": "IdentifierMediaDRMID", + "identifier_meid": "IdentifierMEID", + "identifier_phone_number": "IdentifierPhoneNumber", + "identifier_serial": "IdentifierSerial", + "identifier_wifi_mac": "IdentifierWifiMAC", + "serial_number": "SerialNumber", + }, + "locale": "locale", + "location": { + "latitude": 0, + "longitude": 0, + }, + "name": "name", + "proxy": { + "name": "name", + "smart_ip": True, + "socks5": { + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + }, + "timezone": "timezone", + }, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncMobilerun) -> None: + response = await async_client.profiles.with_raw_response.create( + name="x", + spec={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncMobilerun) -> None: + async with async_client.profiles.with_streaming_response.create( + name="x", + spec={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.retrieve( + "profileId", + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncMobilerun) -> None: + response = await async_client.profiles.with_raw_response.retrieve( + "profileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncMobilerun) -> None: + async with async_client.profiles.with_streaming_response.retrieve( + "profileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): + await async_client.profiles.with_raw_response.retrieve( + "", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.update( + profile_id="profileId", + name="x", + spec={}, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.update( + profile_id="profileId", + name="x", + spec={ + "android_version": 0, + "apps": ["string"], + "carrier": { + "gsm_operator_alpha": "GsmOperatorAlpha", + "gsm_operator_numeric": 0, + "gsm_sim_operator_alpha": "GsmSimOperatorAlpha", + "gsm_sim_operator_iso_country": "GsmSimOperatorIsoCountry", + "gsm_sim_operator_numeric": 0, + "persist_sys_timezone": "PersistSysTimezone", + }, + "country": "country", + "files": ["string"], + "identifiers": { + "bootloader_serial_number": "BootloaderSerialNumber", + "identifier_android_id": "IdentifierAndroidID", + "identifier_app_set_id": "IdentifierAppSetID", + "identifier_bluetooth_mac": "IdentifierBluetoothMAC", + "identifier_gaid": "IdentifierGAID", + "identifier_gsfid": "IdentifierGSFID", + "identifier_iccid": "IdentifierICCID", + "identifier_imei": "IdentifierIMEI", + "identifier_imsi": "IdentifierIMSI", + "identifier_media_drmid": "IdentifierMediaDRMID", + "identifier_meid": "IdentifierMEID", + "identifier_phone_number": "IdentifierPhoneNumber", + "identifier_serial": "IdentifierSerial", + "identifier_wifi_mac": "IdentifierWifiMAC", + "serial_number": "SerialNumber", + }, + "locale": "locale", + "location": { + "latitude": 0, + "longitude": 0, + }, + "name": "name", + "proxy": { + "name": "name", + "smart_ip": True, + "socks5": { + "host": "host", + "password": "password", + "port": 0, + "user": "user", + }, + }, + "timezone": "timezone", + }, + ) + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncMobilerun) -> None: + response = await async_client.profiles.with_raw_response.update( + profile_id="profileId", + name="x", + spec={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncMobilerun) -> None: + async with async_client.profiles.with_streaming_response.update( + profile_id="profileId", + name="x", + spec={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(Profile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncMobilerun) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): + await async_client.profiles.with_raw_response.update( + profile_id="", + name="x", + spec={}, + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.list() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.list( + name="name", + order_by="name", + order_by_direction="asc", + page=0, + page_size=0, + ) + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncMobilerun) -> None: + response = await async_client.profiles.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMobilerun) -> None: + async with async_client.profiles.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncMobilerun) -> None: + profile = await async_client.profiles.delete( + "profileId", + ) + assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncMobilerun) -> None: + response = await async_client.profiles.with_raw_response.delete( + "profileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncMobilerun) -> None: + async with async_client.profiles.with_streaming_response.delete( + "profileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ProfileDeleteResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server 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 `profile_id` but received ''"): + await async_client.profiles.with_raw_response.delete( + "", + ) diff --git a/tests/api_resources/test_proxies.py b/tests/api_resources/test_proxies.py index 6b09e36..b96cc4d 100644 --- a/tests/api_resources/test_proxies.py +++ b/tests/api_resources/test_proxies.py @@ -13,6 +13,7 @@ ProxyListResponse, ProxyCreateResponse, ProxyDeleteResponse, + ProxyLookupResponse, ProxyUpdateResponse, ProxyRetrieveResponse, ) @@ -352,6 +353,62 @@ def test_path_params_delete(self, client: Mobilerun) -> None: "", ) + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_lookup(self, client: Mobilerun) -> None: + proxy = client.proxies.lookup( + socks5={ + "host": "host", + "port": 1, + }, + ) + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_lookup_with_all_params(self, client: Mobilerun) -> None: + proxy = client.proxies.lookup( + socks5={ + "host": "host", + "port": 1, + "password": "password", + "user": "user", + }, + ) + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_lookup(self, client: Mobilerun) -> None: + response = client.proxies.with_raw_response.lookup( + socks5={ + "host": "host", + "port": 1, + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = response.parse() + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_lookup(self, client: Mobilerun) -> None: + with client.proxies.with_streaming_response.lookup( + socks5={ + "host": "host", + "port": 1, + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = response.parse() + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncProxies: parametrize = pytest.mark.parametrize( @@ -686,3 +743,59 @@ async def test_path_params_delete(self, async_client: AsyncMobilerun) -> None: await async_client.proxies.with_raw_response.delete( "", ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_lookup(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.proxies.lookup( + socks5={ + "host": "host", + "port": 1, + }, + ) + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_lookup_with_all_params(self, async_client: AsyncMobilerun) -> None: + proxy = await async_client.proxies.lookup( + socks5={ + "host": "host", + "port": 1, + "password": "password", + "user": "user", + }, + ) + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_lookup(self, async_client: AsyncMobilerun) -> None: + response = await async_client.proxies.with_raw_response.lookup( + socks5={ + "host": "host", + "port": 1, + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + proxy = await response.parse() + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_lookup(self, async_client: AsyncMobilerun) -> None: + async with async_client.proxies.with_streaming_response.lookup( + socks5={ + "host": "host", + "port": 1, + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + proxy = await response.parse() + assert_matches_type(ProxyLookupResponse, proxy, path=["response"]) + + assert cast(Any, response.is_closed) is True From 550e2cdd97c0b23378506b5922e151b07c988d22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 19:14:51 +0000 Subject: [PATCH 10/10] release: 5.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ pyproject.toml | 2 +- src/mobilerun_sdk/_version.py | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4808d97..b29b3b6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.1.0" + ".": "5.2.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6004989..c0e48e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 5.2.0 (2026-06-29) + +Full Changelog: [v5.1.0...v5.2.0](https://github.com/droidrun/mobilerun-sdk-python/compare/v5.1.0...v5.2.0) + +### Features + +* **api:** api update ([3945474](https://github.com/droidrun/mobilerun-sdk-python/commit/394547478c920f583e007fb733cda9e6c4dcc80c)) +* **api:** api update ([8b87544](https://github.com/droidrun/mobilerun-sdk-python/commit/8b875445c5e1220f17702ec1cef0d38d960848d7)) +* **api:** api update ([e6f7fac](https://github.com/droidrun/mobilerun-sdk-python/commit/e6f7facbcedbc95d47024b3b4d36851a4c292337)) +* **api:** api update ([a27ba34](https://github.com/droidrun/mobilerun-sdk-python/commit/a27ba34af6d90312d190b13d5acff3ad92516e2c)) +* **api:** api update ([949f7d6](https://github.com/droidrun/mobilerun-sdk-python/commit/949f7d6d7ca33f2a817a0b7a357a36246173a1ce)) +* **api:** api update ([faaad66](https://github.com/droidrun/mobilerun-sdk-python/commit/faaad668d436ba097cc51ff38716d0f46effafb6)) +* **api:** api update ([be4ca60](https://github.com/droidrun/mobilerun-sdk-python/commit/be4ca60c393e2a0a62a38ad3b60949e3301ad144)) +* **api:** api update ([ee37ca6](https://github.com/droidrun/mobilerun-sdk-python/commit/ee37ca601d0b87118e80f4fe38fd1e8660ed3543)) + ## 5.1.0 (2026-06-23) Full Changelog: [v5.0.0...v5.1.0](https://github.com/droidrun/mobilerun-sdk-python/compare/v5.0.0...v5.1.0) diff --git a/pyproject.toml b/pyproject.toml index a49aac4..f34d3f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mobilerun-sdk" -version = "5.1.0" +version = "5.2.0" description = "The official Python library for the mobilerun API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/mobilerun_sdk/_version.py b/src/mobilerun_sdk/_version.py index c478aec..76bc230 100644 --- a/src/mobilerun_sdk/_version.py +++ b/src/mobilerun_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "mobilerun_sdk" -__version__ = "5.1.0" # x-release-please-version +__version__ = "5.2.0" # x-release-please-version