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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 240
configured_endpoints: 258
68 changes: 62 additions & 6 deletions api.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/mobilerun_sdk/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self._idempotency_header = "Idempotency-Key"

@cached_property
def apps(self) -> AppsResource:
from .resources.apps import AppsResource
Expand Down Expand Up @@ -449,6 +451,8 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self._idempotency_header = "Idempotency-Key"

@cached_property
def apps(self) -> AsyncAppsResource:
from .resources.apps import AsyncAppsResource
Expand Down
11 changes: 6 additions & 5 deletions src/mobilerun_sdk/resources/app_events/app_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from __future__ import annotations

from typing import Optional
from typing import Union
from datetime import datetime
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -96,11 +97,11 @@ def list(
*,
device_id: str | Omit = omit,
event_type: str | Omit = omit,
from_: Optional[str] | Omit = omit,
from_: Union[str, datetime, None] | Omit = omit,
page: int | Omit = omit,
page_size: int | Omit = omit,
source: Literal["app", "system", "device", "webhook"] | Omit = omit,
to: Optional[str] | Omit = omit,
to: Union[str, datetime, None] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -210,11 +211,11 @@ async def list(
*,
device_id: str | Omit = omit,
event_type: str | Omit = omit,
from_: Optional[str] | Omit = omit,
from_: Union[str, datetime, None] | Omit = omit,
page: int | Omit = omit,
page_size: int | Omit = omit,
source: Literal["app", "system", "device", "webhook"] | Omit = omit,
to: Optional[str] | Omit = omit,
to: Union[str, datetime, None] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down
86 changes: 74 additions & 12 deletions src/mobilerun_sdk/resources/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppDeleteResponse:
"""Deletes an uploaded app by ID.

Expand All @@ -160,13 +161,19 @@ def delete(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._delete(
path_template("/apps/{id}", id=id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppDeleteResponse,
)
Expand All @@ -181,6 +188,7 @@ def confirm_upload(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppConfirmUploadResponse:
"""
Verifies the uploaded files in R2 and sets the app version status to available.
Expand All @@ -195,13 +203,19 @@ def confirm_upload(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
path_template("/apps/{id}/confirm-upload", id=id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppConfirmUploadResponse,
)
Expand All @@ -226,6 +240,7 @@ def create_signed_upload_url(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppCreateSignedUploadURLResponse:
"""
Creates or updates an app and returns pre-signed Cloudflare R2 upload URLs for
Expand All @@ -241,6 +256,8 @@ def create_signed_upload_url(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
return self._post(
"/apps/create-signed-upload-url",
Expand All @@ -261,7 +278,11 @@ def create_signed_upload_url(
app_create_signed_upload_url_params.AppCreateSignedUploadURLParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppCreateSignedUploadURLResponse,
)
Expand Down Expand Up @@ -310,6 +331,7 @@ def mark_failed(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppMarkFailedResponse:
"""
Sets the app status to failed.
Expand All @@ -322,13 +344,19 @@ def mark_failed(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
path_template("/apps/{id}/mark-failed", id=id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppMarkFailedResponse,
)
Expand All @@ -344,8 +372,11 @@ def storage_usage(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AppStorageUsageResponse:
"""
Returns the user’s total storage quota, bytes used, and remaining bytes — the
reliable maximum size for the next upload.
Returns the user’s storage allowance from Autumn storage_mb (decimal bytes):
bytes used, bytes included in the plan, the hard maximum (included + max
purchasable overage; null = unlimited) and whether usage above the included
amount is billed as overage. With storage billing off there is no limit: only
usedBytes is set.
"""
return self._get(
"/apps/storage-usage",
Expand Down Expand Up @@ -471,6 +502,7 @@ async def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppDeleteResponse:
"""Deletes an uploaded app by ID.

Expand All @@ -485,13 +517,19 @@ async def delete(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._delete(
path_template("/apps/{id}", id=id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppDeleteResponse,
)
Expand All @@ -506,6 +544,7 @@ async def confirm_upload(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppConfirmUploadResponse:
"""
Verifies the uploaded files in R2 and sets the app version status to available.
Expand All @@ -520,13 +559,19 @@ async def confirm_upload(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
path_template("/apps/{id}/confirm-upload", id=id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppConfirmUploadResponse,
)
Expand All @@ -551,6 +596,7 @@ async def create_signed_upload_url(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppCreateSignedUploadURLResponse:
"""
Creates or updates an app and returns pre-signed Cloudflare R2 upload URLs for
Expand All @@ -566,6 +612,8 @@ async def create_signed_upload_url(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
return await self._post(
"/apps/create-signed-upload-url",
Expand All @@ -586,7 +634,11 @@ async def create_signed_upload_url(
app_create_signed_upload_url_params.AppCreateSignedUploadURLParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppCreateSignedUploadURLResponse,
)
Expand Down Expand Up @@ -635,6 +687,7 @@ async def mark_failed(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> AppMarkFailedResponse:
"""
Sets the app status to failed.
Expand All @@ -647,13 +700,19 @@ async def mark_failed(
extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
path_template("/apps/{id}/mark-failed", id=id),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=AppMarkFailedResponse,
)
Expand All @@ -669,8 +728,11 @@ async def storage_usage(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AppStorageUsageResponse:
"""
Returns the user’s total storage quota, bytes used, and remaining bytes — the
reliable maximum size for the next upload.
Returns the user’s storage allowance from Autumn storage_mb (decimal bytes):
bytes used, bytes included in the plan, the hard maximum (included + max
purchasable overage; null = unlimited) and whether usage above the included
amount is billed as overage. With storage billing off there is no limit: only
usedBytes is set.
"""
return await self._get(
"/apps/storage-usage",
Expand Down
Loading
Loading