diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6e198d0..3e9417c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,10 +18,10 @@ jobs:
lint:
timeout-minutes: 10
name: lint
- runs-on: ${{ github.repository == 'stainless-sdks/limrun-v1-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rye
run: |
@@ -44,9 +44,9 @@ jobs:
permissions:
contents: read
id-token: write
- runs-on: ${{ github.repository == 'stainless-sdks/limrun-v1-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rye
run: |
@@ -67,7 +67,7 @@ jobs:
github.repository == 'stainless-sdks/limrun-v1-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
- uses: actions/github-script@v8
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());
@@ -84,10 +84,10 @@ jobs:
test:
timeout-minutes: 10
name: test
- runs-on: ${{ github.repository == 'stainless-sdks/limrun-v1-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rye
run: |
diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml
index f63f837..b9f96c9 100644
--- a/.github/workflows/publish-pypi.yml
+++ b/.github/workflows/publish-pypi.yml
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Rye
run: |
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index b89b4e5..2915abd 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -12,7 +12,7 @@ jobs:
if: github.repository == 'limrun-inc/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check release environment
run: |
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 091cfb1..f7014c3 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.10.0"
+ ".": "0.11.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 2f6f405..8975a85 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 16
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/limrun--inc-dash%2Flimrun-v1-863e69fb7be062484268a36a20a7bcd47f37110ac89ce148a8c44d1344c7959e.yml
-openapi_spec_hash: 76a922a814ab152b79000f97bfe49dbb
-config_hash: cc551e5b155630476a9c97cdf4e46bc8
+configured_endpoints: 23
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/limrun--inc-dash/limrun-v1-e1707762f717df034befefff82438993cecf6fab31a76c2840e45c6936bacff4.yml
+openapi_spec_hash: 1d16f95c49ef23271d468c776654bd5d
+config_hash: 972734de4b6902a1e7af27b08e725f89
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 247c011..8a4c604 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,48 @@
# Changelog
+## 0.11.0 (2026-08-04)
+
+Full Changelog: [v0.10.0...v0.11.0](https://github.com/limrun-inc/python-sdk/compare/v0.10.0...v0.11.0)
+
+### Features
+
+* **api:** add analytics api ([f53ecaa](https://github.com/limrun-inc/python-sdk/commit/f53ecaa0a628640dc520bf392aca70597e7a20c1))
+* **api:** add gradle to stainless config as well ([335e975](https://github.com/limrun-inc/python-sdk/commit/335e975b1564432c709f7cf55760dbe05382d61f))
+* **api:** add jurisdiction ([6921be5](https://github.com/limrun-inc/python-sdk/commit/6921be5995d0db5864b53000960c24602b1b23ab))
+* **api:** add scoped tokens to stainless config ([d399044](https://github.com/limrun-inc/python-sdk/commit/d3990440a1badd3c9c826ea83313bd33acf25b44))
+* **api:** add version to android playwright ([c01f3dc](https://github.com/limrun-inc/python-sdk/commit/c01f3dcc11a3e1b64e4007c0ae2562ba545b74bc))
+* **api:** add xcode build logs and signedStreamUrl ([47e6ac4](https://github.com/limrun-inc/python-sdk/commit/47e6ac44f3d48bb15a995f17d3e586b823c5547a))
+* **api:** analytics api, make platform enum ([6c679fb](https://github.com/limrun-inc/python-sdk/commit/6c679fb381e1db207b8831f8cea2f290e0c01394))
+* **api:** fix indentation ([0be86f5](https://github.com/limrun-inc/python-sdk/commit/0be86f5ba050b8fa1f23b778eb81226248e799e4))
+* **api:** fix stainless models for scoped tokens ([248a9d4](https://github.com/limrun-inc/python-sdk/commit/248a9d475d7b56aadac3fda9f0ff6a79bbfeddf6))
+* **api:** ios add forceBundleId ([d37a940](https://github.com/limrun-inc/python-sdk/commit/d37a940752faf9b8386d686e486c6ec5f529d512))
+* **api:** manual updates ([5cf9a85](https://github.com/limrun-inc/python-sdk/commit/5cf9a857267b343d0a9bb2e5a1673809ee319a6b))
+* **api:** manual updates ([ae30f4d](https://github.com/limrun-inc/python-sdk/commit/ae30f4df8b4a19ef4643afd49cfcd2ae1adcd643))
+* **api:** manual updates ([80939c4](https://github.com/limrun-inc/python-sdk/commit/80939c44898768cea4fe25806cf0a5d86cd9b3a0))
+* **api:** scoped tokens desc fix ([4dcb31a](https://github.com/limrun-inc/python-sdk/commit/4dcb31a1e020e20810483236deee43f87ffa94d6))
+* **api:** simplify the models for analytics endpoint ([656c11c](https://github.com/limrun-inc/python-sdk/commit/656c11cb7c9f5e3bdeddc43d53489d9e267bcea7))
+* **api:** update to latest main ([a536ff1](https://github.com/limrun-inc/python-sdk/commit/a536ff10b358b05429c836cf5babed59286d3c9b))
+* **internal/types:** support eagerly validating pydantic iterators ([d787141](https://github.com/limrun-inc/python-sdk/commit/d787141ec4d087f8f473dfe41d86f0c8c82672e5))
+* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([cd09a15](https://github.com/limrun-inc/python-sdk/commit/cd09a15656fbc5edf53745564128092099e4346d))
+* support setting headers via env ([601135d](https://github.com/limrun-inc/python-sdk/commit/601135db9f4eb15ee575e63b50d737e3c93d1625))
+
+
+### Bug Fixes
+
+* **client:** add missing f-string prefix in file type error message ([3d63f72](https://github.com/limrun-inc/python-sdk/commit/3d63f72d80c3aa8455a0c58ca8d9aeebbf0bc307))
+* use correct field name format for multipart file arrays ([c46f7f3](https://github.com/limrun-inc/python-sdk/commit/c46f7f392bf1a617a5fa372096a276ddf299f457))
+
+
+### Performance Improvements
+
+* **client:** optimize file structure copying in multipart requests ([0229b73](https://github.com/limrun-inc/python-sdk/commit/0229b737adc72f602a1525f2687c89ab776e7eaf))
+
+
+### Chores
+
+* **internal:** more robust bootstrap script ([12a1534](https://github.com/limrun-inc/python-sdk/commit/12a1534ba8cadb440b4430aab9223ebfc0de806d))
+* **internal:** reformat pyproject.toml ([8b67d80](https://github.com/limrun-inc/python-sdk/commit/8b67d807da768fa5292b61286da1e36d2a071046))
+
## 0.10.0 (2026-04-11)
Full Changelog: [v0.9.0...v0.10.0](https://github.com/limrun-inc/python-sdk/compare/v0.9.0...v0.10.0)
diff --git a/api.md b/api.md
index b2e7f8f..957df1e 100644
--- a/api.md
+++ b/api.md
@@ -57,3 +57,43 @@ Methods:
- client.xcode_instances.list(\*\*params) -> SyncItems[XcodeInstance]
- client.xcode_instances.delete(id) -> None
- client.xcode_instances.get(id) -> XcodeInstance
+
+# GradleInstances
+
+Types:
+
+```python
+from limrun_api.types import GradleInstance
+```
+
+Methods:
+
+- client.gradle_instances.create(\*\*params) -> GradleInstance
+- client.gradle_instances.list(\*\*params) -> SyncItems[GradleInstance]
+- client.gradle_instances.delete(id) -> None
+- client.gradle_instances.get(id) -> GradleInstance
+
+# Analytics
+
+Types:
+
+```python
+from limrun_api.types import AnalyticsInstancesResponse, AnalyticsResponse
+```
+
+Methods:
+
+- client.analytics.get(\*\*params) -> AnalyticsResponse
+- client.analytics.get_instances(\*\*params) -> AnalyticsInstancesResponse
+
+# ScopedTokens
+
+Types:
+
+```python
+from limrun_api.types import ScopedToken
+```
+
+Methods:
+
+- client.scoped_tokens.create(\*\*params) -> ScopedToken
diff --git a/pyproject.toml b/pyproject.toml
index f404b1a..5027df6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "limrun_api"
-version = "0.10.0"
+version = "0.11.0"
description = "The official Python library for the limrun API"
dynamic = ["readme"]
license = "Apache-2.0"
@@ -168,7 +168,7 @@ show_error_codes = true
#
# We also exclude our `tests` as mypy doesn't always infer
# types correctly and Pyright will still catch any type errors.
-exclude = ['src/limrun_api/_files.py', '_dev/.*.py', 'tests/.*']
+exclude = ["src/limrun_api/_files.py", "_dev/.*.py", "tests/.*"]
strict_equality = true
implicit_reexport = true
diff --git a/scripts/bootstrap b/scripts/bootstrap
index b430fee..fe8451e 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")/.."
-if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
+if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
echo -n "==> Install Homebrew dependencies? (y/N): "
read -r response
diff --git a/src/limrun_api/_client.py b/src/limrun_api/_client.py
index bbd3d38..a845d27 100644
--- a/src/limrun_api/_client.py
+++ b/src/limrun_api/_client.py
@@ -20,7 +20,11 @@
RequestOptions,
not_given,
)
-from ._utils import is_given, get_async_library
+from ._utils import (
+ is_given,
+ is_mapping_t,
+ get_async_library,
+)
from ._compat import cached_property
from ._version import __version__
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
@@ -32,10 +36,21 @@
)
if TYPE_CHECKING:
- from .resources import assets, ios_instances, xcode_instances, android_instances
+ from .resources import (
+ assets,
+ analytics,
+ ios_instances,
+ scoped_tokens,
+ xcode_instances,
+ gradle_instances,
+ android_instances,
+ )
from .resources.assets import AssetsResource, AsyncAssetsResource
+ from .resources.analytics import AnalyticsResource, AsyncAnalyticsResource
from .resources.ios_instances import IosInstancesResource, AsyncIosInstancesResource
+ from .resources.scoped_tokens import ScopedTokensResource, AsyncScopedTokensResource
from .resources.xcode_instances import XcodeInstancesResource, AsyncXcodeInstancesResource
+ from .resources.gradle_instances import GradleInstancesResource, AsyncGradleInstancesResource
from .resources.android_instances import AndroidInstancesResource, AsyncAndroidInstancesResource
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Limrun", "AsyncLimrun", "Client", "AsyncClient"]
@@ -81,6 +96,15 @@ def __init__(
if base_url is None:
base_url = f"https://api.limrun.com"
+ custom_headers_env = os.environ.get("LIMRUN_CUSTOM_HEADERS")
+ if custom_headers_env is not None:
+ parsed: dict[str, str] = {}
+ for line in custom_headers_env.split("\n"):
+ colon = line.find(":")
+ if colon >= 0:
+ parsed[line[:colon].strip()] = line[colon + 1 :].strip()
+ default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})}
+
super().__init__(
version=__version__,
base_url=base_url,
@@ -116,6 +140,24 @@ def xcode_instances(self) -> XcodeInstancesResource:
return XcodeInstancesResource(self)
+ @cached_property
+ def gradle_instances(self) -> GradleInstancesResource:
+ from .resources.gradle_instances import GradleInstancesResource
+
+ return GradleInstancesResource(self)
+
+ @cached_property
+ def analytics(self) -> AnalyticsResource:
+ from .resources.analytics import AnalyticsResource
+
+ return AnalyticsResource(self)
+
+ @cached_property
+ def scoped_tokens(self) -> ScopedTokensResource:
+ from .resources.scoped_tokens import ScopedTokensResource
+
+ return ScopedTokensResource(self)
+
@cached_property
def with_raw_response(self) -> LimrunWithRawResponse:
return LimrunWithRawResponse(self)
@@ -280,6 +322,15 @@ def __init__(
if base_url is None:
base_url = f"https://api.limrun.com"
+ custom_headers_env = os.environ.get("LIMRUN_CUSTOM_HEADERS")
+ if custom_headers_env is not None:
+ parsed: dict[str, str] = {}
+ for line in custom_headers_env.split("\n"):
+ colon = line.find(":")
+ if colon >= 0:
+ parsed[line[:colon].strip()] = line[colon + 1 :].strip()
+ default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})}
+
super().__init__(
version=__version__,
base_url=base_url,
@@ -315,6 +366,24 @@ def xcode_instances(self) -> AsyncXcodeInstancesResource:
return AsyncXcodeInstancesResource(self)
+ @cached_property
+ def gradle_instances(self) -> AsyncGradleInstancesResource:
+ from .resources.gradle_instances import AsyncGradleInstancesResource
+
+ return AsyncGradleInstancesResource(self)
+
+ @cached_property
+ def analytics(self) -> AsyncAnalyticsResource:
+ from .resources.analytics import AsyncAnalyticsResource
+
+ return AsyncAnalyticsResource(self)
+
+ @cached_property
+ def scoped_tokens(self) -> AsyncScopedTokensResource:
+ from .resources.scoped_tokens import AsyncScopedTokensResource
+
+ return AsyncScopedTokensResource(self)
+
@cached_property
def with_raw_response(self) -> AsyncLimrunWithRawResponse:
return AsyncLimrunWithRawResponse(self)
@@ -469,6 +538,24 @@ def xcode_instances(self) -> xcode_instances.XcodeInstancesResourceWithRawRespon
return XcodeInstancesResourceWithRawResponse(self._client.xcode_instances)
+ @cached_property
+ def gradle_instances(self) -> gradle_instances.GradleInstancesResourceWithRawResponse:
+ from .resources.gradle_instances import GradleInstancesResourceWithRawResponse
+
+ return GradleInstancesResourceWithRawResponse(self._client.gradle_instances)
+
+ @cached_property
+ def analytics(self) -> analytics.AnalyticsResourceWithRawResponse:
+ from .resources.analytics import AnalyticsResourceWithRawResponse
+
+ return AnalyticsResourceWithRawResponse(self._client.analytics)
+
+ @cached_property
+ def scoped_tokens(self) -> scoped_tokens.ScopedTokensResourceWithRawResponse:
+ from .resources.scoped_tokens import ScopedTokensResourceWithRawResponse
+
+ return ScopedTokensResourceWithRawResponse(self._client.scoped_tokens)
+
class AsyncLimrunWithRawResponse:
_client: AsyncLimrun
@@ -500,6 +587,24 @@ def xcode_instances(self) -> xcode_instances.AsyncXcodeInstancesResourceWithRawR
return AsyncXcodeInstancesResourceWithRawResponse(self._client.xcode_instances)
+ @cached_property
+ def gradle_instances(self) -> gradle_instances.AsyncGradleInstancesResourceWithRawResponse:
+ from .resources.gradle_instances import AsyncGradleInstancesResourceWithRawResponse
+
+ return AsyncGradleInstancesResourceWithRawResponse(self._client.gradle_instances)
+
+ @cached_property
+ def analytics(self) -> analytics.AsyncAnalyticsResourceWithRawResponse:
+ from .resources.analytics import AsyncAnalyticsResourceWithRawResponse
+
+ return AsyncAnalyticsResourceWithRawResponse(self._client.analytics)
+
+ @cached_property
+ def scoped_tokens(self) -> scoped_tokens.AsyncScopedTokensResourceWithRawResponse:
+ from .resources.scoped_tokens import AsyncScopedTokensResourceWithRawResponse
+
+ return AsyncScopedTokensResourceWithRawResponse(self._client.scoped_tokens)
+
class LimrunWithStreamedResponse:
_client: Limrun
@@ -531,6 +636,24 @@ def xcode_instances(self) -> xcode_instances.XcodeInstancesResourceWithStreaming
return XcodeInstancesResourceWithStreamingResponse(self._client.xcode_instances)
+ @cached_property
+ def gradle_instances(self) -> gradle_instances.GradleInstancesResourceWithStreamingResponse:
+ from .resources.gradle_instances import GradleInstancesResourceWithStreamingResponse
+
+ return GradleInstancesResourceWithStreamingResponse(self._client.gradle_instances)
+
+ @cached_property
+ def analytics(self) -> analytics.AnalyticsResourceWithStreamingResponse:
+ from .resources.analytics import AnalyticsResourceWithStreamingResponse
+
+ return AnalyticsResourceWithStreamingResponse(self._client.analytics)
+
+ @cached_property
+ def scoped_tokens(self) -> scoped_tokens.ScopedTokensResourceWithStreamingResponse:
+ from .resources.scoped_tokens import ScopedTokensResourceWithStreamingResponse
+
+ return ScopedTokensResourceWithStreamingResponse(self._client.scoped_tokens)
+
class AsyncLimrunWithStreamedResponse:
_client: AsyncLimrun
@@ -562,6 +685,24 @@ def xcode_instances(self) -> xcode_instances.AsyncXcodeInstancesResourceWithStre
return AsyncXcodeInstancesResourceWithStreamingResponse(self._client.xcode_instances)
+ @cached_property
+ def gradle_instances(self) -> gradle_instances.AsyncGradleInstancesResourceWithStreamingResponse:
+ from .resources.gradle_instances import AsyncGradleInstancesResourceWithStreamingResponse
+
+ return AsyncGradleInstancesResourceWithStreamingResponse(self._client.gradle_instances)
+
+ @cached_property
+ def analytics(self) -> analytics.AsyncAnalyticsResourceWithStreamingResponse:
+ from .resources.analytics import AsyncAnalyticsResourceWithStreamingResponse
+
+ return AsyncAnalyticsResourceWithStreamingResponse(self._client.analytics)
+
+ @cached_property
+ def scoped_tokens(self) -> scoped_tokens.AsyncScopedTokensResourceWithStreamingResponse:
+ from .resources.scoped_tokens import AsyncScopedTokensResourceWithStreamingResponse
+
+ return AsyncScopedTokensResourceWithStreamingResponse(self._client.scoped_tokens)
+
Client = Limrun
diff --git a/src/limrun_api/_files.py b/src/limrun_api/_files.py
index cc14c14..76da9e0 100644
--- a/src/limrun_api/_files.py
+++ b/src/limrun_api/_files.py
@@ -3,8 +3,8 @@
import io
import os
import pathlib
-from typing import overload
-from typing_extensions import TypeGuard
+from typing import Sequence, cast, overload
+from typing_extensions import TypeVar, TypeGuard
import anyio
@@ -17,7 +17,9 @@
HttpxFileContent,
HttpxRequestFiles,
)
-from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
+from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t
+
+_T = TypeVar("_T")
def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
@@ -97,7 +99,7 @@ async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles
elif is_sequence_t(files):
files = [(key, await _async_transform_file(file)) for key, file in files]
else:
- raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence")
+ raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence")
return files
@@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
return await anyio.Path(file).read_bytes()
return file
+
+
+def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
+ """Copy only the containers along the given paths.
+
+ Used to guard against mutation by extract_files without copying the entire structure.
+ Only dicts and lists that lie on a path are copied; everything else
+ is returned by reference.
+
+ For example, given paths=[["foo", "files", "file"]] and the structure:
+ {
+ "foo": {
+ "bar": {"baz": {}},
+ "files": {"file": }
+ }
+ }
+ The root dict, "foo", and "files" are copied (they lie on the path).
+ "bar" and "baz" are returned by reference (off the path).
+ """
+ return _deepcopy_with_paths(item, paths, 0)
+
+
+def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
+ if not paths:
+ return item
+ if is_mapping(item):
+ key_to_paths: dict[str, list[Sequence[str]]] = {}
+ for path in paths:
+ if index < len(path):
+ key_to_paths.setdefault(path[index], []).append(path)
+
+ # if no path continues through this mapping, it won't be mutated and copying it is redundant
+ if not key_to_paths:
+ return item
+
+ result = dict(item)
+ for key, subpaths in key_to_paths.items():
+ if key in result:
+ result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
+ return cast(_T, result)
+ if is_list(item):
+ array_paths = [path for path in paths if index < len(path) and path[index] == ""]
+
+ # if no path expects a list here, nothing will be mutated inside it - return by reference
+ if not array_paths:
+ return cast(_T, item)
+ return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
+ return item
diff --git a/src/limrun_api/_models.py b/src/limrun_api/_models.py
index 29070e0..8c5ab26 100644
--- a/src/limrun_api/_models.py
+++ b/src/limrun_api/_models.py
@@ -25,7 +25,9 @@
ClassVar,
Protocol,
Required,
+ Annotated,
ParamSpec,
+ TypeAlias,
TypedDict,
TypeGuard,
final,
@@ -79,7 +81,15 @@
from ._constants import RAW_RESPONSE_HEADER
if TYPE_CHECKING:
+ from pydantic import GetCoreSchemaHandler, ValidatorFunctionWrapHandler
+ from pydantic_core import CoreSchema, core_schema
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
+else:
+ try:
+ from pydantic_core import CoreSchema, core_schema
+ except ImportError:
+ CoreSchema = None
+ core_schema = None
__all__ = ["BaseModel", "GenericModel"]
@@ -396,6 +406,76 @@ def model_dump_json(
)
+class _EagerIterable(list[_T], Generic[_T]):
+ """
+ Accepts any Iterable[T] input (including generators), consumes it
+ eagerly, and validates all items upfront.
+
+ Validation preserves the original container type where possible
+ (e.g. a set[T] stays a set[T]). Serialization (model_dump / JSON)
+ always emits a list — round-tripping through model_dump() will not
+ restore the original container type.
+ """
+
+ @classmethod
+ def __get_pydantic_core_schema__(
+ cls,
+ source_type: Any,
+ handler: GetCoreSchemaHandler,
+ ) -> CoreSchema:
+ (item_type,) = get_args(source_type) or (Any,)
+ item_schema: CoreSchema = handler.generate_schema(item_type)
+ list_of_items_schema: CoreSchema = core_schema.list_schema(item_schema)
+
+ return core_schema.no_info_wrap_validator_function(
+ cls._validate,
+ list_of_items_schema,
+ serialization=core_schema.plain_serializer_function_ser_schema(
+ cls._serialize,
+ info_arg=False,
+ ),
+ )
+
+ @staticmethod
+ def _validate(v: Iterable[_T], handler: "ValidatorFunctionWrapHandler") -> Any:
+ original_type: type[Any] = type(v)
+
+ # Normalize to list so list_schema can validate each item
+ if isinstance(v, list):
+ items: list[_T] = v
+ else:
+ try:
+ items = list(v)
+ except TypeError as e:
+ raise TypeError("Value is not iterable") from e
+
+ # Validate items against the inner schema
+ validated: list[_T] = handler(items)
+
+ # Reconstruct original container type
+ if original_type is list:
+ return validated
+ # str(list) produces the list's repr, not a string built from items,
+ # so skip reconstruction for str and its subclasses.
+ if issubclass(original_type, str):
+ return validated
+ try:
+ return original_type(validated)
+ except (TypeError, ValueError):
+ # If the type cannot be reconstructed, just return the validated list
+ return validated
+
+ @staticmethod
+ def _serialize(v: Iterable[_T]) -> list[_T]:
+ """Always serialize as a list so Pydantic's JSON encoder is happy."""
+ if isinstance(v, list):
+ return v
+ return list(v)
+
+
+EagerIterable: TypeAlias = Annotated[Iterable[_T], _EagerIterable]
+
+
def _construct_field(value: object, field: FieldInfo, key: str) -> object:
if value is None:
return field_get_default(field)
diff --git a/src/limrun_api/_qs.py b/src/limrun_api/_qs.py
index de8c99b..4127c19 100644
--- a/src/limrun_api/_qs.py
+++ b/src/limrun_api/_qs.py
@@ -2,17 +2,13 @@
from typing import Any, List, Tuple, Union, Mapping, TypeVar
from urllib.parse import parse_qs, urlencode
-from typing_extensions import Literal, get_args
+from typing_extensions import get_args
-from ._types import NotGiven, not_given
+from ._types import NotGiven, ArrayFormat, NestedFormat, not_given
from ._utils import flatten
_T = TypeVar("_T")
-
-ArrayFormat = Literal["comma", "repeat", "indices", "brackets"]
-NestedFormat = Literal["dots", "brackets"]
-
PrimitiveData = Union[str, int, float, bool, None]
# this should be Data = Union[PrimitiveData, "List[Data]", "Tuple[Data]", "Mapping[str, Data]"]
# https://github.com/microsoft/pyright/issues/3555
diff --git a/src/limrun_api/_types.py b/src/limrun_api/_types.py
index dff0ca1..590918d 100644
--- a/src/limrun_api/_types.py
+++ b/src/limrun_api/_types.py
@@ -47,6 +47,9 @@
ModelT = TypeVar("ModelT", bound=pydantic.BaseModel)
_T = TypeVar("_T")
+ArrayFormat = Literal["comma", "repeat", "indices", "brackets"]
+NestedFormat = Literal["dots", "brackets"]
+
# Approximates httpx internal ProxiesTypes and RequestFiles types
# while adding support for `PathLike` instances
diff --git a/src/limrun_api/_utils/__init__.py b/src/limrun_api/_utils/__init__.py
index 10cb66d..1c090e5 100644
--- a/src/limrun_api/_utils/__init__.py
+++ b/src/limrun_api/_utils/__init__.py
@@ -24,7 +24,6 @@
coerce_integer as coerce_integer,
file_from_path as file_from_path,
strip_not_given as strip_not_given,
- deepcopy_minimal as deepcopy_minimal,
get_async_library as get_async_library,
maybe_coerce_float as maybe_coerce_float,
get_required_header as get_required_header,
diff --git a/src/limrun_api/_utils/_utils.py b/src/limrun_api/_utils/_utils.py
index 63b8cd6..199cd23 100644
--- a/src/limrun_api/_utils/_utils.py
+++ b/src/limrun_api/_utils/_utils.py
@@ -17,11 +17,11 @@
)
from pathlib import Path
from datetime import date, datetime
-from typing_extensions import TypeGuard
+from typing_extensions import TypeGuard, get_args
import sniffio
-from .._types import Omit, NotGiven, FileTypes, HeadersLike
+from .._types import Omit, NotGiven, FileTypes, ArrayFormat, HeadersLike
_T = TypeVar("_T")
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
@@ -40,25 +40,45 @@ def extract_files(
query: Mapping[str, object],
*,
paths: Sequence[Sequence[str]],
+ array_format: ArrayFormat = "brackets",
) -> list[tuple[str, FileTypes]]:
"""Recursively extract files from the given dictionary based on specified paths.
A path may look like this ['foo', 'files', '', 'data'].
+ ``array_format`` controls how ```` segments contribute to the emitted
+ field name. Supported values: ``"brackets"`` (``foo[]``), ``"repeat"`` and
+ ``"comma"`` (``foo``), ``"indices"`` (``foo[0]``, ``foo[1]``).
+
Note: this mutates the given dictionary.
"""
files: list[tuple[str, FileTypes]] = []
for path in paths:
- files.extend(_extract_items(query, path, index=0, flattened_key=None))
+ files.extend(_extract_items(query, path, index=0, flattened_key=None, array_format=array_format))
return files
+def _array_suffix(array_format: ArrayFormat, array_index: int) -> str:
+ if array_format == "brackets":
+ return "[]"
+ if array_format == "indices":
+ return f"[{array_index}]"
+ if array_format == "repeat" or array_format == "comma":
+ # Both repeat the bare field name for each file part; there is no
+ # meaningful way to comma-join binary parts.
+ return ""
+ raise NotImplementedError(
+ f"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}"
+ )
+
+
def _extract_items(
obj: object,
path: Sequence[str],
*,
index: int,
flattened_key: str | None,
+ array_format: ArrayFormat,
) -> list[tuple[str, FileTypes]]:
try:
key = path[index]
@@ -75,9 +95,11 @@ def _extract_items(
if is_list(obj):
files: list[tuple[str, FileTypes]] = []
- for entry in obj:
- assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "")
- files.append((flattened_key + "[]", cast(FileTypes, entry)))
+ for array_index, entry in enumerate(obj):
+ suffix = _array_suffix(array_format, array_index)
+ emitted_key = (flattened_key + suffix) if flattened_key else suffix
+ assert_is_file_content(entry, key=emitted_key)
+ files.append((emitted_key, cast(FileTypes, entry)))
return files
assert_is_file_content(obj, key=flattened_key)
@@ -106,6 +128,7 @@ def _extract_items(
path,
index=index,
flattened_key=flattened_key,
+ array_format=array_format,
)
elif is_list(obj):
if key != "":
@@ -117,9 +140,12 @@ def _extract_items(
item,
path,
index=index,
- flattened_key=flattened_key + "[]" if flattened_key is not None else "[]",
+ flattened_key=(
+ (flattened_key if flattened_key is not None else "") + _array_suffix(array_format, array_index)
+ ),
+ array_format=array_format,
)
- for item in obj
+ for array_index, item in enumerate(obj)
]
)
@@ -177,21 +203,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
return isinstance(obj, Iterable)
-def deepcopy_minimal(item: _T) -> _T:
- """Minimal reimplementation of copy.deepcopy() that will only copy certain object types:
-
- - mappings, e.g. `dict`
- - list
-
- This is done for performance reasons.
- """
- if is_mapping(item):
- return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
- if is_list(item):
- return cast(_T, [deepcopy_minimal(entry) for entry in item])
- return item
-
-
# copied from https://github.com/Rapptz/RoboDanny
def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
size = len(seq)
diff --git a/src/limrun_api/_version.py b/src/limrun_api/_version.py
index 7545109..ec85d32 100644
--- a/src/limrun_api/_version.py
+++ b/src/limrun_api/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "limrun_api"
-__version__ = "0.10.0" # x-release-please-version
+__version__ = "0.11.0" # x-release-please-version
diff --git a/src/limrun_api/resources/__init__.py b/src/limrun_api/resources/__init__.py
index 105723a..ffd10f7 100644
--- a/src/limrun_api/resources/__init__.py
+++ b/src/limrun_api/resources/__init__.py
@@ -8,6 +8,14 @@
AssetsResourceWithStreamingResponse,
AsyncAssetsResourceWithStreamingResponse,
)
+from .analytics import (
+ AnalyticsResource,
+ AsyncAnalyticsResource,
+ AnalyticsResourceWithRawResponse,
+ AsyncAnalyticsResourceWithRawResponse,
+ AnalyticsResourceWithStreamingResponse,
+ AsyncAnalyticsResourceWithStreamingResponse,
+)
from .ios_instances import (
IosInstancesResource,
AsyncIosInstancesResource,
@@ -16,6 +24,14 @@
IosInstancesResourceWithStreamingResponse,
AsyncIosInstancesResourceWithStreamingResponse,
)
+from .scoped_tokens import (
+ ScopedTokensResource,
+ AsyncScopedTokensResource,
+ ScopedTokensResourceWithRawResponse,
+ AsyncScopedTokensResourceWithRawResponse,
+ ScopedTokensResourceWithStreamingResponse,
+ AsyncScopedTokensResourceWithStreamingResponse,
+)
from .xcode_instances import (
XcodeInstancesResource,
AsyncXcodeInstancesResource,
@@ -24,6 +40,14 @@
XcodeInstancesResourceWithStreamingResponse,
AsyncXcodeInstancesResourceWithStreamingResponse,
)
+from .gradle_instances import (
+ GradleInstancesResource,
+ AsyncGradleInstancesResource,
+ GradleInstancesResourceWithRawResponse,
+ AsyncGradleInstancesResourceWithRawResponse,
+ GradleInstancesResourceWithStreamingResponse,
+ AsyncGradleInstancesResourceWithStreamingResponse,
+)
from .android_instances import (
AndroidInstancesResource,
AsyncAndroidInstancesResource,
@@ -58,4 +82,22 @@
"AsyncXcodeInstancesResourceWithRawResponse",
"XcodeInstancesResourceWithStreamingResponse",
"AsyncXcodeInstancesResourceWithStreamingResponse",
+ "GradleInstancesResource",
+ "AsyncGradleInstancesResource",
+ "GradleInstancesResourceWithRawResponse",
+ "AsyncGradleInstancesResourceWithRawResponse",
+ "GradleInstancesResourceWithStreamingResponse",
+ "AsyncGradleInstancesResourceWithStreamingResponse",
+ "AnalyticsResource",
+ "AsyncAnalyticsResource",
+ "AnalyticsResourceWithRawResponse",
+ "AsyncAnalyticsResourceWithRawResponse",
+ "AnalyticsResourceWithStreamingResponse",
+ "AsyncAnalyticsResourceWithStreamingResponse",
+ "ScopedTokensResource",
+ "AsyncScopedTokensResource",
+ "ScopedTokensResourceWithRawResponse",
+ "AsyncScopedTokensResourceWithRawResponse",
+ "ScopedTokensResourceWithStreamingResponse",
+ "AsyncScopedTokensResourceWithStreamingResponse",
]
diff --git a/src/limrun_api/resources/analytics.py b/src/limrun_api/resources/analytics.py
new file mode 100644
index 0000000..78f835a
--- /dev/null
+++ b/src/limrun_api/resources/analytics.py
@@ -0,0 +1,362 @@
+# 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 Literal
+
+import httpx
+
+from ..types import analytics_get_params, analytics_get_instances_params
+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.analytics_response import AnalyticsResponse
+from ..types.analytics_instances_response import AnalyticsInstancesResponse
+
+__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"]
+
+
+class AnalyticsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AnalyticsResourceWithRawResponse:
+ """
+ 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/limrun-inc/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return AnalyticsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AnalyticsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/limrun-inc/python-sdk#with_streaming_response
+ """
+ return AnalyticsResourceWithStreamingResponse(self)
+
+ def get(
+ self,
+ *,
+ from_: Union[str, datetime],
+ to: Union[str, datetime],
+ bucket: Literal["hour", "day", "week", "minute"] | Omit = omit,
+ labels: str | Omit = omit,
+ region: str | 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,
+ ) -> AnalyticsResponse:
+ """
+ Get analytics for the authenticated organization
+
+ Args:
+ from_: Start of the time range (inclusive, RFC3339)
+
+ to: End of the time range (exclusive, RFC3339)
+
+ bucket: Time bucket granularity for the analytics series
+
+ labels: Label selector to filter instances (e.g., "env=prod,team=backend")
+
+ region: Optional region filter
+
+ timezone: Optional IANA timezone used for time bucket grouping. Defaults to
+ America/Los_Angeles when omitted.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "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/v1/analytics",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "from_": from_,
+ "to": to,
+ "bucket": bucket,
+ "labels": labels,
+ "region": region,
+ "timezone": timezone,
+ },
+ analytics_get_params.AnalyticsGetParams,
+ ),
+ ),
+ cast_to=AnalyticsResponse,
+ )
+
+ def get_instances(
+ self,
+ *,
+ from_: Union[str, datetime],
+ to: Union[str, datetime],
+ labels: str | Omit = omit,
+ region: str | 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,
+ ) -> AnalyticsInstancesResponse:
+ """
+ Returns per-instance analytics grouped by minute bucket for detailed chart
+ views.
+
+ Args:
+ from_: Start of the time range (inclusive, RFC3339)
+
+ to: End of the time range (exclusive, RFC3339)
+
+ labels: Label selector to filter instances (e.g., "env=prod,team=backend")
+
+ region: Optional region filter
+
+ timezone: Optional IANA timezone used for minute bucket grouping. Defaults to
+ America/Los_Angeles when omitted.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "/v1/analytics/instances",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "from_": from_,
+ "to": to,
+ "labels": labels,
+ "region": region,
+ "timezone": timezone,
+ },
+ analytics_get_instances_params.AnalyticsGetInstancesParams,
+ ),
+ ),
+ cast_to=AnalyticsInstancesResponse,
+ )
+
+
+class AsyncAnalyticsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncAnalyticsResourceWithRawResponse:
+ """
+ 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/limrun-inc/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return AsyncAnalyticsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncAnalyticsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/limrun-inc/python-sdk#with_streaming_response
+ """
+ return AsyncAnalyticsResourceWithStreamingResponse(self)
+
+ async def get(
+ self,
+ *,
+ from_: Union[str, datetime],
+ to: Union[str, datetime],
+ bucket: Literal["hour", "day", "week", "minute"] | Omit = omit,
+ labels: str | Omit = omit,
+ region: str | 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,
+ ) -> AnalyticsResponse:
+ """
+ Get analytics for the authenticated organization
+
+ Args:
+ from_: Start of the time range (inclusive, RFC3339)
+
+ to: End of the time range (exclusive, RFC3339)
+
+ bucket: Time bucket granularity for the analytics series
+
+ labels: Label selector to filter instances (e.g., "env=prod,team=backend")
+
+ region: Optional region filter
+
+ timezone: Optional IANA timezone used for time bucket grouping. Defaults to
+ America/Los_Angeles when omitted.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "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/v1/analytics",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "from_": from_,
+ "to": to,
+ "bucket": bucket,
+ "labels": labels,
+ "region": region,
+ "timezone": timezone,
+ },
+ analytics_get_params.AnalyticsGetParams,
+ ),
+ ),
+ cast_to=AnalyticsResponse,
+ )
+
+ async def get_instances(
+ self,
+ *,
+ from_: Union[str, datetime],
+ to: Union[str, datetime],
+ labels: str | Omit = omit,
+ region: str | 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,
+ ) -> AnalyticsInstancesResponse:
+ """
+ Returns per-instance analytics grouped by minute bucket for detailed chart
+ views.
+
+ Args:
+ from_: Start of the time range (inclusive, RFC3339)
+
+ to: End of the time range (exclusive, RFC3339)
+
+ labels: Label selector to filter instances (e.g., "env=prod,team=backend")
+
+ region: Optional region filter
+
+ timezone: Optional IANA timezone used for minute bucket grouping. Defaults to
+ America/Los_Angeles when omitted.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "/v1/analytics/instances",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "from_": from_,
+ "to": to,
+ "labels": labels,
+ "region": region,
+ "timezone": timezone,
+ },
+ analytics_get_instances_params.AnalyticsGetInstancesParams,
+ ),
+ ),
+ cast_to=AnalyticsInstancesResponse,
+ )
+
+
+class AnalyticsResourceWithRawResponse:
+ def __init__(self, analytics: AnalyticsResource) -> None:
+ self._analytics = analytics
+
+ self.get = to_raw_response_wrapper(
+ analytics.get,
+ )
+ self.get_instances = to_raw_response_wrapper(
+ analytics.get_instances,
+ )
+
+
+class AsyncAnalyticsResourceWithRawResponse:
+ def __init__(self, analytics: AsyncAnalyticsResource) -> None:
+ self._analytics = analytics
+
+ self.get = async_to_raw_response_wrapper(
+ analytics.get,
+ )
+ self.get_instances = async_to_raw_response_wrapper(
+ analytics.get_instances,
+ )
+
+
+class AnalyticsResourceWithStreamingResponse:
+ def __init__(self, analytics: AnalyticsResource) -> None:
+ self._analytics = analytics
+
+ self.get = to_streamed_response_wrapper(
+ analytics.get,
+ )
+ self.get_instances = to_streamed_response_wrapper(
+ analytics.get_instances,
+ )
+
+
+class AsyncAnalyticsResourceWithStreamingResponse:
+ def __init__(self, analytics: AsyncAnalyticsResource) -> None:
+ self._analytics = analytics
+
+ self.get = async_to_streamed_response_wrapper(
+ analytics.get,
+ )
+ self.get_instances = async_to_streamed_response_wrapper(
+ analytics.get_instances,
+ )
diff --git a/src/limrun_api/resources/assets.py b/src/limrun_api/resources/assets.py
index e5c322d..1e41c34 100644
--- a/src/limrun_api/resources/assets.py
+++ b/src/limrun_api/resources/assets.py
@@ -2,6 +2,8 @@
from __future__ import annotations
+from typing_extensions import Literal
+
import httpx
from ..types import asset_get_params, asset_list_params, asset_get_or_create_params
@@ -49,8 +51,10 @@ def list(
include_app_store: bool | Omit = omit,
include_download_url: bool | Omit = omit,
include_upload_url: bool | Omit = omit,
+ kind_filter: Literal["App", "Keychain"] | Omit = omit,
limit: int | Omit = omit,
name_filter: str | Omit = omit,
+ name_prefix_filter: 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,
@@ -71,9 +75,21 @@ def list(
include_upload_url: Toggles whether an upload URL should be included in the response
+ kind_filter: Filters assets by kind.
+
limit: Maximum number of items to be returned. The default is 50.
- name_filter: Query by file name
+ name_filter: Case-sensitive exact match on the asset name. Cannot be combined with
+ namePrefixFilter. When combined with includeAppStore=true, a leading "appstore/"
+ is stripped before querying App Store assets (whose stored names never carry the
+ prefix).
+
+ name_prefix_filter: Case-sensitive prefix match on the asset name. LIKE wildcards ("%", "\\__") in the
+ value are treated as literal characters, not wildcards. Empty string is rejected
+ with 400; omit the parameter if no filtering is desired. Cannot be combined with
+ nameFilter. When combined with includeAppStore=true, a leading "appstore/" is
+ stripped before querying App Store assets (whose stored names never carry the
+ prefix); a partial prefix like "appstor" will not match any App Store assets.
extra_headers: Send extra headers
@@ -95,8 +111,10 @@ def list(
"include_app_store": include_app_store,
"include_download_url": include_download_url,
"include_upload_url": include_upload_url,
+ "kind_filter": kind_filter,
"limit": limit,
"name_filter": name_filter,
+ "name_prefix_filter": name_prefix_filter,
},
asset_list_params.AssetListParams,
),
@@ -191,6 +209,9 @@ def get_or_create(
self,
*,
name: str,
+ kind: Literal["App", "Keychain"] | Omit = omit,
+ platform: Literal["ios", "android", "xcode"] | Omit = omit,
+ ttl: 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,
@@ -207,6 +228,11 @@ def get_or_create(
in instances will fail until you use the returned upload URL to submit the file.
Args:
+ ttl: Optional time-to-live as a Go duration string (e.g. "24h"). When set, the asset
+ is deleted this long after now; minimum is 1m. Omit for no expiry. On re-upload
+ of an existing asset, a value updates the expiry while omitting it leaves the
+ current expiry unchanged.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -217,7 +243,15 @@ def get_or_create(
"""
return self._put(
"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/v1/assets",
- body=maybe_transform({"name": name}, asset_get_or_create_params.AssetGetOrCreateParams),
+ body=maybe_transform(
+ {
+ "name": name,
+ "kind": kind,
+ "platform": platform,
+ "ttl": ttl,
+ },
+ asset_get_or_create_params.AssetGetOrCreateParams,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -251,8 +285,10 @@ async def list(
include_app_store: bool | Omit = omit,
include_download_url: bool | Omit = omit,
include_upload_url: bool | Omit = omit,
+ kind_filter: Literal["App", "Keychain"] | Omit = omit,
limit: int | Omit = omit,
name_filter: str | Omit = omit,
+ name_prefix_filter: 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,
@@ -273,9 +309,21 @@ async def list(
include_upload_url: Toggles whether an upload URL should be included in the response
+ kind_filter: Filters assets by kind.
+
limit: Maximum number of items to be returned. The default is 50.
- name_filter: Query by file name
+ name_filter: Case-sensitive exact match on the asset name. Cannot be combined with
+ namePrefixFilter. When combined with includeAppStore=true, a leading "appstore/"
+ is stripped before querying App Store assets (whose stored names never carry the
+ prefix).
+
+ name_prefix_filter: Case-sensitive prefix match on the asset name. LIKE wildcards ("%", "\\__") in the
+ value are treated as literal characters, not wildcards. Empty string is rejected
+ with 400; omit the parameter if no filtering is desired. Cannot be combined with
+ nameFilter. When combined with includeAppStore=true, a leading "appstore/" is
+ stripped before querying App Store assets (whose stored names never carry the
+ prefix); a partial prefix like "appstor" will not match any App Store assets.
extra_headers: Send extra headers
@@ -297,8 +345,10 @@ async def list(
"include_app_store": include_app_store,
"include_download_url": include_download_url,
"include_upload_url": include_upload_url,
+ "kind_filter": kind_filter,
"limit": limit,
"name_filter": name_filter,
+ "name_prefix_filter": name_prefix_filter,
},
asset_list_params.AssetListParams,
),
@@ -393,6 +443,9 @@ async def get_or_create(
self,
*,
name: str,
+ kind: Literal["App", "Keychain"] | Omit = omit,
+ platform: Literal["ios", "android", "xcode"] | Omit = omit,
+ ttl: 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,
@@ -409,6 +462,11 @@ async def get_or_create(
in instances will fail until you use the returned upload URL to submit the file.
Args:
+ ttl: Optional time-to-live as a Go duration string (e.g. "24h"). When set, the asset
+ is deleted this long after now; minimum is 1m. Omit for no expiry. On re-upload
+ of an existing asset, a value updates the expiry while omitting it leaves the
+ current expiry unchanged.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -419,7 +477,15 @@ async def get_or_create(
"""
return await self._put(
"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/v1/assets",
- body=await async_maybe_transform({"name": name}, asset_get_or_create_params.AssetGetOrCreateParams),
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "kind": kind,
+ "platform": platform,
+ "ttl": ttl,
+ },
+ asset_get_or_create_params.AssetGetOrCreateParams,
+ ),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
diff --git a/src/limrun_api/resources/gradle_instances.py b/src/limrun_api/resources/gradle_instances.py
new file mode 100644
index 0000000..12881e6
--- /dev/null
+++ b/src/limrun_api/resources/gradle_instances.py
@@ -0,0 +1,502 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..types import gradle_instance_list_params, gradle_instance_create_params
+from .._types import Body, Omit, Query, Headers, NoneType, 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 ..pagination import SyncItems, AsyncItems
+from .._base_client import AsyncPaginator, make_request_options
+from ..types.gradle_instance import GradleInstance
+
+__all__ = ["GradleInstancesResource", "AsyncGradleInstancesResource"]
+
+
+class GradleInstancesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> GradleInstancesResourceWithRawResponse:
+ """
+ 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/limrun-inc/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return GradleInstancesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> GradleInstancesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/limrun-inc/python-sdk#with_streaming_response
+ """
+ return GradleInstancesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ reuse_if_exists: bool | Omit = omit,
+ wait: bool | Omit = omit,
+ metadata: gradle_instance_create_params.Metadata | Omit = omit,
+ spec: gradle_instance_create_params.Spec | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> GradleInstance:
+ """
+ Create a Gradle instance
+
+ Args:
+ reuse_if_exists: If there is another instance with given labels and region, return that one
+ instead of creating a new instance.
+
+ wait: Return after the instance is ready to connect.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "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/v1/gradle_instances",
+ body=maybe_transform(
+ {
+ "metadata": metadata,
+ "spec": spec,
+ },
+ gradle_instance_create_params.GradleInstanceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "reuse_if_exists": reuse_if_exists,
+ "wait": wait,
+ },
+ gradle_instance_create_params.GradleInstanceCreateParams,
+ ),
+ ),
+ cast_to=GradleInstance,
+ )
+
+ def list(
+ self,
+ *,
+ ending_before: str | Omit = omit,
+ label_selector: str | Omit = omit,
+ limit: int | Omit = omit,
+ starting_after: str | Omit = omit,
+ state: 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,
+ ) -> SyncItems[GradleInstance]:
+ """
+ List Gradle instances
+
+ Args:
+ label_selector: Labels filter to apply to instances to return. Expects a comma-separated list of
+ key=value pairs (e.g., env=prod,region=us-west).
+
+ limit: Maximum number of items to be returned. The default is 50.
+
+ state: State filter to apply to Gradle instances to return. Each comma-separated state
+ will be used as part of an OR clause, e.g. "assigned,ready" will return all
+ instances that are either assigned or ready.
+
+ Valid states: creating, assigned, ready, terminated, unknown
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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_api_list(
+ "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/v1/gradle_instances",
+ page=SyncItems[GradleInstance],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "ending_before": ending_before,
+ "label_selector": label_selector,
+ "limit": limit,
+ "starting_after": starting_after,
+ "state": state,
+ },
+ gradle_instance_list_params.GradleInstanceListParams,
+ ),
+ ),
+ model=GradleInstance,
+ )
+
+ def delete(
+ self,
+ 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:
+ """
+ Delete Gradle instance with given 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return self._delete(
+ path_template("/v1/gradle_instances/{id}", id=id),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+ def get(
+ self,
+ 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,
+ ) -> GradleInstance:
+ """
+ Get Gradle instance with given 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get(
+ path_template("/v1/gradle_instances/{id}", id=id),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=GradleInstance,
+ )
+
+
+class AsyncGradleInstancesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncGradleInstancesResourceWithRawResponse:
+ """
+ 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/limrun-inc/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return AsyncGradleInstancesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncGradleInstancesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/limrun-inc/python-sdk#with_streaming_response
+ """
+ return AsyncGradleInstancesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ reuse_if_exists: bool | Omit = omit,
+ wait: bool | Omit = omit,
+ metadata: gradle_instance_create_params.Metadata | Omit = omit,
+ spec: gradle_instance_create_params.Spec | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> GradleInstance:
+ """
+ Create a Gradle instance
+
+ Args:
+ reuse_if_exists: If there is another instance with given labels and region, return that one
+ instead of creating a new instance.
+
+ wait: Return after the instance is ready to connect.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "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/v1/gradle_instances",
+ body=await async_maybe_transform(
+ {
+ "metadata": metadata,
+ "spec": spec,
+ },
+ gradle_instance_create_params.GradleInstanceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "reuse_if_exists": reuse_if_exists,
+ "wait": wait,
+ },
+ gradle_instance_create_params.GradleInstanceCreateParams,
+ ),
+ ),
+ cast_to=GradleInstance,
+ )
+
+ def list(
+ self,
+ *,
+ ending_before: str | Omit = omit,
+ label_selector: str | Omit = omit,
+ limit: int | Omit = omit,
+ starting_after: str | Omit = omit,
+ state: 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,
+ ) -> AsyncPaginator[GradleInstance, AsyncItems[GradleInstance]]:
+ """
+ List Gradle instances
+
+ Args:
+ label_selector: Labels filter to apply to instances to return. Expects a comma-separated list of
+ key=value pairs (e.g., env=prod,region=us-west).
+
+ limit: Maximum number of items to be returned. The default is 50.
+
+ state: State filter to apply to Gradle instances to return. Each comma-separated state
+ will be used as part of an OR clause, e.g. "assigned,ready" will return all
+ instances that are either assigned or ready.
+
+ Valid states: creating, assigned, ready, terminated, unknown
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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_api_list(
+ "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/v1/gradle_instances",
+ page=AsyncItems[GradleInstance],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "ending_before": ending_before,
+ "label_selector": label_selector,
+ "limit": limit,
+ "starting_after": starting_after,
+ "state": state,
+ },
+ gradle_instance_list_params.GradleInstanceListParams,
+ ),
+ ),
+ model=GradleInstance,
+ )
+
+ async def delete(
+ self,
+ 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:
+ """
+ Delete Gradle instance with given 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return await self._delete(
+ path_template("/v1/gradle_instances/{id}", id=id),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+ async def get(
+ self,
+ 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,
+ ) -> GradleInstance:
+ """
+ Get Gradle instance with given 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._get(
+ path_template("/v1/gradle_instances/{id}", id=id),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=GradleInstance,
+ )
+
+
+class GradleInstancesResourceWithRawResponse:
+ def __init__(self, gradle_instances: GradleInstancesResource) -> None:
+ self._gradle_instances = gradle_instances
+
+ self.create = to_raw_response_wrapper(
+ gradle_instances.create,
+ )
+ self.list = to_raw_response_wrapper(
+ gradle_instances.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ gradle_instances.delete,
+ )
+ self.get = to_raw_response_wrapper(
+ gradle_instances.get,
+ )
+
+
+class AsyncGradleInstancesResourceWithRawResponse:
+ def __init__(self, gradle_instances: AsyncGradleInstancesResource) -> None:
+ self._gradle_instances = gradle_instances
+
+ self.create = async_to_raw_response_wrapper(
+ gradle_instances.create,
+ )
+ self.list = async_to_raw_response_wrapper(
+ gradle_instances.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ gradle_instances.delete,
+ )
+ self.get = async_to_raw_response_wrapper(
+ gradle_instances.get,
+ )
+
+
+class GradleInstancesResourceWithStreamingResponse:
+ def __init__(self, gradle_instances: GradleInstancesResource) -> None:
+ self._gradle_instances = gradle_instances
+
+ self.create = to_streamed_response_wrapper(
+ gradle_instances.create,
+ )
+ self.list = to_streamed_response_wrapper(
+ gradle_instances.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ gradle_instances.delete,
+ )
+ self.get = to_streamed_response_wrapper(
+ gradle_instances.get,
+ )
+
+
+class AsyncGradleInstancesResourceWithStreamingResponse:
+ def __init__(self, gradle_instances: AsyncGradleInstancesResource) -> None:
+ self._gradle_instances = gradle_instances
+
+ self.create = async_to_streamed_response_wrapper(
+ gradle_instances.create,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ gradle_instances.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ gradle_instances.delete,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ gradle_instances.get,
+ )
diff --git a/src/limrun_api/resources/scoped_tokens.py b/src/limrun_api/resources/scoped_tokens.py
new file mode 100644
index 0000000..f5db54d
--- /dev/null
+++ b/src/limrun_api/resources/scoped_tokens.py
@@ -0,0 +1,197 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..types import scoped_token_create_params
+from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, 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.scoped_token import ScopedToken
+
+__all__ = ["ScopedTokensResource", "AsyncScopedTokensResource"]
+
+
+class ScopedTokensResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ScopedTokensResourceWithRawResponse:
+ """
+ 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/limrun-inc/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return ScopedTokensResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ScopedTokensResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/limrun-inc/python-sdk#with_streaming_response
+ """
+ return ScopedTokensResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ scopes: SequenceNotStr[str],
+ ttl_seconds: 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,
+ ) -> ScopedToken:
+ """
+ Mint a short-lived scoped token whose scopes limit what the holder can do, e.g.
+ install a specific asset on a device through the registry. The token is verified
+ offline by services holding the token signing public key and cannot be revoked,
+ so keep TTLs short. It is bound to the authenticated caller's organization.
+
+ Args:
+ scopes: Scopes in the form `::`, e.g. `device:*:install`,
+ `asset:asset_01h455vb4pex5vsknk084sn02q:read` or `applerelay:*:connect`.
+ Resource IDs are the customer-visible IDs returned by the API.
+
+ ttl_seconds: How long the token stays valid. Defaults to 3600 (1 hour), maximum is 14400 (4
+ hours).
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "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/v1/scoped_tokens",
+ body=maybe_transform(
+ {
+ "scopes": scopes,
+ "ttl_seconds": ttl_seconds,
+ },
+ scoped_token_create_params.ScopedTokenCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ScopedToken,
+ )
+
+
+class AsyncScopedTokensResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncScopedTokensResourceWithRawResponse:
+ """
+ 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/limrun-inc/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return AsyncScopedTokensResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncScopedTokensResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/limrun-inc/python-sdk#with_streaming_response
+ """
+ return AsyncScopedTokensResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ scopes: SequenceNotStr[str],
+ ttl_seconds: 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,
+ ) -> ScopedToken:
+ """
+ Mint a short-lived scoped token whose scopes limit what the holder can do, e.g.
+ install a specific asset on a device through the registry. The token is verified
+ offline by services holding the token signing public key and cannot be revoked,
+ so keep TTLs short. It is bound to the authenticated caller's organization.
+
+ Args:
+ scopes: Scopes in the form `::`, e.g. `device:*:install`,
+ `asset:asset_01h455vb4pex5vsknk084sn02q:read` or `applerelay:*:connect`.
+ Resource IDs are the customer-visible IDs returned by the API.
+
+ ttl_seconds: How long the token stays valid. Defaults to 3600 (1 hour), maximum is 14400 (4
+ hours).
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters 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(
+ "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/v1/scoped_tokens",
+ body=await async_maybe_transform(
+ {
+ "scopes": scopes,
+ "ttl_seconds": ttl_seconds,
+ },
+ scoped_token_create_params.ScopedTokenCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ScopedToken,
+ )
+
+
+class ScopedTokensResourceWithRawResponse:
+ def __init__(self, scoped_tokens: ScopedTokensResource) -> None:
+ self._scoped_tokens = scoped_tokens
+
+ self.create = to_raw_response_wrapper(
+ scoped_tokens.create,
+ )
+
+
+class AsyncScopedTokensResourceWithRawResponse:
+ def __init__(self, scoped_tokens: AsyncScopedTokensResource) -> None:
+ self._scoped_tokens = scoped_tokens
+
+ self.create = async_to_raw_response_wrapper(
+ scoped_tokens.create,
+ )
+
+
+class ScopedTokensResourceWithStreamingResponse:
+ def __init__(self, scoped_tokens: ScopedTokensResource) -> None:
+ self._scoped_tokens = scoped_tokens
+
+ self.create = to_streamed_response_wrapper(
+ scoped_tokens.create,
+ )
+
+
+class AsyncScopedTokensResourceWithStreamingResponse:
+ def __init__(self, scoped_tokens: AsyncScopedTokensResource) -> None:
+ self._scoped_tokens = scoped_tokens
+
+ self.create = async_to_streamed_response_wrapper(
+ scoped_tokens.create,
+ )
diff --git a/src/limrun_api/types/__init__.py b/src/limrun_api/types/__init__.py
index b3870b5..3f44629 100644
--- a/src/limrun_api/types/__init__.py
+++ b/src/limrun_api/types/__init__.py
@@ -4,16 +4,25 @@
from .asset import Asset as Asset
from .ios_instance import IosInstance as IosInstance
+from .scoped_token import ScopedToken as ScopedToken
from .xcode_instance import XcodeInstance as XcodeInstance
+from .gradle_instance import GradleInstance as GradleInstance
from .android_instance import AndroidInstance as AndroidInstance
from .asset_get_params import AssetGetParams as AssetGetParams
from .asset_list_params import AssetListParams as AssetListParams
+from .analytics_response import AnalyticsResponse as AnalyticsResponse
from .asset_list_response import AssetListResponse as AssetListResponse
+from .analytics_get_params import AnalyticsGetParams as AnalyticsGetParams
from .ios_instance_list_params import IosInstanceListParams as IosInstanceListParams
from .asset_get_or_create_params import AssetGetOrCreateParams as AssetGetOrCreateParams
from .ios_instance_create_params import IosInstanceCreateParams as IosInstanceCreateParams
+from .scoped_token_create_params import ScopedTokenCreateParams as ScopedTokenCreateParams
from .xcode_instance_list_params import XcodeInstanceListParams as XcodeInstanceListParams
+from .gradle_instance_list_params import GradleInstanceListParams as GradleInstanceListParams
+from .analytics_instances_response import AnalyticsInstancesResponse as AnalyticsInstancesResponse
from .android_instance_list_params import AndroidInstanceListParams as AndroidInstanceListParams
from .asset_get_or_create_response import AssetGetOrCreateResponse as AssetGetOrCreateResponse
from .xcode_instance_create_params import XcodeInstanceCreateParams as XcodeInstanceCreateParams
+from .gradle_instance_create_params import GradleInstanceCreateParams as GradleInstanceCreateParams
+from .analytics_get_instances_params import AnalyticsGetInstancesParams as AnalyticsGetInstancesParams
from .android_instance_create_params import AndroidInstanceCreateParams as AndroidInstanceCreateParams
diff --git a/src/limrun_api/types/analytics_get_instances_params.py b/src/limrun_api/types/analytics_get_instances_params.py
new file mode 100644
index 0000000..3f00d7b
--- /dev/null
+++ b/src/limrun_api/types/analytics_get_instances_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 import Union
+from datetime import datetime
+from typing_extensions import Required, Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["AnalyticsGetInstancesParams"]
+
+
+class AnalyticsGetInstancesParams(TypedDict, total=False):
+ from_: Required[Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")]]
+ """Start of the time range (inclusive, RFC3339)"""
+
+ to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]
+ """End of the time range (exclusive, RFC3339)"""
+
+ labels: str
+ """Label selector to filter instances (e.g., "env=prod,team=backend")"""
+
+ region: str
+ """Optional region filter"""
+
+ timezone: str
+ """Optional IANA timezone used for minute bucket grouping.
+
+ Defaults to America/Los_Angeles when omitted.
+ """
diff --git a/src/limrun_api/types/analytics_get_params.py b/src/limrun_api/types/analytics_get_params.py
new file mode 100644
index 0000000..3eed040
--- /dev/null
+++ b/src/limrun_api/types/analytics_get_params.py
@@ -0,0 +1,34 @@
+# 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 Literal, Required, Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["AnalyticsGetParams"]
+
+
+class AnalyticsGetParams(TypedDict, total=False):
+ from_: Required[Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")]]
+ """Start of the time range (inclusive, RFC3339)"""
+
+ to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]
+ """End of the time range (exclusive, RFC3339)"""
+
+ bucket: Literal["hour", "day", "week", "minute"]
+ """Time bucket granularity for the analytics series"""
+
+ labels: str
+ """Label selector to filter instances (e.g., "env=prod,team=backend")"""
+
+ region: str
+ """Optional region filter"""
+
+ timezone: str
+ """Optional IANA timezone used for time bucket grouping.
+
+ Defaults to America/Los_Angeles when omitted.
+ """
diff --git a/src/limrun_api/types/analytics_instances_response.py b/src/limrun_api/types/analytics_instances_response.py
new file mode 100644
index 0000000..d77808e
--- /dev/null
+++ b/src/limrun_api/types/analytics_instances_response.py
@@ -0,0 +1,98 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from .._models import BaseModel
+
+__all__ = [
+ "AnalyticsInstancesResponse",
+ "Series",
+ "SeriesInstance",
+ "SeriesInstanceBilledBreakdown",
+ "SeriesInstanceCostBreakdown",
+]
+
+
+class SeriesInstanceBilledBreakdown(BaseModel):
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+
+ plan_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="planBilledMinutes", default=None)
+ """Map of plan ID to billed minutes"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+
+class SeriesInstanceCostBreakdown(BaseModel):
+ """Cost breakdown by billing source in dollars"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ plan_cost: Optional[Dict[str, float]] = FieldInfo(alias="planCost", default=None)
+ """Map of plan ID to cost in dollars"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SeriesInstance(BaseModel):
+ """Analytics details for a single instance within a time bucket"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars for this instance"""
+
+ instance_tid: str = FieldInfo(alias="instanceTid")
+ """Instance type ID (e.g., ios_xxx, android_xxx)"""
+
+ platform: Literal["android", "ios", "xcode", "gradle"]
+ """Platform name."""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ billed_breakdown: Optional[SeriesInstanceBilledBreakdown] = FieldInfo(alias="billedBreakdown", default=None)
+
+ cost_breakdown: Optional[SeriesInstanceCostBreakdown] = FieldInfo(alias="costBreakdown", default=None)
+ """Cost breakdown by billing source in dollars"""
+
+ labels: Optional[Dict[str, str]] = None
+ """Instance labels at billing time"""
+
+ region: Optional[str] = None
+ """Region where the instance ran"""
+
+
+class Series(BaseModel):
+ instances: List[SeriesInstance]
+
+ timestamp: str
+ """
+ RFC3339 timestamp for the start of the minute bucket in the requested timezone,
+ including the local offset
+ """
+
+
+class AnalyticsInstancesResponse(BaseModel):
+ as_of: datetime = FieldInfo(alias="asOf")
+
+ from_: datetime = FieldInfo(alias="from")
+
+ series: List[Series]
+
+ timezone: str
+ """IANA timezone used for time bucket grouping"""
+
+ to: datetime
diff --git a/src/limrun_api/types/analytics_response.py b/src/limrun_api/types/analytics_response.py
new file mode 100644
index 0000000..c774623
--- /dev/null
+++ b/src/limrun_api/types/analytics_response.py
@@ -0,0 +1,443 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from .._models import BaseModel
+
+__all__ = [
+ "AnalyticsResponse",
+ "Series",
+ "SeriesAndroid",
+ "SeriesGradle",
+ "SeriesIos",
+ "SeriesXcode",
+ "SeriesInstance",
+ "SeriesInstanceBilledBreakdown",
+ "SeriesInstanceCostBreakdown",
+ "Summary",
+ "SummaryAndroid",
+ "SummaryGradle",
+ "SummaryIos",
+ "SummaryXcode",
+]
+
+
+class SeriesAndroid(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SeriesGradle(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SeriesIos(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SeriesXcode(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SeriesInstanceBilledBreakdown(BaseModel):
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+
+ plan_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="planBilledMinutes", default=None)
+ """Map of plan ID to billed minutes"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+
+class SeriesInstanceCostBreakdown(BaseModel):
+ """Cost breakdown by billing source in dollars"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ plan_cost: Optional[Dict[str, float]] = FieldInfo(alias="planCost", default=None)
+ """Map of plan ID to cost in dollars"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SeriesInstance(BaseModel):
+ """Analytics details for a single instance within a time bucket"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars for this instance"""
+
+ instance_tid: str = FieldInfo(alias="instanceTid")
+ """Instance type ID (e.g., ios_xxx, android_xxx)"""
+
+ platform: Literal["android", "ios", "xcode", "gradle"]
+ """Platform name."""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ billed_breakdown: Optional[SeriesInstanceBilledBreakdown] = FieldInfo(alias="billedBreakdown", default=None)
+
+ cost_breakdown: Optional[SeriesInstanceCostBreakdown] = FieldInfo(alias="costBreakdown", default=None)
+ """Cost breakdown by billing source in dollars"""
+
+ labels: Optional[Dict[str, str]] = None
+ """Instance labels at billing time"""
+
+ region: Optional[str] = None
+ """Region where the instance ran"""
+
+
+class Series(BaseModel):
+ """Analytics data for a single time bucket, broken down by platform and region"""
+
+ android: Dict[str, SeriesAndroid]
+ """Map of region to analytics stats for Android"""
+
+ gradle: Dict[str, SeriesGradle]
+ """Map of region to analytics stats for Gradle"""
+
+ ios: Dict[str, SeriesIos]
+ """Map of region to analytics stats for iOS"""
+
+ timestamp: str
+ """
+ RFC3339 timestamp for the start of the bucket in the requested timezone,
+ including the local offset
+ """
+
+ xcode: Dict[str, SeriesXcode]
+ """Map of region to analytics stats for Xcode"""
+
+ instances: Optional[List[SeriesInstance]] = None
+ """Individual instance details for this time bucket"""
+
+
+class SummaryAndroid(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SummaryGradle(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SummaryIos(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class SummaryXcode(BaseModel):
+ """Complete analytics for a specific region including billing breakdown"""
+
+ avg_duration_minutes: float = FieldInfo(alias="avgDurationMinutes")
+ """Average instance duration in minutes"""
+
+ billed_minutes: int = FieldInfo(alias="billedMinutes")
+ """Billed minutes with platform multiplier applied"""
+
+ cost: float
+ """Total cost in dollars"""
+
+ count: int
+ """Number of unique instances"""
+
+ credits_billed_minutes: int = FieldInfo(alias="creditsBilledMinutes")
+ """Minutes billed to credits"""
+
+ credits_cost: float = FieldInfo(alias="creditsCost")
+ """Cost from credits (always 0)"""
+
+ on_demand_billed_minutes: int = FieldInfo(alias="onDemandBilledMinutes")
+ """Minutes billed on-demand"""
+
+ on_demand_cost: float = FieldInfo(alias="onDemandCost")
+ """Cost from on-demand billing in dollars"""
+
+ runtime_minutes: int = FieldInfo(alias="runtimeMinutes")
+ """Actual runtime minutes before platform multiplier"""
+
+ subscription_billed_minutes: Optional[Dict[str, int]] = FieldInfo(alias="subscriptionBilledMinutes", default=None)
+ """Map of subscription ID to billed minutes"""
+
+ subscription_cost: Optional[Dict[str, float]] = FieldInfo(alias="subscriptionCost", default=None)
+ """Map of subscription ID to cost in dollars"""
+
+
+class Summary(BaseModel):
+ """
+ Summary of analytics across all time buckets, broken down by platform and region
+ """
+
+ android: Dict[str, SummaryAndroid]
+ """Map of region to analytics stats for Android"""
+
+ gradle: Dict[str, SummaryGradle]
+ """Map of region to analytics stats for Gradle"""
+
+ ios: Dict[str, SummaryIos]
+ """Map of region to analytics stats for iOS"""
+
+ xcode: Dict[str, SummaryXcode]
+ """Map of region to analytics stats for Xcode"""
+
+
+class AnalyticsResponse(BaseModel):
+ as_of: datetime = FieldInfo(alias="asOf")
+
+ bucket: Literal["hour", "day", "week", "minute"]
+
+ from_: datetime = FieldInfo(alias="from")
+
+ series: List[Series]
+
+ summary: Summary
+ """
+ Summary of analytics across all time buckets, broken down by platform and region
+ """
+
+ timezone: str
+ """IANA timezone used for time bucket grouping"""
+
+ to: datetime
diff --git a/src/limrun_api/types/android_instance.py b/src/limrun_api/types/android_instance.py
index c5996af..a10f879 100644
--- a/src/limrun_api/types/android_instance.py
+++ b/src/limrun_api/types/android_instance.py
@@ -28,9 +28,9 @@ class Metadata(BaseModel):
class Spec(BaseModel):
inactivity_timeout: str = FieldInfo(alias="inactivityTimeout")
"""
- After how many minutes of inactivity should the instance be terminated. Example
- values 1m, 10m, 3h. Default is 3m. Providing "0" uses the organization's default
- inactivity timeout.
+ After how many minutes of inactivity should the instance be terminated. The
+ timer starts once the instance becomes ready. Example values 1m, 10m, 3h.
+ Default is 3m. Providing "0" uses the organization's default inactivity timeout.
"""
region: str
@@ -71,8 +71,25 @@ class Status(BaseModel):
sandbox: Optional[StatusSandbox] = None
+ signed_stream_url: Optional[str] = FieldInfo(alias="signedStreamUrl", default=None)
+
target_http_port_url_prefix: Optional[str] = FieldInfo(alias="targetHttpPortUrlPrefix", default=None)
+ termination_reason: Optional[str] = FieldInfo(alias="terminationReason", default=None)
+ """Machine-readable reason the instance was terminated.
+
+ Always present once state is "terminated", never present before that. New values
+ may be added over time, so treat any unrecognized value as "Unknown". Known
+ values:
+
+ - "UserRequested": terminated by a delete request to the API.
+ - "InactivityTimeout": the timeout given in spec.inactivityTimeout elapsed.
+ - "HardTimeout": the timeout given in spec.hardTimeout elapsed.
+ - "Unknown": terminated for a cause the platform did not attribute, including
+ instances that failed to get ready during creation. See errorMessage for
+ details when available.
+ """
+
class AndroidInstance(BaseModel):
metadata: Metadata
diff --git a/src/limrun_api/types/android_instance_create_params.py b/src/limrun_api/types/android_instance_create_params.py
index 97f08b8..a757779 100644
--- a/src/limrun_api/types/android_instance_create_params.py
+++ b/src/limrun_api/types/android_instance_create_params.py
@@ -77,6 +77,8 @@ class SpecInitialAsset(TypedDict, total=False):
class SpecSandboxPlaywrightAndroid(TypedDict, total=False):
enabled: bool
+ version: Literal["1.56.1-lim.1", "1.60.0-lim.1"]
+
class SpecSandbox(TypedDict, total=False):
playwright_android: Annotated[SpecSandboxPlaywrightAndroid, PropertyInfo(alias="playwrightAndroid")]
@@ -93,17 +95,43 @@ class Spec(TypedDict, total=False):
inactivity_timeout: Annotated[str, PropertyInfo(alias="inactivityTimeout")]
"""
- After how many minutes of inactivity should the instance be terminated. Example
- values 1m, 10m, 3h. Default is 3m. Providing "0" uses the organization's default
- inactivity timeout.
+ After how many minutes of inactivity should the instance be terminated. The
+ timer starts once the instance becomes ready. Example values 1m, 10m, 3h.
+ Default is 3m. Providing "0" uses the organization's default inactivity timeout.
"""
initial_assets: Annotated[Iterable[SpecInitialAsset], PropertyInfo(alias="initialAssets")]
+ jurisdiction: Literal["us", "eu", "as"]
+ """Restricts scheduling to regions in the given jurisdiction.
+
+ Unlike region, this is a hard constraint: the request never overflows to a
+ region outside the jurisdiction and fails when no region in the jurisdiction has
+ capacity. A region belongs to a jurisdiction when its name starts with the
+ jurisdiction prefix, e.g. "eu-north1" is in "eu". A region preference pointing
+ outside the jurisdiction is ignored.
+ """
+
region: str
- """The region where the instance will be created.
+ """Where the instance will be created.
+
+ If not given, the region is decided based on scheduling clues (client IP) and
+ availability.
+
+ A region is a preference, not a hard pin: the request always overflows to every
+ other available region, ordered by proximity, when the preferred ones are full.
+
+ Accepted values:
- If not given, will be decided based on scheduling clues and availability.
+ - A specific region name (e.g. "us-west1"). It is tried first, then the
+ remaining regions in order of proximity to it. Scheduling clues (client IP)
+ are ignored when a region is given.
+ - A region group name (e.g. "us", "eu"). Its member regions are tried first in
+ their listed order, then the remaining regions by proximity to the first
+ member.
+ - A pipe-separated, ordered list of regions (e.g. "us-east1|us-west1"). Those
+ are tried first in the given order, then the remaining regions by proximity to
+ the first.
"""
sandbox: SpecSandbox
diff --git a/src/limrun_api/types/asset.py b/src/limrun_api/types/asset.py
index b664eb5..c920f7b 100644
--- a/src/limrun_api/types/asset.py
+++ b/src/limrun_api/types/asset.py
@@ -1,6 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
+from datetime import datetime
from typing_extensions import Literal
from pydantic import Field as FieldInfo
@@ -13,16 +14,24 @@
class Asset(BaseModel):
id: str
+ kind: Literal["App", "Keychain"]
+
name: str
display_name: Optional[str] = FieldInfo(alias="displayName", default=None)
"""Human-readable display name for the asset. If not set, the name should be used."""
+ expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)
+ """When set, the time after which the asset is automatically deleted."""
+
md5: Optional[str] = None
"""Returned only if there is a corresponding file uploaded already."""
- os: Optional[Literal["ios", "android"]] = None
- """The operating system this asset is for.
+ os: Optional[Literal["ios", "android", "xcode"]] = None
+ """Deprecated: alias of platform, always mirrors it. Use platform instead."""
+
+ platform: Optional[Literal["ios", "android", "xcode"]] = None
+ """The platform this asset is for.
If not set, the asset is available for all platforms.
"""
diff --git a/src/limrun_api/types/asset_get_or_create_params.py b/src/limrun_api/types/asset_get_or_create_params.py
index 2c8a4d8..84620f8 100644
--- a/src/limrun_api/types/asset_get_or_create_params.py
+++ b/src/limrun_api/types/asset_get_or_create_params.py
@@ -2,10 +2,22 @@
from __future__ import annotations
-from typing_extensions import Required, TypedDict
+from typing_extensions import Literal, Required, TypedDict
__all__ = ["AssetGetOrCreateParams"]
class AssetGetOrCreateParams(TypedDict, total=False):
name: Required[str]
+
+ kind: Literal["App", "Keychain"]
+
+ platform: Literal["ios", "android", "xcode"]
+
+ ttl: str
+ """Optional time-to-live as a Go duration string (e.g.
+
+ "24h"). When set, the asset is deleted this long after now; minimum is 1m. Omit
+ for no expiry. On re-upload of an existing asset, a value updates the expiry
+ while omitting it leaves the current expiry unchanged.
+ """
diff --git a/src/limrun_api/types/asset_get_or_create_response.py b/src/limrun_api/types/asset_get_or_create_response.py
index 66bc97d..9ce1229 100644
--- a/src/limrun_api/types/asset_get_or_create_response.py
+++ b/src/limrun_api/types/asset_get_or_create_response.py
@@ -1,6 +1,8 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
from pydantic import Field as FieldInfo
@@ -12,11 +14,18 @@
class AssetGetOrCreateResponse(BaseModel):
id: str
+ kind: Literal["App", "Keychain"]
+
name: str
signed_download_url: str = FieldInfo(alias="signedDownloadUrl")
signed_upload_url: str = FieldInfo(alias="signedUploadUrl")
+ expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)
+ """When set, the time after which the asset is automatically deleted."""
+
md5: Optional[str] = None
"""Returned only if there is a corresponding file uploaded already."""
+
+ platform: Optional[Literal["ios", "android", "xcode"]] = None
diff --git a/src/limrun_api/types/asset_list_params.py b/src/limrun_api/types/asset_list_params.py
index 5984065..3416046 100644
--- a/src/limrun_api/types/asset_list_params.py
+++ b/src/limrun_api/types/asset_list_params.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing_extensions import Annotated, TypedDict
+from typing_extensions import Literal, Annotated, TypedDict
from .._utils import PropertyInfo
@@ -22,8 +22,26 @@ class AssetListParams(TypedDict, total=False):
include_upload_url: Annotated[bool, PropertyInfo(alias="includeUploadUrl")]
"""Toggles whether an upload URL should be included in the response"""
+ kind_filter: Annotated[Literal["App", "Keychain"], PropertyInfo(alias="kindFilter")]
+ """Filters assets by kind."""
+
limit: int
"""Maximum number of items to be returned. The default is 50."""
name_filter: Annotated[str, PropertyInfo(alias="nameFilter")]
- """Query by file name"""
+ """
+ Case-sensitive exact match on the asset name. Cannot be combined with
+ namePrefixFilter. When combined with includeAppStore=true, a leading "appstore/"
+ is stripped before querying App Store assets (whose stored names never carry the
+ prefix).
+ """
+
+ name_prefix_filter: Annotated[str, PropertyInfo(alias="namePrefixFilter")]
+ """
+ Case-sensitive prefix match on the asset name. LIKE wildcards ("%", "\\__") in the
+ value are treated as literal characters, not wildcards. Empty string is rejected
+ with 400; omit the parameter if no filtering is desired. Cannot be combined with
+ nameFilter. When combined with includeAppStore=true, a leading "appstore/" is
+ stripped before querying App Store assets (whose stored names never carry the
+ prefix); a partial prefix like "appstor" will not match any App Store assets.
+ """
diff --git a/src/limrun_api/types/gradle_instance.py b/src/limrun_api/types/gradle_instance.py
new file mode 100644
index 0000000..c571266
--- /dev/null
+++ b/src/limrun_api/types/gradle_instance.py
@@ -0,0 +1,66 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from .._models import BaseModel
+
+__all__ = ["GradleInstance", "Metadata", "Spec", "Status"]
+
+
+class Metadata(BaseModel):
+ id: str
+
+ created_at: datetime = FieldInfo(alias="createdAt")
+
+ organization_id: str = FieldInfo(alias="organizationId")
+
+ display_name: Optional[str] = FieldInfo(alias="displayName", default=None)
+
+ labels: Optional[Dict[str, str]] = None
+
+ terminated_at: Optional[datetime] = FieldInfo(alias="terminatedAt", default=None)
+
+
+class Spec(BaseModel):
+ inactivity_timeout: str = FieldInfo(alias="inactivityTimeout")
+
+ region: str
+
+ hard_timeout: Optional[str] = FieldInfo(alias="hardTimeout", default=None)
+
+
+class Status(BaseModel):
+ token: str
+
+ state: Literal["unknown", "creating", "assigned", "ready", "terminated"]
+
+ api_url: Optional[str] = FieldInfo(alias="apiUrl", default=None)
+
+ error_message: Optional[str] = FieldInfo(alias="errorMessage", default=None)
+
+ termination_reason: Optional[str] = FieldInfo(alias="terminationReason", default=None)
+ """Machine-readable reason the instance was terminated.
+
+ Always present once state is "terminated", never present before that. New values
+ may be added over time, so treat any unrecognized value as "Unknown". Known
+ values:
+
+ - "UserRequested": terminated by a delete request to the API.
+ - "InactivityTimeout": the timeout given in spec.inactivityTimeout elapsed.
+ - "HardTimeout": the timeout given in spec.hardTimeout elapsed.
+ - "Unknown": terminated for a cause the platform did not attribute, including
+ instances that failed to get ready during creation. See errorMessage for
+ details when available.
+ """
+
+
+class GradleInstance(BaseModel):
+ metadata: Metadata
+
+ spec: Spec
+
+ status: Status
diff --git a/src/limrun_api/types/gradle_instance_create_params.py b/src/limrun_api/types/gradle_instance_create_params.py
new file mode 100644
index 0000000..1152ed2
--- /dev/null
+++ b/src/limrun_api/types/gradle_instance_create_params.py
@@ -0,0 +1,86 @@
+# 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__ = ["GradleInstanceCreateParams", "Metadata", "Spec", "SpecClue"]
+
+
+class GradleInstanceCreateParams(TypedDict, total=False):
+ reuse_if_exists: Annotated[bool, PropertyInfo(alias="reuseIfExists")]
+ """
+ If there is another instance with given labels and region, return that one
+ instead of creating a new instance.
+ """
+
+ wait: bool
+ """Return after the instance is ready to connect."""
+
+ metadata: Metadata
+
+ spec: Spec
+
+
+class Metadata(TypedDict, total=False):
+ display_name: Annotated[str, PropertyInfo(alias="displayName")]
+
+ labels: Dict[str, str]
+
+
+class SpecClue(TypedDict, total=False):
+ kind: Required[Literal["ClientIP"]]
+
+ client_ip: Annotated[str, PropertyInfo(alias="clientIp")]
+
+
+class Spec(TypedDict, total=False):
+ clues: Iterable[SpecClue]
+
+ hard_timeout: Annotated[str, PropertyInfo(alias="hardTimeout")]
+ """
+ After how many minutes should the instance be terminated. Example values 1m,
+ 10m, 3h. Default is "0" which means no hard timeout.
+ """
+
+ inactivity_timeout: Annotated[str, PropertyInfo(alias="inactivityTimeout")]
+ """
+ After how many minutes of inactivity should the instance be terminated. The
+ timer starts once the instance becomes ready. Example values 1m, 10m, 3h.
+ Default is 5m; a non-positive value falls back to the default.
+ """
+
+ jurisdiction: Literal["us", "eu", "as"]
+ """Restricts scheduling to regions in the given jurisdiction.
+
+ Unlike region, this is a hard constraint: the request never overflows to a
+ region outside the jurisdiction and fails when no region in the jurisdiction has
+ capacity. A region belongs to a jurisdiction when its name starts with the
+ jurisdiction prefix, e.g. "eu-north1" is in "eu". A region preference pointing
+ outside the jurisdiction is ignored.
+ """
+
+ region: str
+ """Where the instance will be created.
+
+ If not given, the region is decided based on scheduling clues (client IP) and
+ availability.
+
+ A region is a preference, not a hard pin: the request always overflows to every
+ other available region, ordered by proximity, when the preferred ones are full.
+
+ Accepted values:
+
+ - A specific region name (e.g. "us-west1"). It is tried first, then the
+ remaining regions in order of proximity to it. Scheduling clues (client IP)
+ are ignored when a region is given.
+ - A region group name (e.g. "us", "eu"). Its member regions are tried first in
+ their listed order, then the remaining regions by proximity to the first
+ member.
+ - A pipe-separated, ordered list of regions (e.g. "us-east1|us-west1"). Those
+ are tried first in the given order, then the remaining regions by proximity to
+ the first.
+ """
diff --git a/src/limrun_api/types/gradle_instance_list_params.py b/src/limrun_api/types/gradle_instance_list_params.py
new file mode 100644
index 0000000..8ce8243
--- /dev/null
+++ b/src/limrun_api/types/gradle_instance_list_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_extensions import Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["GradleInstanceListParams"]
+
+
+class GradleInstanceListParams(TypedDict, total=False):
+ ending_before: Annotated[str, PropertyInfo(alias="endingBefore")]
+
+ label_selector: Annotated[str, PropertyInfo(alias="labelSelector")]
+ """
+ Labels filter to apply to instances to return. Expects a comma-separated list of
+ key=value pairs (e.g., env=prod,region=us-west).
+ """
+
+ limit: int
+ """Maximum number of items to be returned. The default is 50."""
+
+ starting_after: Annotated[str, PropertyInfo(alias="startingAfter")]
+
+ state: str
+ """State filter to apply to Gradle instances to return.
+
+ Each comma-separated state will be used as part of an OR clause, e.g.
+ "assigned,ready" will return all instances that are either assigned or ready.
+
+ Valid states: creating, assigned, ready, terminated, unknown
+ """
diff --git a/src/limrun_api/types/ios_instance.py b/src/limrun_api/types/ios_instance.py
index b46b6b6..077b625 100644
--- a/src/limrun_api/types/ios_instance.py
+++ b/src/limrun_api/types/ios_instance.py
@@ -28,9 +28,9 @@ class Metadata(BaseModel):
class Spec(BaseModel):
inactivity_timeout: str = FieldInfo(alias="inactivityTimeout")
"""
- After how many minutes of inactivity should the instance be terminated. Example
- values 1m, 10m, 3h. Default is 3m. Providing "0" uses the organization's default
- inactivity timeout.
+ After how many minutes of inactivity should the instance be terminated. The
+ timer starts once the instance becomes ready. Example values 1m, 10m, 3h.
+ Default is 3m. Providing "0" uses the organization's default inactivity timeout.
"""
region: str
@@ -69,8 +69,25 @@ class Status(BaseModel):
sandbox: Optional[StatusSandbox] = None
+ signed_stream_url: Optional[str] = FieldInfo(alias="signedStreamUrl", default=None)
+
target_http_port_url_prefix: Optional[str] = FieldInfo(alias="targetHttpPortUrlPrefix", default=None)
+ termination_reason: Optional[str] = FieldInfo(alias="terminationReason", default=None)
+ """Machine-readable reason the instance was terminated.
+
+ Always present once state is "terminated", never present before that. New values
+ may be added over time, so treat any unrecognized value as "Unknown". Known
+ values:
+
+ - "UserRequested": terminated by a delete request to the API.
+ - "InactivityTimeout": the timeout given in spec.inactivityTimeout elapsed.
+ - "HardTimeout": the timeout given in spec.hardTimeout elapsed.
+ - "Unknown": terminated for a cause the platform did not attribute, including
+ instances that failed to get ready during creation. See errorMessage for
+ details when available.
+ """
+
class IosInstance(BaseModel):
metadata: Metadata
diff --git a/src/limrun_api/types/ios_instance_create_params.py b/src/limrun_api/types/ios_instance_create_params.py
index 0782d22..e03dbb0 100644
--- a/src/limrun_api/types/ios_instance_create_params.py
+++ b/src/limrun_api/types/ios_instance_create_params.py
@@ -46,7 +46,7 @@ class SpecClue(TypedDict, total=False):
class SpecInitialAsset(TypedDict, total=False):
- kind: Required[Literal["App"]]
+ kind: Required[Literal["App", "Keychain"]]
source: Required[Literal["URL", "AssetName", "AssetID"]]
@@ -54,13 +54,16 @@ class SpecInitialAsset(TypedDict, total=False):
asset_name: Annotated[str, PropertyInfo(alias="assetName")]
+ encryption_key: Annotated[str, PropertyInfo(alias="encryptionKey")]
+ """
+ Base64/base64url-encoded 32-byte key used to decrypt Keychain assets. Required
+ when kind is Keychain.
+ """
+
launch_mode: Annotated[
Literal["ForegroundIfRunning", "RelaunchIfRunning", "FailIfRunning"], PropertyInfo(alias="launchMode")
]
- """Launch mode specifies how to launch the app after installation.
-
- If not given, the app won't be launched.
- """
+ """Launch mode specifies how to launch the app after installation."""
url: str
@@ -76,6 +79,13 @@ class SpecSandbox(TypedDict, total=False):
class Spec(TypedDict, total=False):
clues: Iterable[SpecClue]
+ force_bundle_id: Annotated[str, PropertyInfo(alias="forceBundleId")]
+ """
+ Keeps this app in the foreground after it is first observed there. This does not
+ launch the app when the simulator starts. Once armed, closing or backgrounding
+ the app causes it to be brought back to the foreground.
+ """
+
hard_timeout: Annotated[str, PropertyInfo(alias="hardTimeout")]
"""
After how many minutes should the instance be terminated. Example values 1m,
@@ -84,20 +94,46 @@ class Spec(TypedDict, total=False):
inactivity_timeout: Annotated[str, PropertyInfo(alias="inactivityTimeout")]
"""
- After how many minutes of inactivity should the instance be terminated. Example
- values 1m, 10m, 3h. Default is 3m. Providing "0" uses the organization's default
- inactivity timeout.
+ After how many minutes of inactivity should the instance be terminated. The
+ timer starts once the instance becomes ready. Example values 1m, 10m, 3h.
+ Default is 3m. Providing "0" uses the organization's default inactivity timeout.
"""
initial_assets: Annotated[Iterable[SpecInitialAsset], PropertyInfo(alias="initialAssets")]
+ jurisdiction: Literal["us", "eu", "as"]
+ """Restricts scheduling to regions in the given jurisdiction.
+
+ Unlike region, this is a hard constraint: the request never overflows to a
+ region outside the jurisdiction and fails when no region in the jurisdiction has
+ capacity. A region belongs to a jurisdiction when its name starts with the
+ jurisdiction prefix, e.g. "eu-north1" is in "eu". A region preference pointing
+ outside the jurisdiction is ignored.
+ """
+
model: Literal["iphone", "ipad", "watch"]
"""The model for the Apple Simulator. Default is iphone."""
region: str
- """The region where the instance will be created.
+ """Where the instance will be created.
+
+ If not given, the region is decided based on scheduling clues (client IP) and
+ availability.
+
+ A region is a preference, not a hard pin: the request always overflows to every
+ other available region, ordered by proximity, when the preferred ones are full.
+
+ Accepted values:
- If not given, will be decided based on scheduling clues and availability.
+ - A specific region name (e.g. "us-west1"). It is tried first, then the
+ remaining regions in order of proximity to it. Scheduling clues (client IP)
+ are ignored when a region is given.
+ - A region group name (e.g. "us", "eu"). Its member regions are tried first in
+ their listed order, then the remaining regions by proximity to the first
+ member.
+ - A pipe-separated, ordered list of regions (e.g. "us-east1|us-west1"). Those
+ are tried first in the given order, then the remaining regions by proximity to
+ the first.
"""
sandbox: SpecSandbox
diff --git a/src/limrun_api/types/scoped_token.py b/src/limrun_api/types/scoped_token.py
new file mode 100644
index 0000000..3e12ae3
--- /dev/null
+++ b/src/limrun_api/types/scoped_token.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+from datetime import datetime
+
+from pydantic import Field as FieldInfo
+
+from .._models import BaseModel
+
+__all__ = ["ScopedToken"]
+
+
+class ScopedToken(BaseModel):
+ token: str
+ """The scoped token, to be sent as a Bearer token or the token query parameter."""
+
+ expires_at: datetime = FieldInfo(alias="expiresAt")
+
+ scopes: List[str]
diff --git a/src/limrun_api/types/scoped_token_create_params.py b/src/limrun_api/types/scoped_token_create_params.py
new file mode 100644
index 0000000..03441ed
--- /dev/null
+++ b/src/limrun_api/types/scoped_token_create_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 .._types import SequenceNotStr
+from .._utils import PropertyInfo
+
+__all__ = ["ScopedTokenCreateParams"]
+
+
+class ScopedTokenCreateParams(TypedDict, total=False):
+ scopes: Required[SequenceNotStr[str]]
+ """
+ Scopes in the form `::`, e.g. `device:*:install`,
+ `asset:asset_01h455vb4pex5vsknk084sn02q:read` or `applerelay:*:connect`.
+ Resource IDs are the customer-visible IDs returned by the API.
+ """
+
+ ttl_seconds: Annotated[int, PropertyInfo(alias="ttlSeconds")]
+ """How long the token stays valid.
+
+ Defaults to 3600 (1 hour), maximum is 14400 (4 hours).
+ """
diff --git a/src/limrun_api/types/xcode_instance.py b/src/limrun_api/types/xcode_instance.py
index b3b58eb..89841ac 100644
--- a/src/limrun_api/types/xcode_instance.py
+++ b/src/limrun_api/types/xcode_instance.py
@@ -42,6 +42,21 @@ class Status(BaseModel):
error_message: Optional[str] = FieldInfo(alias="errorMessage", default=None)
+ termination_reason: Optional[str] = FieldInfo(alias="terminationReason", default=None)
+ """Machine-readable reason the instance was terminated.
+
+ Always present once state is "terminated", never present before that. New values
+ may be added over time, so treat any unrecognized value as "Unknown". Known
+ values:
+
+ - "UserRequested": terminated by a delete request to the API.
+ - "InactivityTimeout": the timeout given in spec.inactivityTimeout elapsed.
+ - "HardTimeout": the timeout given in spec.hardTimeout elapsed.
+ - "Unknown": terminated for a cause the platform did not attribute, including
+ instances that failed to get ready during creation. See errorMessage for
+ details when available.
+ """
+
class XcodeInstance(BaseModel):
metadata: Metadata
diff --git a/src/limrun_api/types/xcode_instance_create_params.py b/src/limrun_api/types/xcode_instance_create_params.py
index 24efb63..67586ac 100644
--- a/src/limrun_api/types/xcode_instance_create_params.py
+++ b/src/limrun_api/types/xcode_instance_create_params.py
@@ -48,13 +48,39 @@ class Spec(TypedDict, total=False):
inactivity_timeout: Annotated[str, PropertyInfo(alias="inactivityTimeout")]
"""
- After how many minutes of inactivity should the instance be terminated. Example
- values 1m, 10m, 3h. Default is 3m. Providing "0" uses the organization's default
- inactivity timeout.
+ After how many minutes of inactivity should the instance be terminated. The
+ timer starts once the instance becomes ready. Example values 1m, 10m, 3h.
+ Default is 5m. Providing "0" uses the organization's default inactivity timeout.
+ """
+
+ jurisdiction: Literal["us", "eu", "as"]
+ """Restricts scheduling to regions in the given jurisdiction.
+
+ Unlike region, this is a hard constraint: the request never overflows to a
+ region outside the jurisdiction and fails when no region in the jurisdiction has
+ capacity. A region belongs to a jurisdiction when its name starts with the
+ jurisdiction prefix, e.g. "eu-north1" is in "eu". A region preference pointing
+ outside the jurisdiction is ignored.
"""
region: str
- """The region where the instance will be created.
+ """Where the instance will be created.
+
+ If not given, the region is decided based on scheduling clues (client IP) and
+ availability.
+
+ A region is a preference, not a hard pin: the request always overflows to every
+ other available region, ordered by proximity, when the preferred ones are full.
+
+ Accepted values:
- If not given, will be decided based on scheduling clues and availability.
+ - A specific region name (e.g. "us-west1"). It is tried first, then the
+ remaining regions in order of proximity to it. Scheduling clues (client IP)
+ are ignored when a region is given.
+ - A region group name (e.g. "us", "eu"). Its member regions are tried first in
+ their listed order, then the remaining regions by proximity to the first
+ member.
+ - A pipe-separated, ordered list of regions (e.g. "us-east1|us-west1"). Those
+ are tried first in the given order, then the remaining regions by proximity to
+ the first.
"""
diff --git a/tests/api_resources/test_analytics.py b/tests/api_resources/test_analytics.py
new file mode 100644
index 0000000..e5789c1
--- /dev/null
+++ b/tests/api_resources/test_analytics.py
@@ -0,0 +1,226 @@
+# 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 limrun_api import Limrun, AsyncLimrun
+from tests.utils import assert_matches_type
+from limrun_api.types import (
+ AnalyticsResponse,
+ AnalyticsInstancesResponse,
+)
+from limrun_api._utils import parse_datetime
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestAnalytics:
+ 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: Limrun) -> None:
+ analytics = client.analytics.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+ assert_matches_type(AnalyticsResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get_with_all_params(self, client: Limrun) -> None:
+ analytics = client.analytics.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ bucket="hour",
+ labels="labels",
+ region="region",
+ timezone="timezone",
+ )
+ assert_matches_type(AnalyticsResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_get(self, client: Limrun) -> None:
+ response = client.analytics.with_raw_response.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ analytics = response.parse()
+ assert_matches_type(AnalyticsResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_get(self, client: Limrun) -> None:
+ with client.analytics.with_streaming_response.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ analytics = response.parse()
+ assert_matches_type(AnalyticsResponse, analytics, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get_instances(self, client: Limrun) -> None:
+ analytics = client.analytics.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get_instances_with_all_params(self, client: Limrun) -> None:
+ analytics = client.analytics.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ labels="labels",
+ region="region",
+ timezone="timezone",
+ )
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_get_instances(self, client: Limrun) -> None:
+ response = client.analytics.with_raw_response.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ analytics = response.parse()
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_get_instances(self, client: Limrun) -> None:
+ with client.analytics.with_streaming_response.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ analytics = response.parse()
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncAnalytics:
+ 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: AsyncLimrun) -> None:
+ analytics = await async_client.analytics.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+ assert_matches_type(AnalyticsResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_get_with_all_params(self, async_client: AsyncLimrun) -> None:
+ analytics = await async_client.analytics.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ bucket="hour",
+ labels="labels",
+ region="region",
+ timezone="timezone",
+ )
+ assert_matches_type(AnalyticsResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncLimrun) -> None:
+ response = await async_client.analytics.with_raw_response.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ analytics = await response.parse()
+ assert_matches_type(AnalyticsResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncLimrun) -> None:
+ async with async_client.analytics.with_streaming_response.get(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ analytics = await response.parse()
+ assert_matches_type(AnalyticsResponse, analytics, 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_instances(self, async_client: AsyncLimrun) -> None:
+ analytics = await async_client.analytics.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_get_instances_with_all_params(self, async_client: AsyncLimrun) -> None:
+ analytics = await async_client.analytics.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ labels="labels",
+ region="region",
+ timezone="timezone",
+ )
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_get_instances(self, async_client: AsyncLimrun) -> None:
+ response = await async_client.analytics.with_raw_response.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ analytics = await response.parse()
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_get_instances(self, async_client: AsyncLimrun) -> None:
+ async with async_client.analytics.with_streaming_response.get_instances(
+ from_=parse_datetime("2019-12-27T18:11:19.117Z"),
+ to=parse_datetime("2019-12-27T18:11:19.117Z"),
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ analytics = await response.parse()
+ assert_matches_type(AnalyticsInstancesResponse, analytics, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_android_instances.py b/tests/api_resources/test_android_instances.py
index 7ca918d..85b866a 100644
--- a/tests/api_resources/test_android_instances.py
+++ b/tests/api_resources/test_android_instances.py
@@ -59,8 +59,14 @@ def test_method_create_with_all_params(self, client: Limrun) -> None:
"urls": ["string"],
}
],
+ "jurisdiction": "us",
"region": "region",
- "sandbox": {"playwright_android": {"enabled": True}},
+ "sandbox": {
+ "playwright_android": {
+ "enabled": True,
+ "version": "1.56.1-lim.1",
+ }
+ },
},
)
assert_matches_type(AndroidInstance, android_instance, path=["response"])
@@ -259,8 +265,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncLimrun) ->
"urls": ["string"],
}
],
+ "jurisdiction": "us",
"region": "region",
- "sandbox": {"playwright_android": {"enabled": True}},
+ "sandbox": {
+ "playwright_android": {
+ "enabled": True,
+ "version": "1.56.1-lim.1",
+ }
+ },
},
)
assert_matches_type(AndroidInstance, android_instance, path=["response"])
diff --git a/tests/api_resources/test_assets.py b/tests/api_resources/test_assets.py
index 67147e9..c8ae0d0 100644
--- a/tests/api_resources/test_assets.py
+++ b/tests/api_resources/test_assets.py
@@ -34,8 +34,10 @@ def test_method_list_with_all_params(self, client: Limrun) -> None:
include_app_store=True,
include_download_url=True,
include_upload_url=True,
+ kind_filter="App",
limit=50,
name_filter="nameFilter",
+ name_prefix_filter="namePrefixFilter",
)
assert_matches_type(AssetListResponse, asset, path=["response"])
@@ -163,6 +165,17 @@ def test_method_get_or_create(self, client: Limrun) -> None:
)
assert_matches_type(AssetGetOrCreateResponse, asset, path=["response"])
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get_or_create_with_all_params(self, client: Limrun) -> None:
+ asset = client.assets.get_or_create(
+ name="name",
+ kind="App",
+ platform="ios",
+ ttl="ttl",
+ )
+ assert_matches_type(AssetGetOrCreateResponse, asset, path=["response"])
+
@pytest.mark.skip(reason="Mock server tests are disabled")
@parametrize
def test_raw_response_get_or_create(self, client: Limrun) -> None:
@@ -208,8 +221,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncLimrun) -> N
include_app_store=True,
include_download_url=True,
include_upload_url=True,
+ kind_filter="App",
limit=50,
name_filter="nameFilter",
+ name_prefix_filter="namePrefixFilter",
)
assert_matches_type(AssetListResponse, asset, path=["response"])
@@ -337,6 +352,17 @@ async def test_method_get_or_create(self, async_client: AsyncLimrun) -> None:
)
assert_matches_type(AssetGetOrCreateResponse, asset, path=["response"])
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_get_or_create_with_all_params(self, async_client: AsyncLimrun) -> None:
+ asset = await async_client.assets.get_or_create(
+ name="name",
+ kind="App",
+ platform="ios",
+ ttl="ttl",
+ )
+ assert_matches_type(AssetGetOrCreateResponse, asset, path=["response"])
+
@pytest.mark.skip(reason="Mock server tests are disabled")
@parametrize
async def test_raw_response_get_or_create(self, async_client: AsyncLimrun) -> None:
diff --git a/tests/api_resources/test_gradle_instances.py b/tests/api_resources/test_gradle_instances.py
new file mode 100644
index 0000000..4df937f
--- /dev/null
+++ b/tests/api_resources/test_gradle_instances.py
@@ -0,0 +1,379 @@
+# 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 limrun_api import Limrun, AsyncLimrun
+from tests.utils import assert_matches_type
+from limrun_api.types import GradleInstance
+from limrun_api.pagination import SyncItems, AsyncItems
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestGradleInstances:
+ 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: Limrun) -> None:
+ gradle_instance = client.gradle_instances.create()
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_create_with_all_params(self, client: Limrun) -> None:
+ gradle_instance = client.gradle_instances.create(
+ reuse_if_exists=True,
+ wait=True,
+ metadata={
+ "display_name": "displayName",
+ "labels": {"foo": "string"},
+ },
+ spec={
+ "clues": [
+ {
+ "kind": "ClientIP",
+ "client_ip": "clientIp",
+ }
+ ],
+ "hard_timeout": "hardTimeout",
+ "inactivity_timeout": "inactivityTimeout",
+ "jurisdiction": "us",
+ "region": "region",
+ },
+ )
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_create(self, client: Limrun) -> None:
+ response = client.gradle_instances.with_raw_response.create()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_create(self, client: Limrun) -> None:
+ with client.gradle_instances.with_streaming_response.create() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, 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: Limrun) -> None:
+ gradle_instance = client.gradle_instances.list()
+ assert_matches_type(SyncItems[GradleInstance], gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_list_with_all_params(self, client: Limrun) -> None:
+ gradle_instance = client.gradle_instances.list(
+ ending_before="endingBefore",
+ label_selector="env=prod,version=1.2",
+ limit=50,
+ starting_after="startingAfter",
+ state="assigned,ready",
+ )
+ assert_matches_type(SyncItems[GradleInstance], gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_list(self, client: Limrun) -> None:
+ response = client.gradle_instances.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = response.parse()
+ assert_matches_type(SyncItems[GradleInstance], gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_list(self, client: Limrun) -> None:
+ with client.gradle_instances.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = response.parse()
+ assert_matches_type(SyncItems[GradleInstance], gradle_instance, 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: Limrun) -> None:
+ gradle_instance = client.gradle_instances.delete(
+ "id",
+ )
+ assert gradle_instance is None
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_delete(self, client: Limrun) -> None:
+ response = client.gradle_instances.with_raw_response.delete(
+ "id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = response.parse()
+ assert gradle_instance is None
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_delete(self, client: Limrun) -> None:
+ with client.gradle_instances.with_streaming_response.delete(
+ "id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = response.parse()
+ assert gradle_instance 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: Limrun) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
+ client.gradle_instances.with_raw_response.delete(
+ "",
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get(self, client: Limrun) -> None:
+ gradle_instance = client.gradle_instances.get(
+ "id",
+ )
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_get(self, client: Limrun) -> None:
+ response = client.gradle_instances.with_raw_response.get(
+ "id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_get(self, client: Limrun) -> None:
+ with client.gradle_instances.with_streaming_response.get(
+ "id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, 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: Limrun) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
+ client.gradle_instances.with_raw_response.get(
+ "",
+ )
+
+
+class TestAsyncGradleInstances:
+ 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: AsyncLimrun) -> None:
+ gradle_instance = await async_client.gradle_instances.create()
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncLimrun) -> None:
+ gradle_instance = await async_client.gradle_instances.create(
+ reuse_if_exists=True,
+ wait=True,
+ metadata={
+ "display_name": "displayName",
+ "labels": {"foo": "string"},
+ },
+ spec={
+ "clues": [
+ {
+ "kind": "ClientIP",
+ "client_ip": "clientIp",
+ }
+ ],
+ "hard_timeout": "hardTimeout",
+ "inactivity_timeout": "inactivityTimeout",
+ "jurisdiction": "us",
+ "region": "region",
+ },
+ )
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncLimrun) -> None:
+ response = await async_client.gradle_instances.with_raw_response.create()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = await response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncLimrun) -> None:
+ async with async_client.gradle_instances.with_streaming_response.create() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = await response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, 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: AsyncLimrun) -> None:
+ gradle_instance = await async_client.gradle_instances.list()
+ assert_matches_type(AsyncItems[GradleInstance], gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncLimrun) -> None:
+ gradle_instance = await async_client.gradle_instances.list(
+ ending_before="endingBefore",
+ label_selector="env=prod,version=1.2",
+ limit=50,
+ starting_after="startingAfter",
+ state="assigned,ready",
+ )
+ assert_matches_type(AsyncItems[GradleInstance], gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncLimrun) -> None:
+ response = await async_client.gradle_instances.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = await response.parse()
+ assert_matches_type(AsyncItems[GradleInstance], gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncLimrun) -> None:
+ async with async_client.gradle_instances.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = await response.parse()
+ assert_matches_type(AsyncItems[GradleInstance], gradle_instance, 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: AsyncLimrun) -> None:
+ gradle_instance = await async_client.gradle_instances.delete(
+ "id",
+ )
+ assert gradle_instance is None
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncLimrun) -> None:
+ response = await async_client.gradle_instances.with_raw_response.delete(
+ "id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = await response.parse()
+ assert gradle_instance is None
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncLimrun) -> None:
+ async with async_client.gradle_instances.with_streaming_response.delete(
+ "id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = await response.parse()
+ assert gradle_instance 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: AsyncLimrun) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
+ await async_client.gradle_instances.with_raw_response.delete(
+ "",
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_get(self, async_client: AsyncLimrun) -> None:
+ gradle_instance = await async_client.gradle_instances.get(
+ "id",
+ )
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncLimrun) -> None:
+ response = await async_client.gradle_instances.with_raw_response.get(
+ "id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ gradle_instance = await response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncLimrun) -> None:
+ async with async_client.gradle_instances.with_streaming_response.get(
+ "id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ gradle_instance = await response.parse()
+ assert_matches_type(GradleInstance, gradle_instance, 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: AsyncLimrun) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
+ await async_client.gradle_instances.with_raw_response.get(
+ "",
+ )
diff --git a/tests/api_resources/test_ios_instances.py b/tests/api_resources/test_ios_instances.py
index 6c19d06..8575bcb 100644
--- a/tests/api_resources/test_ios_instances.py
+++ b/tests/api_resources/test_ios_instances.py
@@ -41,6 +41,7 @@ def test_method_create_with_all_params(self, client: Limrun) -> None:
"client_ip": "clientIp",
}
],
+ "force_bundle_id": "x",
"hard_timeout": "hardTimeout",
"inactivity_timeout": "inactivityTimeout",
"initial_assets": [
@@ -49,10 +50,12 @@ def test_method_create_with_all_params(self, client: Limrun) -> None:
"source": "URL",
"asset_id": "assetId",
"asset_name": "assetName",
+ "encryption_key": "encryptionKey",
"launch_mode": "ForegroundIfRunning",
"url": "url",
}
],
+ "jurisdiction": "us",
"model": "iphone",
"region": "region",
"sandbox": {"xcode": {"enabled": True}},
@@ -236,6 +239,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLimrun) ->
"client_ip": "clientIp",
}
],
+ "force_bundle_id": "x",
"hard_timeout": "hardTimeout",
"inactivity_timeout": "inactivityTimeout",
"initial_assets": [
@@ -244,10 +248,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncLimrun) ->
"source": "URL",
"asset_id": "assetId",
"asset_name": "assetName",
+ "encryption_key": "encryptionKey",
"launch_mode": "ForegroundIfRunning",
"url": "url",
}
],
+ "jurisdiction": "us",
"model": "iphone",
"region": "region",
"sandbox": {"xcode": {"enabled": True}},
diff --git a/tests/api_resources/test_scoped_tokens.py b/tests/api_resources/test_scoped_tokens.py
new file mode 100644
index 0000000..15bfc15
--- /dev/null
+++ b/tests/api_resources/test_scoped_tokens.py
@@ -0,0 +1,110 @@
+# 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 limrun_api import Limrun, AsyncLimrun
+from tests.utils import assert_matches_type
+from limrun_api.types import ScopedToken
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestScopedTokens:
+ 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: Limrun) -> None:
+ scoped_token = client.scoped_tokens.create(
+ scopes=["string"],
+ )
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_create_with_all_params(self, client: Limrun) -> None:
+ scoped_token = client.scoped_tokens.create(
+ scopes=["string"],
+ ttl_seconds=1,
+ )
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_create(self, client: Limrun) -> None:
+ response = client.scoped_tokens.with_raw_response.create(
+ scopes=["string"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ scoped_token = response.parse()
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_create(self, client: Limrun) -> None:
+ with client.scoped_tokens.with_streaming_response.create(
+ scopes=["string"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ scoped_token = response.parse()
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncScopedTokens:
+ 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: AsyncLimrun) -> None:
+ scoped_token = await async_client.scoped_tokens.create(
+ scopes=["string"],
+ )
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncLimrun) -> None:
+ scoped_token = await async_client.scoped_tokens.create(
+ scopes=["string"],
+ ttl_seconds=1,
+ )
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncLimrun) -> None:
+ response = await async_client.scoped_tokens.with_raw_response.create(
+ scopes=["string"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ scoped_token = await response.parse()
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncLimrun) -> None:
+ async with async_client.scoped_tokens.with_streaming_response.create(
+ scopes=["string"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ scoped_token = await response.parse()
+ assert_matches_type(ScopedToken, scoped_token, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_xcode_instances.py b/tests/api_resources/test_xcode_instances.py
index e3ea382..00c3db5 100644
--- a/tests/api_resources/test_xcode_instances.py
+++ b/tests/api_resources/test_xcode_instances.py
@@ -43,6 +43,7 @@ def test_method_create_with_all_params(self, client: Limrun) -> None:
],
"hard_timeout": "hardTimeout",
"inactivity_timeout": "inactivityTimeout",
+ "jurisdiction": "us",
"region": "region",
},
)
@@ -225,6 +226,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLimrun) ->
],
"hard_timeout": "hardTimeout",
"inactivity_timeout": "inactivityTimeout",
+ "jurisdiction": "us",
"region": "region",
},
)
diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py
deleted file mode 100644
index bf4003c..0000000
--- a/tests/test_deepcopy.py
+++ /dev/null
@@ -1,58 +0,0 @@
-from limrun_api._utils import deepcopy_minimal
-
-
-def assert_different_identities(obj1: object, obj2: object) -> None:
- assert obj1 == obj2
- assert id(obj1) != id(obj2)
-
-
-def test_simple_dict() -> None:
- obj1 = {"foo": "bar"}
- obj2 = deepcopy_minimal(obj1)
- assert_different_identities(obj1, obj2)
-
-
-def test_nested_dict() -> None:
- obj1 = {"foo": {"bar": True}}
- obj2 = deepcopy_minimal(obj1)
- assert_different_identities(obj1, obj2)
- assert_different_identities(obj1["foo"], obj2["foo"])
-
-
-def test_complex_nested_dict() -> None:
- obj1 = {"foo": {"bar": [{"hello": "world"}]}}
- obj2 = deepcopy_minimal(obj1)
- assert_different_identities(obj1, obj2)
- assert_different_identities(obj1["foo"], obj2["foo"])
- assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"])
- assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0])
-
-
-def test_simple_list() -> None:
- obj1 = ["a", "b", "c"]
- obj2 = deepcopy_minimal(obj1)
- assert_different_identities(obj1, obj2)
-
-
-def test_nested_list() -> None:
- obj1 = ["a", [1, 2, 3]]
- obj2 = deepcopy_minimal(obj1)
- assert_different_identities(obj1, obj2)
- assert_different_identities(obj1[1], obj2[1])
-
-
-class MyObject: ...
-
-
-def test_ignores_other_types() -> None:
- # custom classes
- my_obj = MyObject()
- obj1 = {"foo": my_obj}
- obj2 = deepcopy_minimal(obj1)
- assert_different_identities(obj1, obj2)
- assert obj1["foo"] is my_obj
-
- # tuples
- obj3 = ("a", "b")
- obj4 = deepcopy_minimal(obj3)
- assert obj3 is obj4
diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py
index 6c7fa44..8e637bb 100644
--- a/tests/test_extract_files.py
+++ b/tests/test_extract_files.py
@@ -4,7 +4,7 @@
import pytest
-from limrun_api._types import FileTypes
+from limrun_api._types import FileTypes, ArrayFormat
from limrun_api._utils import extract_files
@@ -37,10 +37,7 @@ def test_multiple_files() -> None:
def test_top_level_file_array() -> None:
query = {"files": [b"file one", b"file two"], "title": "hello"}
- assert extract_files(query, paths=[["files", ""]]) == [
- ("files[]", b"file one"),
- ("files[]", b"file two"),
- ]
+ assert extract_files(query, paths=[["files", ""]]) == [("files[]", b"file one"), ("files[]", b"file two")]
assert query == {"title": "hello"}
@@ -71,3 +68,24 @@ def test_ignores_incorrect_paths(
expected: list[tuple[str, FileTypes]],
) -> None:
assert extract_files(query, paths=paths) == expected
+
+
+@pytest.mark.parametrize(
+ "array_format,expected_top_level,expected_nested",
+ [
+ ("brackets", [("files[]", b"a"), ("files[]", b"b")], [("items[][file]", b"a"), ("items[][file]", b"b")]),
+ ("repeat", [("files", b"a"), ("files", b"b")], [("items[file]", b"a"), ("items[file]", b"b")]),
+ ("comma", [("files", b"a"), ("files", b"b")], [("items[file]", b"a"), ("items[file]", b"b")]),
+ ("indices", [("files[0]", b"a"), ("files[1]", b"b")], [("items[0][file]", b"a"), ("items[1][file]", b"b")]),
+ ],
+)
+def test_array_format_controls_file_field_names(
+ array_format: ArrayFormat,
+ expected_top_level: list[tuple[str, FileTypes]],
+ expected_nested: list[tuple[str, FileTypes]],
+) -> None:
+ top_level = {"files": [b"a", b"b"]}
+ assert extract_files(top_level, paths=[["files", ""]], array_format=array_format) == expected_top_level
+
+ nested = {"items": [{"file": b"a"}, {"file": b"b"}]}
+ assert extract_files(nested, paths=[["items", "", "file"]], array_format=array_format) == expected_nested
diff --git a/tests/test_files.py b/tests/test_files.py
index f0f1f8f..30f5a21 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -4,7 +4,8 @@
import pytest
from dirty_equals import IsDict, IsList, IsBytes, IsTuple
-from limrun_api._files import to_httpx_files, async_to_httpx_files
+from limrun_api._files import to_httpx_files, deepcopy_with_paths, async_to_httpx_files
+from limrun_api._utils import extract_files
readme_path = Path(__file__).parent.parent.joinpath("README.md")
@@ -49,3 +50,99 @@ def test_string_not_allowed() -> None:
"file": "foo", # type: ignore
}
)
+
+
+def assert_different_identities(obj1: object, obj2: object) -> None:
+ assert obj1 == obj2
+ assert obj1 is not obj2
+
+
+class TestDeepcopyWithPaths:
+ def test_copies_top_level_dict(self) -> None:
+ original = {"file": b"data", "other": "value"}
+ result = deepcopy_with_paths(original, [["file"]])
+ assert_different_identities(result, original)
+
+ def test_file_value_is_same_reference(self) -> None:
+ file_bytes = b"contents"
+ original = {"file": file_bytes}
+ result = deepcopy_with_paths(original, [["file"]])
+ assert_different_identities(result, original)
+ assert result["file"] is file_bytes
+
+ def test_list_popped_wholesale(self) -> None:
+ files = [b"f1", b"f2"]
+ original = {"files": files, "title": "t"}
+ result = deepcopy_with_paths(original, [["files", ""]])
+ assert_different_identities(result, original)
+ result_files = result["files"]
+ assert isinstance(result_files, list)
+ assert_different_identities(result_files, files)
+
+ def test_nested_array_path_copies_list_and_elements(self) -> None:
+ elem1 = {"file": b"f1", "extra": 1}
+ elem2 = {"file": b"f2", "extra": 2}
+ original = {"items": [elem1, elem2]}
+ result = deepcopy_with_paths(original, [["items", "", "file"]])
+ assert_different_identities(result, original)
+ result_items = result["items"]
+ assert isinstance(result_items, list)
+ assert_different_identities(result_items, original["items"])
+ assert_different_identities(result_items[0], elem1)
+ assert_different_identities(result_items[1], elem2)
+
+ def test_empty_paths_returns_same_object(self) -> None:
+ original = {"foo": "bar"}
+ result = deepcopy_with_paths(original, [])
+ assert result is original
+
+ def test_multiple_paths(self) -> None:
+ f1 = b"file1"
+ f2 = b"file2"
+ original = {"a": f1, "b": f2, "c": "unchanged"}
+ result = deepcopy_with_paths(original, [["a"], ["b"]])
+ assert_different_identities(result, original)
+ assert result["a"] is f1
+ assert result["b"] is f2
+ assert result["c"] is original["c"]
+
+ def test_extract_files_does_not_mutate_original_top_level(self) -> None:
+ file_bytes = b"contents"
+ original = {"file": file_bytes, "other": "value"}
+
+ copied = deepcopy_with_paths(original, [["file"]])
+ extracted = extract_files(copied, paths=[["file"]])
+
+ assert extracted == [("file", file_bytes)]
+ assert original == {"file": file_bytes, "other": "value"}
+ assert copied == {"other": "value"}
+
+ def test_extract_files_does_not_mutate_original_nested_array_path(self) -> None:
+ file1 = b"f1"
+ file2 = b"f2"
+ original = {
+ "items": [
+ {"file": file1, "extra": 1},
+ {"file": file2, "extra": 2},
+ ],
+ "title": "example",
+ }
+
+ copied = deepcopy_with_paths(original, [["items", "", "file"]])
+ extracted = extract_files(copied, paths=[["items", "", "file"]])
+
+ assert [entry for _, entry in extracted] == [file1, file2]
+ assert original == {
+ "items": [
+ {"file": file1, "extra": 1},
+ {"file": file2, "extra": 2},
+ ],
+ "title": "example",
+ }
+ assert copied == {
+ "items": [
+ {"extra": 1},
+ {"extra": 2},
+ ],
+ "title": "example",
+ }
diff --git a/tests/test_models.py b/tests/test_models.py
index 3581258..b7bd334 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -1,7 +1,8 @@
import json
-from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast
+from typing import TYPE_CHECKING, Any, Dict, List, Union, Iterable, Optional, cast
from datetime import datetime, timezone
-from typing_extensions import Literal, Annotated, TypeAliasType
+from collections import deque
+from typing_extensions import Literal, Annotated, TypedDict, TypeAliasType
import pytest
import pydantic
@@ -9,7 +10,7 @@
from limrun_api._utils import PropertyInfo
from limrun_api._compat import PYDANTIC_V1, parse_obj, model_dump, model_json
-from limrun_api._models import DISCRIMINATOR_CACHE, BaseModel, construct_type
+from limrun_api._models import DISCRIMINATOR_CACHE, BaseModel, EagerIterable, construct_type
class BasicModel(BaseModel):
@@ -961,3 +962,56 @@ def __getattr__(self, attr: str) -> Item: ...
assert model.a.prop == 1
assert isinstance(model.a, Item)
assert model.other == "foo"
+
+
+# NOTE: Workaround for Pydantic Iterable behavior.
+# Iterable fields are replaced with a ValidatorIterator and may be consumed
+# during serialization, which can cause subsequent dumps to return empty data.
+# See: https://github.com/pydantic/pydantic/issues/9541
+@pytest.mark.parametrize(
+ "data, expected_validated",
+ [
+ ([1, 2, 3], [1, 2, 3]),
+ ((1, 2, 3), (1, 2, 3)),
+ (set([1, 2, 3]), set([1, 2, 3])),
+ (iter([1, 2, 3]), [1, 2, 3]),
+ ([], []),
+ ((x for x in [1, 2, 3]), [1, 2, 3]),
+ (map(lambda x: x, [1, 2, 3]), [1, 2, 3]),
+ (frozenset([1, 2, 3]), frozenset([1, 2, 3])),
+ (deque([1, 2, 3]), deque([1, 2, 3])),
+ ],
+ ids=["list", "tuple", "set", "iterator", "empty", "generator", "map", "frozenset", "deque"],
+)
+@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2")
+def test_iterable_construction(data: Iterable[int], expected_validated: Iterable[int]) -> None:
+ class TypeWithIterable(TypedDict):
+ items: EagerIterable[int]
+
+ class Model(BaseModel):
+ data: TypeWithIterable
+
+ m = Model.model_validate({"data": {"items": data}})
+ assert m.data["items"] == expected_validated
+
+ # Verify repeated dumps don't lose data (the original bug)
+ assert m.model_dump()["data"]["items"] == list(expected_validated)
+ assert m.model_dump()["data"]["items"] == list(expected_validated)
+
+
+@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2")
+def test_iterable_construction_str_falls_back_to_list() -> None:
+ # str is iterable (over chars), but str(list_of_chars) produces the list's repr
+ # rather than reconstructing a string from items. We special-case str to fall
+ # back to list instead of attempting reconstruction.
+ class TypeWithIterable(TypedDict):
+ items: EagerIterable[str]
+
+ class Model(BaseModel):
+ data: TypeWithIterable
+
+ m = Model.model_validate({"data": {"items": "hello"}})
+
+ # falls back to list of chars rather than calling str(["h", "e", "l", "l", "o"])
+ assert m.data["items"] == ["h", "e", "l", "l", "o"]
+ assert m.model_dump()["data"]["items"] == ["h", "e", "l", "l", "o"]