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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/mobilerun_sdk/resources/connect/proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def buy(
*,
country: str,
type: Literal["dedicated_residential", "residential", "mobile"],
name: str | Omit = omit,
idempotency_key: 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.
Expand All @@ -154,6 +155,10 @@ def buy(
Args:
country: ISO 3166-1 alpha-2 country code to provision the proxy in.

name: Display name for the proxy, up to 64 characters excluding surrounding
whitespace, and containing no NUL. Omit it (or send only whitespace) to get a
generated label built from the country, type, and id.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -169,6 +174,7 @@ def buy(
{
"country": country,
"type": type,
"name": name,
},
proxy_buy_params.ProxyBuyParams,
),
Expand Down Expand Up @@ -507,6 +513,7 @@ async def buy(
*,
country: str,
type: Literal["dedicated_residential", "residential", "mobile"],
name: str | Omit = omit,
idempotency_key: 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.
Expand All @@ -521,6 +528,10 @@ async def buy(
Args:
country: ISO 3166-1 alpha-2 country code to provision the proxy in.

name: Display name for the proxy, up to 64 characters excluding surrounding
whitespace, and containing no NUL. Omit it (or send only whitespace) to get a
generated label built from the country, type, and id.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -536,6 +547,7 @@ async def buy(
{
"country": country,
"type": type,
"name": name,
},
proxy_buy_params.ProxyBuyParams,
),
Expand Down
20 changes: 14 additions & 6 deletions src/mobilerun_sdk/resources/devices/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ def execute_script(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BrowserExecuteScriptResponse:
"""
Evaluates a JavaScript expression in the device's foreground Chrome tab via the
Chrome DevTools Protocol and returns its JSON-serialized result. Devices without
browser support return an unsupported-feature error.
Evaluates a JavaScript expression exactly once in the device's single, confirmed
foreground Chrome tab via the Chrome DevTools Protocol and returns its
JSON-serialized result. A responsive browser state without exactly one visible
page returns DEVICE_NO_BROWSER_TARGET (400). Transient discovery or target-probe
transport failures return CDP_TRANSPORT_UNAVAILABLE (503) with Retry-After and
an executionOutcome; the service never retries a user script after sending it.
Devices without browser support return an unsupported-feature error.

Args:
script: JavaScript expression to evaluate in the device's foreground Chrome tab (CDP
Expand Down Expand Up @@ -125,9 +129,13 @@ async def execute_script(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BrowserExecuteScriptResponse:
"""
Evaluates a JavaScript expression in the device's foreground Chrome tab via the
Chrome DevTools Protocol and returns its JSON-serialized result. Devices without
browser support return an unsupported-feature error.
Evaluates a JavaScript expression exactly once in the device's single, confirmed
foreground Chrome tab via the Chrome DevTools Protocol and returns its
JSON-serialized result. A responsive browser state without exactly one visible
page returns DEVICE_NO_BROWSER_TARGET (400). Transient discovery or target-probe
transport failures return CDP_TRANSPORT_UNAVAILABLE (503) with Retry-After and
an executionOutcome; the service never retries a user script after sending it.
Devices without browser support return an unsupported-feature error.

Args:
script: JavaScript expression to evaluate in the device's foreground Chrome tab (CDP
Expand Down
149 changes: 73 additions & 76 deletions src/mobilerun_sdk/resources/devices/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import typing_extensions
from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
Expand Down Expand Up @@ -300,14 +301,7 @@ def create(
*,
billing: Literal["auto", "subscription", "minute"] | Omit = omit,
query_country: str | Omit = omit,
device_type: Literal[
"android_cloud_phone",
"dedicated_premium_device",
"dedicated_physical_device",
"dedicated_ios_device",
"dedicated_emulated_device",
]
| Omit = omit,
device_type: str | Omit = omit,
profile_id: str | Omit = omit,
android_version: int | Omit = omit,
apps: Optional[SequenceNotStr[str]] | Omit = omit,
Expand All @@ -327,27 +321,29 @@ def create(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DeviceCreateResponse:
"""
Requests a new device for the authenticated user from the device spec in the
request body. Optional query parameters select the canonical device type, target
country, billing mode, and a profile to use as the base spec; deprecated
device-type aliases remain accepted only during the documented compatibility
grace period. The response returns the device and its stream token.
"""Requests a new device from the specification in the request body.

Optional query
parameters select the canonical device type, country, billing mode, and base
profile. Returns the device, its resolved billing strategy, 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.
billing: Billing mode. 'auto' tries subscription first, then minute billing if no
subscription entitlement exists or all subscription slots are in use, provided
minute billing is enabled. When subscription billing is disabled, auto uses
minutes directly. Billing-service failures never trigger fallback.
'subscription' requires an available subscription slot and never falls back.
'minute' uses minute billing only, subject to balance and concurrency checks.
Modes depend on the device type's billing configuration.

query_country: ISO 3166-1 alpha-2 country code. If omitted the system picks the country with
the most availability.

device_type:
Deprecated device type aliases are accepted during a compatibility grace period:
dedicated_premium_device maps to android_cloud_phone, dedicated_physical_device
maps to android_physical_phone, dedicated_ios_device maps to ios_stealth_phone,
and dedicated_emulated_device maps to android_emulator.
device_type: Use android*cloud_phone for a cloud Android phone. Only canonical identifiers
are accepted. Other backends are deployment-specific; recognized but unavailable
types return DEVICE_TYPE_UNAVAILABLE (422). Retired dedicated*\\** aliases are
rejected with a canonical replacement.

profile_id: Profile ID to use as device spec

Expand Down Expand Up @@ -460,11 +456,7 @@ def list(
]
| Omit = omit,
type: Literal[
"android_cloud_phone",
"dedicated_premium_device",
"dedicated_physical_device",
"dedicated_ios_device",
"dedicated_emulated_device",
"android_cloud_phone", "android_physical_phone", "ios_stealth_phone", "android_emulator", "ios_simulator"
]
| Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -483,11 +475,8 @@ def list(
mine: When true, only return devices created by the calling user (resolved from
X-User-ID, never a client-supplied id).

type:
Deprecated device type aliases are accepted during a compatibility grace period:
dedicated_premium_device maps to android_cloud_phone, dedicated_physical_device
maps to android_physical_phone, dedicated_ios_device maps to ios_stealth_phone,
and dedicated_emulated_device maps to android_emulator.
type: Canonical device type. Retired dedicated\\__\\** aliases are no longer accepted.
Availability depends on the deployment.

extra_headers: Send extra headers

Expand Down Expand Up @@ -524,6 +513,7 @@ def list(
cast_to=DeviceListResponse,
)

@typing_extensions.deprecated("deprecated")
def count(
self,
*,
Expand All @@ -534,7 +524,12 @@ def count(
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."""
"""Deprecated: use GET /devices/summary instead.

Returns the number of active
claimed devices for the user, broken down by device type, in the legacy response
shape.
"""
return self._get(
"/devices/count",
options=make_request_options(
Expand Down Expand Up @@ -990,14 +985,7 @@ async def create(
*,
billing: Literal["auto", "subscription", "minute"] | Omit = omit,
query_country: str | Omit = omit,
device_type: Literal[
"android_cloud_phone",
"dedicated_premium_device",
"dedicated_physical_device",
"dedicated_ios_device",
"dedicated_emulated_device",
]
| Omit = omit,
device_type: str | Omit = omit,
profile_id: str | Omit = omit,
android_version: int | Omit = omit,
apps: Optional[SequenceNotStr[str]] | Omit = omit,
Expand All @@ -1017,27 +1005,29 @@ async def create(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DeviceCreateResponse:
"""
Requests a new device for the authenticated user from the device spec in the
request body. Optional query parameters select the canonical device type, target
country, billing mode, and a profile to use as the base spec; deprecated
device-type aliases remain accepted only during the documented compatibility
grace period. The response returns the device and its stream token.
"""Requests a new device from the specification in the request body.

Optional query
parameters select the canonical device type, country, billing mode, and base
profile. Returns the device, its resolved billing strategy, 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.
billing: Billing mode. 'auto' tries subscription first, then minute billing if no
subscription entitlement exists or all subscription slots are in use, provided
minute billing is enabled. When subscription billing is disabled, auto uses
minutes directly. Billing-service failures never trigger fallback.
'subscription' requires an available subscription slot and never falls back.
'minute' uses minute billing only, subject to balance and concurrency checks.
Modes depend on the device type's billing configuration.

query_country: ISO 3166-1 alpha-2 country code. If omitted the system picks the country with
the most availability.

device_type:
Deprecated device type aliases are accepted during a compatibility grace period:
dedicated_premium_device maps to android_cloud_phone, dedicated_physical_device
maps to android_physical_phone, dedicated_ios_device maps to ios_stealth_phone,
and dedicated_emulated_device maps to android_emulator.
device_type: Use android*cloud_phone for a cloud Android phone. Only canonical identifiers
are accepted. Other backends are deployment-specific; recognized but unavailable
types return DEVICE_TYPE_UNAVAILABLE (422). Retired dedicated*\\** aliases are
rejected with a canonical replacement.

profile_id: Profile ID to use as device spec

Expand Down Expand Up @@ -1150,11 +1140,7 @@ async def list(
]
| Omit = omit,
type: Literal[
"android_cloud_phone",
"dedicated_premium_device",
"dedicated_physical_device",
"dedicated_ios_device",
"dedicated_emulated_device",
"android_cloud_phone", "android_physical_phone", "ios_stealth_phone", "android_emulator", "ios_simulator"
]
| Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -1173,11 +1159,8 @@ async def list(
mine: When true, only return devices created by the calling user (resolved from
X-User-ID, never a client-supplied id).

type:
Deprecated device type aliases are accepted during a compatibility grace period:
dedicated_premium_device maps to android_cloud_phone, dedicated_physical_device
maps to android_physical_phone, dedicated_ios_device maps to ios_stealth_phone,
and dedicated_emulated_device maps to android_emulator.
type: Canonical device type. Retired dedicated\\__\\** aliases are no longer accepted.
Availability depends on the deployment.

extra_headers: Send extra headers

Expand Down Expand Up @@ -1214,6 +1197,7 @@ async def list(
cast_to=DeviceListResponse,
)

@typing_extensions.deprecated("deprecated")
async def count(
self,
*,
Expand All @@ -1224,7 +1208,12 @@ async def count(
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."""
"""Deprecated: use GET /devices/summary instead.

Returns the number of active
claimed devices for the user, broken down by device type, in the legacy response
shape.
"""
return await self._get(
"/devices/count",
options=make_request_options(
Expand Down Expand Up @@ -1588,8 +1577,10 @@ def __init__(self, devices: DevicesResource) -> None:
self.list = to_raw_response_wrapper(
devices.list,
)
self.count = to_raw_response_wrapper(
devices.count,
self.count = ( # pyright: ignore[reportDeprecated]
to_raw_response_wrapper(
devices.count, # pyright: ignore[reportDeprecated],
)
)
self.fingerprint = to_raw_response_wrapper(
devices.fingerprint,
Expand Down Expand Up @@ -1713,8 +1704,10 @@ def __init__(self, devices: AsyncDevicesResource) -> None:
self.list = async_to_raw_response_wrapper(
devices.list,
)
self.count = async_to_raw_response_wrapper(
devices.count,
self.count = ( # pyright: ignore[reportDeprecated]
async_to_raw_response_wrapper(
devices.count, # pyright: ignore[reportDeprecated],
)
)
self.fingerprint = async_to_raw_response_wrapper(
devices.fingerprint,
Expand Down Expand Up @@ -1838,8 +1831,10 @@ def __init__(self, devices: DevicesResource) -> None:
self.list = to_streamed_response_wrapper(
devices.list,
)
self.count = to_streamed_response_wrapper(
devices.count,
self.count = ( # pyright: ignore[reportDeprecated]
to_streamed_response_wrapper(
devices.count, # pyright: ignore[reportDeprecated],
)
)
self.fingerprint = to_streamed_response_wrapper(
devices.fingerprint,
Expand Down Expand Up @@ -1963,8 +1958,10 @@ def __init__(self, devices: AsyncDevicesResource) -> None:
self.list = async_to_streamed_response_wrapper(
devices.list,
)
self.count = async_to_streamed_response_wrapper(
devices.count,
self.count = ( # pyright: ignore[reportDeprecated]
async_to_streamed_response_wrapper(
devices.count, # pyright: ignore[reportDeprecated],
)
)
self.fingerprint = async_to_streamed_response_wrapper(
devices.fingerprint,
Expand Down
12 changes: 8 additions & 4 deletions src/mobilerun_sdk/resources/devices/recordings.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ def start(
device's full quality. Honored by devices recording through the portal stream
bridge.

types: Artifacts to capture: trajectory (input actions), video, and audio (captured
types: Artifacts to capture: trajectory (input actions; on portal stream-bridge devices
only when the handset announces trajectory capture), video, and audio (captured
into the video artifact, so it requires video; honored by portal stream-bridge
recorders). Defaults to trajectory and video.
recorders). Defaults to trajectory and video, narrowed to what the device
produces.

extra_headers: Send extra headers

Expand Down Expand Up @@ -468,9 +470,11 @@ async def start(
device's full quality. Honored by devices recording through the portal stream
bridge.

types: Artifacts to capture: trajectory (input actions), video, and audio (captured
types: Artifacts to capture: trajectory (input actions; on portal stream-bridge devices
only when the handset announces trajectory capture), video, and audio (captured
into the video artifact, so it requires video; honored by portal stream-bridge
recorders). Defaults to trajectory and video.
recorders). Defaults to trajectory and video, narrowed to what the device
produces.

extra_headers: Send extra headers

Expand Down
Loading
Loading