From 78424e24ad4e1f336f843222ff19bf70a50f073f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 9 May 2026 03:18:46 +0000 Subject: [PATCH 01/11] fix(client): add missing f-string prefix in file type error message --- src/beeper_desktop_api/_files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beeper_desktop_api/_files.py b/src/beeper_desktop_api/_files.py index 8a371d3..be8e0e1 100644 --- a/src/beeper_desktop_api/_files.py +++ b/src/beeper_desktop_api/_files.py @@ -99,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 From 1850c8a7b7d3e45407524a6ebffe902d4a3f8a71 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 03:10:14 +0000 Subject: [PATCH 02/11] feat(internal/types): support eagerly validating pydantic iterators --- src/beeper_desktop_api/_models.py | 80 +++++++++++++++++++++++++++++++ tests/test_models.py | 60 +++++++++++++++++++++-- 2 files changed, 137 insertions(+), 3 deletions(-) diff --git a/src/beeper_desktop_api/_models.py b/src/beeper_desktop_api/_models.py index e22dd2a..69f41a6 100644 --- a/src/beeper_desktop_api/_models.py +++ b/src/beeper_desktop_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/tests/test_models.py b/tests/test_models.py index e71da85..d228ea1 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 beeper_desktop_api._utils import PropertyInfo from beeper_desktop_api._compat import PYDANTIC_V1, parse_obj, model_dump, model_json -from beeper_desktop_api._models import DISCRIMINATOR_CACHE, BaseModel, construct_type +from beeper_desktop_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"] From f854e6005ea8d976339d1dbf1d1d322cf4ae1d5a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 02:40:34 +0000 Subject: [PATCH 03/11] ci: pin GitHub Actions to commit SHAs Pin all GitHub Actions referenced in generated workflows (both first-party `actions/*` and third-party) to immutable commit SHAs. Updating pinned actions is now a deliberate codegen-side bump rather than implicit on every workflow run. --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ca0ca2..ed91b37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/beeper-desktop-api-python' && '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: | @@ -46,7 +46,7 @@ jobs: id-token: write runs-on: ${{ github.repository == 'stainless-sdks/beeper-desktop-api-python' && '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/beeper-desktop-api-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()); @@ -87,7 +87,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/beeper-desktop-api-python' && '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 54361b5..4954ee6 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 2d24407..0fe0ce0 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'beeper/desktop-api-python' && (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: | From bbcc16a66371c27210a84f00299cbac092ceed2b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 11:33:09 +0000 Subject: [PATCH 04/11] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2dd3fee..b85c157 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-c08c14bb754b4cb0e02b21fabb680469368286be339dec0aaa8c69d04a1f021a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-371238be116b1748e82f213ba35b85b0cd574f24e9d9815f73bc743478f23c99.yml openapi_spec_hash: a10246aaf7cdc33b682fc245bd5f893b -config_hash: 72f9d43b9b51a5da912e9f3730e53ae2 +config_hash: 9a5611f899a0fe46abb2a1e463e0ee60 From 1d8fdca1a4c3e642d1585260bf963855cfd1df13 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 16 May 2026 19:56:50 +0000 Subject: [PATCH 05/11] Update Desktop API SDKs --- .stats.yml | 8 +- README.md | 13 +- api.md | 277 ++++- src/beeper_desktop_api/_client.py | 131 ++- src/beeper_desktop_api/resources/__init__.py | 42 + .../resources/app/__init__.py | 47 + src/beeper_desktop_api/resources/app/app.py | 223 ++++ .../resources/app/e2ee/__init__.py | 47 + .../resources/app/e2ee/e2ee.py | 150 +++ .../app/e2ee/recovery_code/__init__.py | 33 + .../app/e2ee/recovery_code/recovery_code.py | 264 +++++ .../resources/app/e2ee/recovery_code/reset.py | 252 +++++ .../app/e2ee/verification/__init__.py | 47 + .../resources/app/e2ee/verification/qr.py | 258 +++++ .../resources/app/e2ee/verification/sas.py | 255 +++++ .../app/e2ee/verification/verification.py | 439 ++++++++ src/beeper_desktop_api/resources/app/login.py | 508 ++++++++++ src/beeper_desktop_api/resources/bridges.py | 145 +++ .../resources/matrix/__init__.py | 61 ++ .../resources/matrix/bridges/__init__.py | 89 ++ .../resources/matrix/bridges/auth.py | 951 ++++++++++++++++++ .../resources/matrix/bridges/bridges.py | 264 +++++ .../resources/matrix/bridges/capabilities.py | 174 ++++ .../resources/matrix/bridges/contacts.py | 189 ++++ .../resources/matrix/bridges/rooms.py | 386 +++++++ .../resources/matrix/bridges/users.py | 304 ++++++ .../resources/matrix/matrix.py | 176 ++++ .../resources/matrix/rooms/__init__.py | 61 ++ .../resources/matrix/rooms/account_data.py | 302 ++++++ .../resources/matrix/rooms/events.py | 174 ++++ .../resources/matrix/rooms/rooms.py | 845 ++++++++++++++++ .../resources/matrix/rooms/state.py | 294 ++++++ .../resources/matrix/users/__init__.py | 33 + .../resources/matrix/users/account_data.py | 270 +++++ .../resources/matrix/users/users.py | 196 ++++ src/beeper_desktop_api/types/__init__.py | 12 +- src/beeper_desktop_api/types/app/__init__.py | 10 + .../types/app/e2ee/__init__.py | 12 + .../types/app/e2ee/recovery_code/__init__.py | 8 + .../recovery_code/reset_confirm_params.py | 14 + .../recovery_code/reset_confirm_response.py | 170 ++++ .../e2ee/recovery_code/reset_create_params.py | 14 + .../recovery_code/reset_create_response.py | 173 ++++ .../recovery_code_mark_backed_up_response.py | 170 ++++ .../app/e2ee/recovery_code_verify_params.py | 14 + .../app/e2ee/recovery_code_verify_response.py | 170 ++++ .../types/app/e2ee/verification/__init__.py | 9 + .../qr_confirm_scanned_response.py | 170 ++++ .../app/e2ee/verification/qr_scan_params.py | 12 + .../app/e2ee/verification/qr_scan_response.py | 170 ++++ .../e2ee/verification/sa_confirm_response.py | 170 ++++ .../e2ee/verification/sa_start_response.py | 170 ++++ .../app/e2ee/verification_accept_response.py | 170 ++++ .../app/e2ee/verification_cancel_params.py | 15 + .../app/e2ee/verification_cancel_response.py | 170 ++++ .../app/e2ee/verification_create_params.py | 14 + .../app/e2ee/verification_create_response.py | 173 ++++ .../types/app/login_email_params.py | 15 + .../types/app/login_register_params.py | 26 + .../types/app/login_register_response.py | 207 ++++ .../types/app/login_response_params.py | 15 + .../types/app/login_response_response.py | 246 +++++ .../types/app/login_start_response.py | 15 + .../types/app_status_response.py | 154 +++ .../types/bridge_availability.py | 63 ++ .../types/bridge_list_response.py | 14 + .../types/matrix/__init__.py | 10 + .../types/matrix/bridges/__init__.py | 25 + .../bridges/auth_list_flows_response.py | 27 + .../bridges/auth_list_logins_response.py | 11 + .../matrix/bridges/auth_start_login_params.py | 20 + .../bridges/auth_start_login_response.py | 278 +++++ .../bridges/auth_submit_cookies_params.py | 18 + .../bridges/auth_submit_cookies_response.py | 278 +++++ .../bridges/auth_submit_user_input_params.py | 18 + .../auth_submit_user_input_response.py | 278 +++++ .../bridges/auth_wait_for_step_response.py | 278 +++++ .../matrix/bridges/auth_whoami_response.py | 128 +++ .../bridges/capability_retrieve_response.py | 8 + .../matrix/bridges/contact_list_params.py | 12 + .../matrix/bridges/contact_list_response.py | 33 + .../matrix/bridges/room_create_dm_params.py | 16 + .../matrix/bridges/room_create_dm_response.py | 29 + .../bridges/room_create_group_params.py | 72 ++ .../bridges/room_create_group_response.py | 15 + .../matrix/bridges/user_resolve_params.py | 16 + .../matrix/bridges/user_resolve_response.py | 29 + .../matrix/bridges/user_search_params.py | 15 + .../matrix/bridges/user_search_response.py | 33 + .../types/matrix/room_create_params.py | 157 +++ .../types/matrix/room_create_response.py | 12 + .../types/matrix/room_join_params.py | 49 + .../types/matrix/room_join_response.py | 10 + .../types/matrix/room_leave_params.py | 15 + .../types/matrix/rooms/__init__.py | 9 + .../rooms/account_data_update_params.py | 17 + .../matrix/rooms/event_retrieve_response.py | 94 ++ .../types/matrix/rooms/state_list_response.py | 98 ++ .../matrix/rooms/state_retrieve_params.py | 23 + .../matrix/rooms/state_retrieve_response.py | 8 + .../matrix/user_retrieve_profile_response.py | 32 + .../types/matrix/users/__init__.py | 5 + .../users/account_data_update_params.py | 15 + .../types/shared/__init__.py | 1 + .../types/shared/app_state_snapshot.py | 154 +++ tests/api_resources/app/__init__.py | 1 + tests/api_resources/app/e2ee/__init__.py | 1 + .../app/e2ee/recovery_code/__init__.py | 1 + .../app/e2ee/recovery_code/test_reset.py | 153 +++ .../app/e2ee/test_recovery_code.py | 139 +++ .../app/e2ee/test_verification.py | 262 +++++ .../app/e2ee/verification/__init__.py | 1 + .../app/e2ee/verification/test_qr.py | 162 +++ .../app/e2ee/verification/test_sas.py | 176 ++++ tests/api_resources/app/test_login.py | 294 ++++++ tests/api_resources/matrix/__init__.py | 1 + .../api_resources/matrix/bridges/__init__.py | 1 + .../api_resources/matrix/bridges/test_auth.py | 854 ++++++++++++++++ .../matrix/bridges/test_capabilities.py | 100 ++ .../matrix/bridges/test_contacts.py | 116 +++ .../matrix/bridges/test_rooms.py | 279 +++++ .../matrix/bridges/test_users.py | 235 +++++ tests/api_resources/matrix/rooms/__init__.py | 1 + .../matrix/rooms/test_account_data.py | 275 +++++ .../api_resources/matrix/rooms/test_events.py | 120 +++ .../api_resources/matrix/rooms/test_state.py | 240 +++++ tests/api_resources/matrix/test_rooms.py | 337 +++++++ tests/api_resources/matrix/test_users.py | 100 ++ tests/api_resources/matrix/users/__init__.py | 1 + .../matrix/users/test_account_data.py | 225 +++++ tests/api_resources/test_app.py | 74 ++ tests/api_resources/test_bridges.py | 74 ++ 132 files changed, 17231 insertions(+), 11 deletions(-) create mode 100644 src/beeper_desktop_api/resources/app/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/app.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/e2ee.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/qr.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/sas.py create mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/verification.py create mode 100644 src/beeper_desktop_api/resources/app/login.py create mode 100644 src/beeper_desktop_api/resources/bridges.py create mode 100644 src/beeper_desktop_api/resources/matrix/__init__.py create mode 100644 src/beeper_desktop_api/resources/matrix/bridges/__init__.py create mode 100644 src/beeper_desktop_api/resources/matrix/bridges/auth.py create mode 100644 src/beeper_desktop_api/resources/matrix/bridges/bridges.py create mode 100644 src/beeper_desktop_api/resources/matrix/bridges/capabilities.py create mode 100644 src/beeper_desktop_api/resources/matrix/bridges/contacts.py create mode 100644 src/beeper_desktop_api/resources/matrix/bridges/rooms.py create mode 100644 src/beeper_desktop_api/resources/matrix/bridges/users.py create mode 100644 src/beeper_desktop_api/resources/matrix/matrix.py create mode 100644 src/beeper_desktop_api/resources/matrix/rooms/__init__.py create mode 100644 src/beeper_desktop_api/resources/matrix/rooms/account_data.py create mode 100644 src/beeper_desktop_api/resources/matrix/rooms/events.py create mode 100644 src/beeper_desktop_api/resources/matrix/rooms/rooms.py create mode 100644 src/beeper_desktop_api/resources/matrix/rooms/state.py create mode 100644 src/beeper_desktop_api/resources/matrix/users/__init__.py create mode 100644 src/beeper_desktop_api/resources/matrix/users/account_data.py create mode 100644 src/beeper_desktop_api/resources/matrix/users/users.py create mode 100644 src/beeper_desktop_api/types/app/__init__.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/__init__.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/__init__.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_create_params.py create mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_create_response.py create mode 100644 src/beeper_desktop_api/types/app/login_email_params.py create mode 100644 src/beeper_desktop_api/types/app/login_register_params.py create mode 100644 src/beeper_desktop_api/types/app/login_register_response.py create mode 100644 src/beeper_desktop_api/types/app/login_response_params.py create mode 100644 src/beeper_desktop_api/types/app/login_response_response.py create mode 100644 src/beeper_desktop_api/types/app/login_start_response.py create mode 100644 src/beeper_desktop_api/types/app_status_response.py create mode 100644 src/beeper_desktop_api/types/bridge_availability.py create mode 100644 src/beeper_desktop_api/types/bridge_list_response.py create mode 100644 src/beeper_desktop_api/types/matrix/__init__.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/__init__.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_search_params.py create mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_search_response.py create mode 100644 src/beeper_desktop_api/types/matrix/room_create_params.py create mode 100644 src/beeper_desktop_api/types/matrix/room_create_response.py create mode 100644 src/beeper_desktop_api/types/matrix/room_join_params.py create mode 100644 src/beeper_desktop_api/types/matrix/room_join_response.py create mode 100644 src/beeper_desktop_api/types/matrix/room_leave_params.py create mode 100644 src/beeper_desktop_api/types/matrix/rooms/__init__.py create mode 100644 src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py create mode 100644 src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py create mode 100644 src/beeper_desktop_api/types/matrix/rooms/state_list_response.py create mode 100644 src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py create mode 100644 src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py create mode 100644 src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py create mode 100644 src/beeper_desktop_api/types/matrix/users/__init__.py create mode 100644 src/beeper_desktop_api/types/matrix/users/account_data_update_params.py create mode 100644 src/beeper_desktop_api/types/shared/app_state_snapshot.py create mode 100644 tests/api_resources/app/__init__.py create mode 100644 tests/api_resources/app/e2ee/__init__.py create mode 100644 tests/api_resources/app/e2ee/recovery_code/__init__.py create mode 100644 tests/api_resources/app/e2ee/recovery_code/test_reset.py create mode 100644 tests/api_resources/app/e2ee/test_recovery_code.py create mode 100644 tests/api_resources/app/e2ee/test_verification.py create mode 100644 tests/api_resources/app/e2ee/verification/__init__.py create mode 100644 tests/api_resources/app/e2ee/verification/test_qr.py create mode 100644 tests/api_resources/app/e2ee/verification/test_sas.py create mode 100644 tests/api_resources/app/test_login.py create mode 100644 tests/api_resources/matrix/__init__.py create mode 100644 tests/api_resources/matrix/bridges/__init__.py create mode 100644 tests/api_resources/matrix/bridges/test_auth.py create mode 100644 tests/api_resources/matrix/bridges/test_capabilities.py create mode 100644 tests/api_resources/matrix/bridges/test_contacts.py create mode 100644 tests/api_resources/matrix/bridges/test_rooms.py create mode 100644 tests/api_resources/matrix/bridges/test_users.py create mode 100644 tests/api_resources/matrix/rooms/__init__.py create mode 100644 tests/api_resources/matrix/rooms/test_account_data.py create mode 100644 tests/api_resources/matrix/rooms/test_events.py create mode 100644 tests/api_resources/matrix/rooms/test_state.py create mode 100644 tests/api_resources/matrix/test_rooms.py create mode 100644 tests/api_resources/matrix/test_users.py create mode 100644 tests/api_resources/matrix/users/__init__.py create mode 100644 tests/api_resources/matrix/users/test_account_data.py create mode 100644 tests/api_resources/test_app.py create mode 100644 tests/api_resources/test_bridges.py diff --git a/.stats.yml b/.stats.yml index b85c157..b63d20d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-371238be116b1748e82f213ba35b85b0cd574f24e9d9815f73bc743478f23c99.yml -openapi_spec_hash: a10246aaf7cdc33b682fc245bd5f893b -config_hash: 9a5611f899a0fe46abb2a1e463e0ee60 +configured_endpoints: 72 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-de1370e6a3183044fa135a886d2ee8f779d5e86228cdbd503d553b4c13cc7cbe.yml +openapi_spec_hash: 30b435d7585d8b6951610e7147369779 +config_hash: 683b13ea6fb6aa9d6b1b8814cca24f1c diff --git a/README.md b/README.md index 645fd65..b0b1be5 100644 --- a/README.md +++ b/README.md @@ -221,11 +221,16 @@ from beeper_desktop_api import BeeperDesktop client = BeeperDesktop() -chat = client.chats.update( - chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com", - draft={"text": "text"}, +response = client.matrix.rooms.join( + room_id_or_alias="!monkeys:matrix.org", + third_party_signed={ + "token": "random8nonce", + "mxid": "bob", + "sender": "alice", + "signatures": {"example.org": {"ed25519:0": "some9signature"}}, + }, ) -print(chat.draft) +print(response.third_party_signed) ``` ## File uploads diff --git a/api.md b/api.md index 4818056..d78a0a2 100644 --- a/api.md +++ b/api.md @@ -1,7 +1,7 @@ # Shared Types ```python -from beeper_desktop_api.types import Attachment, Error, Message, Reaction, User +from beeper_desktop_api.types import AppStateSnapshot, Attachment, Error, Message, Reaction, User ``` # BeeperDesktop @@ -17,6 +17,123 @@ Methods: - client.focus(\*\*params) -> FocusResponse - client.search(\*\*params) -> SearchResponse +# App + +Types: + +```python +from beeper_desktop_api.types import ( + LoginRegistrationRequiredResponse, + LoginResponse, + LoginResponseOutput, + RecoveryCodeResetResponse, + StartVerificationResponse, + StateMutationResponse, + AppStatusResponse, +) +``` + +Methods: + +- client.app.status() -> AppStatusResponse + +## Login + +Types: + +```python +from beeper_desktop_api.types.app import ( + LoginRegisterResponse, + LoginResponseResponse, + LoginStartResponse, +) +``` + +Methods: + +- client.app.login.email(\*\*params) -> object +- client.app.login.register(\*\*params) -> LoginRegisterResponse +- client.app.login.response(\*\*params) -> LoginResponseResponse +- client.app.login.start() -> LoginStartResponse + +## E2ee + +### RecoveryCode + +Types: + +```python +from beeper_desktop_api.types.app.e2ee import ( + RecoveryCodeMarkBackedUpResponse, + RecoveryCodeVerifyResponse, +) +``` + +Methods: + +- client.app.e2ee.recovery_code.mark_backed_up() -> RecoveryCodeMarkBackedUpResponse +- client.app.e2ee.recovery_code.verify(\*\*params) -> RecoveryCodeVerifyResponse + +#### Reset + +Types: + +```python +from beeper_desktop_api.types.app.e2ee.recovery_code import ( + ResetCreateResponse, + ResetConfirmResponse, +) +``` + +Methods: + +- client.app.e2ee.recovery_code.reset.create(\*\*params) -> ResetCreateResponse +- client.app.e2ee.recovery_code.reset.confirm(\*\*params) -> ResetConfirmResponse + +### Verification + +Types: + +```python +from beeper_desktop_api.types.app.e2ee import ( + VerificationCreateResponse, + VerificationAcceptResponse, + VerificationCancelResponse, +) +``` + +Methods: + +- client.app.e2ee.verification.create(\*\*params) -> VerificationCreateResponse +- client.app.e2ee.verification.accept(verification_id) -> VerificationAcceptResponse +- client.app.e2ee.verification.cancel(verification_id, \*\*params) -> VerificationCancelResponse + +#### Qr + +Types: + +```python +from beeper_desktop_api.types.app.e2ee.verification import QrConfirmScannedResponse, QrScanResponse +``` + +Methods: + +- client.app.e2ee.verification.qr.confirm_scanned(verification_id) -> QrConfirmScannedResponse +- client.app.e2ee.verification.qr.scan(\*\*params) -> QrScanResponse + +#### Sas + +Types: + +```python +from beeper_desktop_api.types.app.e2ee.verification import SaConfirmResponse, SaStartResponse +``` + +Methods: + +- client.app.e2ee.verification.sas.confirm(verification_id) -> SaConfirmResponse +- client.app.e2ee.verification.sas.start(verification_id) -> SaStartResponse + # Accounts Types: @@ -42,6 +159,164 @@ Methods: - client.accounts.contacts.list(account_id, \*\*params) -> SyncCursorSearch[User] - client.accounts.contacts.search(account_id, \*\*params) -> ContactSearchResponse +# Bridges + +Types: + +```python +from beeper_desktop_api.types import BridgeAvailability, BridgeListResponse +``` + +Methods: + +- client.bridges.list() -> BridgeListResponse + +# Matrix + +## Users + +Types: + +```python +from beeper_desktop_api.types.matrix import UserRetrieveProfileResponse +``` + +Methods: + +- client.matrix.users.retrieve_profile(user_id) -> UserRetrieveProfileResponse + +### AccountData + +Methods: + +- client.matrix.users.account_data.retrieve(type, \*, user_id) -> object +- client.matrix.users.account_data.update(type, \*, user_id, \*\*params) -> object + +## Rooms + +Types: + +```python +from beeper_desktop_api.types.matrix import RoomCreateResponse, RoomJoinResponse +``` + +Methods: + +- client.matrix.rooms.create(\*\*params) -> RoomCreateResponse +- client.matrix.rooms.join(room_id_or_alias, \*\*params) -> RoomJoinResponse +- client.matrix.rooms.leave(room_id, \*\*params) -> object + +### AccountData + +Methods: + +- client.matrix.rooms.account_data.retrieve(type, \*, user_id, room_id) -> object +- client.matrix.rooms.account_data.update(type, \*, user_id, room_id, \*\*params) -> object + +### State + +Types: + +```python +from beeper_desktop_api.types.matrix.rooms import StateRetrieveResponse, StateListResponse +``` + +Methods: + +- client.matrix.rooms.state.retrieve(state_key, \*, room_id, event_type, \*\*params) -> StateRetrieveResponse +- client.matrix.rooms.state.list(room_id) -> StateListResponse + +### Events + +Types: + +```python +from beeper_desktop_api.types.matrix.rooms import EventRetrieveResponse +``` + +Methods: + +- client.matrix.rooms.events.retrieve(event_id, \*, room_id) -> EventRetrieveResponse + +## Bridges + +### Auth + +Types: + +```python +from beeper_desktop_api.types.matrix.bridges import ( + AuthListFlowsResponse, + AuthListLoginsResponse, + AuthStartLoginResponse, + AuthSubmitCookiesResponse, + AuthSubmitUserInputResponse, + AuthWaitForStepResponse, + AuthWhoamiResponse, +) +``` + +Methods: + +- client.matrix.bridges.auth.list_flows(bridge_id) -> AuthListFlowsResponse +- client.matrix.bridges.auth.list_logins(bridge_id) -> AuthListLoginsResponse +- client.matrix.bridges.auth.logout(login_id, \*, bridge_id) -> object +- client.matrix.bridges.auth.start_login(flow_id, \*, bridge_id, \*\*params) -> AuthStartLoginResponse +- client.matrix.bridges.auth.submit_cookies(step_id, \*, bridge_id, login_process_id, \*\*params) -> AuthSubmitCookiesResponse +- client.matrix.bridges.auth.submit_user_input(step_id, \*, bridge_id, login_process_id, \*\*params) -> AuthSubmitUserInputResponse +- client.matrix.bridges.auth.wait_for_step(step_id, \*, bridge_id, login_process_id) -> AuthWaitForStepResponse +- client.matrix.bridges.auth.whoami(bridge_id) -> AuthWhoamiResponse + +### Contacts + +Types: + +```python +from beeper_desktop_api.types.matrix.bridges import ContactListResponse +``` + +Methods: + +- client.matrix.bridges.contacts.list(bridge_id, \*\*params) -> ContactListResponse + +### Users + +Types: + +```python +from beeper_desktop_api.types.matrix.bridges import UserResolveResponse, UserSearchResponse +``` + +Methods: + +- client.matrix.bridges.users.resolve(identifier, \*, bridge_id, \*\*params) -> UserResolveResponse +- client.matrix.bridges.users.search(bridge_id, \*\*params) -> UserSearchResponse + +### Rooms + +Types: + +```python +from beeper_desktop_api.types.matrix.bridges import RoomCreateDmResponse, RoomCreateGroupResponse +``` + +Methods: + +- client.matrix.bridges.rooms.create_dm(identifier, \*, bridge_id, \*\*params) -> RoomCreateDmResponse +- client.matrix.bridges.rooms.create_group(group_type, \*, bridge_id, \*\*params) -> RoomCreateGroupResponse + +### Capabilities + +Types: + +```python +from beeper_desktop_api.types.matrix.bridges import CapabilityRetrieveResponse +``` + +Methods: + +- client.matrix.bridges.capabilities.retrieve(bridge_id) -> CapabilityRetrieveResponse + # Chats Types: diff --git a/src/beeper_desktop_api/_client.py b/src/beeper_desktop_api/_client.py index 6c43fcb..63950dc 100644 --- a/src/beeper_desktop_api/_client.py +++ b/src/beeper_desktop_api/_client.py @@ -52,11 +52,14 @@ from .types.search_response import SearchResponse if TYPE_CHECKING: - from .resources import info, chats, assets, accounts, messages + from .resources import app, info, chats, assets, matrix, bridges, accounts, messages from .resources.info import InfoResource, AsyncInfoResource from .resources.assets import AssetsResource, AsyncAssetsResource + from .resources.app.app import AppResource, AsyncAppResource + from .resources.bridges import BridgesResource, AsyncBridgesResource from .resources.messages import MessagesResource, AsyncMessagesResource from .resources.chats.chats import ChatsResource, AsyncChatsResource + from .resources.matrix.matrix import MatrixResource, AsyncMatrixResource from .resources.accounts.accounts import AccountsResource, AsyncAccountsResource __all__ = [ @@ -135,6 +138,13 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + @cached_property + def app(self) -> AppResource: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResource + + return AppResource(self) + @cached_property def accounts(self) -> AccountsResource: """Manage connected chat accounts""" @@ -142,6 +152,20 @@ def accounts(self) -> AccountsResource: return AccountsResource(self) + @cached_property + def bridges(self) -> BridgesResource: + """Manage bridge-backed account types and account availability""" + from .resources.bridges import BridgesResource + + return BridgesResource(self) + + @cached_property + def matrix(self) -> MatrixResource: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import MatrixResource + + return MatrixResource(self) + @cached_property def chats(self) -> ChatsResource: """Manage chats""" @@ -447,6 +471,13 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + @cached_property + def app(self) -> AsyncAppResource: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResource + + return AsyncAppResource(self) + @cached_property def accounts(self) -> AsyncAccountsResource: """Manage connected chat accounts""" @@ -454,6 +485,20 @@ def accounts(self) -> AsyncAccountsResource: return AsyncAccountsResource(self) + @cached_property + def bridges(self) -> AsyncBridgesResource: + """Manage bridge-backed account types and account availability""" + from .resources.bridges import AsyncBridgesResource + + return AsyncBridgesResource(self) + + @cached_property + def matrix(self) -> AsyncMatrixResource: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import AsyncMatrixResource + + return AsyncMatrixResource(self) + @cached_property def chats(self) -> AsyncChatsResource: """Manage chats""" @@ -708,6 +753,13 @@ def __init__(self, client: BeeperDesktop) -> None: client.search, ) + @cached_property + def app(self) -> app.AppResourceWithRawResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResourceWithRawResponse + + return AppResourceWithRawResponse(self._client.app) + @cached_property def accounts(self) -> accounts.AccountsResourceWithRawResponse: """Manage connected chat accounts""" @@ -715,6 +767,20 @@ def accounts(self) -> accounts.AccountsResourceWithRawResponse: return AccountsResourceWithRawResponse(self._client.accounts) + @cached_property + def bridges(self) -> bridges.BridgesResourceWithRawResponse: + """Manage bridge-backed account types and account availability""" + from .resources.bridges import BridgesResourceWithRawResponse + + return BridgesResourceWithRawResponse(self._client.bridges) + + @cached_property + def matrix(self) -> matrix.MatrixResourceWithRawResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import MatrixResourceWithRawResponse + + return MatrixResourceWithRawResponse(self._client.matrix) + @cached_property def chats(self) -> chats.ChatsResourceWithRawResponse: """Manage chats""" @@ -760,6 +826,13 @@ def __init__(self, client: AsyncBeeperDesktop) -> None: client.search, ) + @cached_property + def app(self) -> app.AsyncAppResourceWithRawResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResourceWithRawResponse + + return AsyncAppResourceWithRawResponse(self._client.app) + @cached_property def accounts(self) -> accounts.AsyncAccountsResourceWithRawResponse: """Manage connected chat accounts""" @@ -767,6 +840,20 @@ def accounts(self) -> accounts.AsyncAccountsResourceWithRawResponse: return AsyncAccountsResourceWithRawResponse(self._client.accounts) + @cached_property + def bridges(self) -> bridges.AsyncBridgesResourceWithRawResponse: + """Manage bridge-backed account types and account availability""" + from .resources.bridges import AsyncBridgesResourceWithRawResponse + + return AsyncBridgesResourceWithRawResponse(self._client.bridges) + + @cached_property + def matrix(self) -> matrix.AsyncMatrixResourceWithRawResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import AsyncMatrixResourceWithRawResponse + + return AsyncMatrixResourceWithRawResponse(self._client.matrix) + @cached_property def chats(self) -> chats.AsyncChatsResourceWithRawResponse: """Manage chats""" @@ -812,6 +899,13 @@ def __init__(self, client: BeeperDesktop) -> None: client.search, ) + @cached_property + def app(self) -> app.AppResourceWithStreamingResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResourceWithStreamingResponse + + return AppResourceWithStreamingResponse(self._client.app) + @cached_property def accounts(self) -> accounts.AccountsResourceWithStreamingResponse: """Manage connected chat accounts""" @@ -819,6 +913,20 @@ def accounts(self) -> accounts.AccountsResourceWithStreamingResponse: return AccountsResourceWithStreamingResponse(self._client.accounts) + @cached_property + def bridges(self) -> bridges.BridgesResourceWithStreamingResponse: + """Manage bridge-backed account types and account availability""" + from .resources.bridges import BridgesResourceWithStreamingResponse + + return BridgesResourceWithStreamingResponse(self._client.bridges) + + @cached_property + def matrix(self) -> matrix.MatrixResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import MatrixResourceWithStreamingResponse + + return MatrixResourceWithStreamingResponse(self._client.matrix) + @cached_property def chats(self) -> chats.ChatsResourceWithStreamingResponse: """Manage chats""" @@ -864,6 +972,13 @@ def __init__(self, client: AsyncBeeperDesktop) -> None: client.search, ) + @cached_property + def app(self) -> app.AsyncAppResourceWithStreamingResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResourceWithStreamingResponse + + return AsyncAppResourceWithStreamingResponse(self._client.app) + @cached_property def accounts(self) -> accounts.AsyncAccountsResourceWithStreamingResponse: """Manage connected chat accounts""" @@ -871,6 +986,20 @@ def accounts(self) -> accounts.AsyncAccountsResourceWithStreamingResponse: return AsyncAccountsResourceWithStreamingResponse(self._client.accounts) + @cached_property + def bridges(self) -> bridges.AsyncBridgesResourceWithStreamingResponse: + """Manage bridge-backed account types and account availability""" + from .resources.bridges import AsyncBridgesResourceWithStreamingResponse + + return AsyncBridgesResourceWithStreamingResponse(self._client.bridges) + + @cached_property + def matrix(self) -> matrix.AsyncMatrixResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import AsyncMatrixResourceWithStreamingResponse + + return AsyncMatrixResourceWithStreamingResponse(self._client.matrix) + @cached_property def chats(self) -> chats.AsyncChatsResourceWithStreamingResponse: """Manage chats""" diff --git a/src/beeper_desktop_api/resources/__init__.py b/src/beeper_desktop_api/resources/__init__.py index a066e9b..165308b 100644 --- a/src/beeper_desktop_api/resources/__init__.py +++ b/src/beeper_desktop_api/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .app import ( + AppResource, + AsyncAppResource, + AppResourceWithRawResponse, + AsyncAppResourceWithRawResponse, + AppResourceWithStreamingResponse, + AsyncAppResourceWithStreamingResponse, +) from .info import ( InfoResource, AsyncInfoResource, @@ -24,6 +32,22 @@ AssetsResourceWithStreamingResponse, AsyncAssetsResourceWithStreamingResponse, ) +from .matrix import ( + MatrixResource, + AsyncMatrixResource, + MatrixResourceWithRawResponse, + AsyncMatrixResourceWithRawResponse, + MatrixResourceWithStreamingResponse, + AsyncMatrixResourceWithStreamingResponse, +) +from .bridges import ( + BridgesResource, + AsyncBridgesResource, + BridgesResourceWithRawResponse, + AsyncBridgesResourceWithRawResponse, + BridgesResourceWithStreamingResponse, + AsyncBridgesResourceWithStreamingResponse, +) from .accounts import ( AccountsResource, AsyncAccountsResource, @@ -42,12 +66,30 @@ ) __all__ = [ + "AppResource", + "AsyncAppResource", + "AppResourceWithRawResponse", + "AsyncAppResourceWithRawResponse", + "AppResourceWithStreamingResponse", + "AsyncAppResourceWithStreamingResponse", "AccountsResource", "AsyncAccountsResource", "AccountsResourceWithRawResponse", "AsyncAccountsResourceWithRawResponse", "AccountsResourceWithStreamingResponse", "AsyncAccountsResourceWithStreamingResponse", + "BridgesResource", + "AsyncBridgesResource", + "BridgesResourceWithRawResponse", + "AsyncBridgesResourceWithRawResponse", + "BridgesResourceWithStreamingResponse", + "AsyncBridgesResourceWithStreamingResponse", + "MatrixResource", + "AsyncMatrixResource", + "MatrixResourceWithRawResponse", + "AsyncMatrixResourceWithRawResponse", + "MatrixResourceWithStreamingResponse", + "AsyncMatrixResourceWithStreamingResponse", "ChatsResource", "AsyncChatsResource", "ChatsResourceWithRawResponse", diff --git a/src/beeper_desktop_api/resources/app/__init__.py b/src/beeper_desktop_api/resources/app/__init__.py new file mode 100644 index 0000000..a21f690 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .app import ( + AppResource, + AsyncAppResource, + AppResourceWithRawResponse, + AsyncAppResourceWithRawResponse, + AppResourceWithStreamingResponse, + AsyncAppResourceWithStreamingResponse, +) +from .e2ee import ( + E2eeResource, + AsyncE2eeResource, + E2eeResourceWithRawResponse, + AsyncE2eeResourceWithRawResponse, + E2eeResourceWithStreamingResponse, + AsyncE2eeResourceWithStreamingResponse, +) +from .login import ( + LoginResource, + AsyncLoginResource, + LoginResourceWithRawResponse, + AsyncLoginResourceWithRawResponse, + LoginResourceWithStreamingResponse, + AsyncLoginResourceWithStreamingResponse, +) + +__all__ = [ + "LoginResource", + "AsyncLoginResource", + "LoginResourceWithRawResponse", + "AsyncLoginResourceWithRawResponse", + "LoginResourceWithStreamingResponse", + "AsyncLoginResourceWithStreamingResponse", + "E2eeResource", + "AsyncE2eeResource", + "E2eeResourceWithRawResponse", + "AsyncE2eeResourceWithRawResponse", + "E2eeResourceWithStreamingResponse", + "AsyncE2eeResourceWithStreamingResponse", + "AppResource", + "AsyncAppResource", + "AppResourceWithRawResponse", + "AsyncAppResourceWithRawResponse", + "AppResourceWithStreamingResponse", + "AsyncAppResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/app.py b/src/beeper_desktop_api/resources/app/app.py new file mode 100644 index 0000000..73858b9 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/app.py @@ -0,0 +1,223 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .login import ( + LoginResource, + AsyncLoginResource, + LoginResourceWithRawResponse, + AsyncLoginResourceWithRawResponse, + LoginResourceWithStreamingResponse, + AsyncLoginResourceWithStreamingResponse, +) +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from .e2ee.e2ee import ( + E2eeResource, + AsyncE2eeResource, + E2eeResourceWithRawResponse, + AsyncE2eeResourceWithRawResponse, + E2eeResourceWithStreamingResponse, + AsyncE2eeResourceWithStreamingResponse, +) +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.app_status_response import AppStatusResponse + +__all__ = ["AppResource", "AsyncAppResource"] + + +class AppResource(SyncAPIResource): + """Manage Beeper app login and encrypted messaging setup""" + + @cached_property + def login(self) -> LoginResource: + """Complete first-party Beeper app login""" + return LoginResource(self._client) + + @cached_property + def e2ee(self) -> E2eeResource: + """Manage encrypted messaging setup""" + return E2eeResource(self._client) + + @cached_property + def with_raw_response(self) -> AppResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AppResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AppResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AppResourceWithStreamingResponse(self) + + def status( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AppStatusResponse: + """ + Return the current Beeper Desktop sign-in and encrypted messaging setup state. + This endpoint is public before sign-in so apps can discover that login is + needed; after sign-in, pass a read token. + """ + return self._get( + "/v1/app/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppStatusResponse, + ) + + +class AsyncAppResource(AsyncAPIResource): + """Manage Beeper app login and encrypted messaging setup""" + + @cached_property + def login(self) -> AsyncLoginResource: + """Complete first-party Beeper app login""" + return AsyncLoginResource(self._client) + + @cached_property + def e2ee(self) -> AsyncE2eeResource: + """Manage encrypted messaging setup""" + return AsyncE2eeResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAppResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncAppResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAppResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncAppResourceWithStreamingResponse(self) + + async def status( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AppStatusResponse: + """ + Return the current Beeper Desktop sign-in and encrypted messaging setup state. + This endpoint is public before sign-in so apps can discover that login is + needed; after sign-in, pass a read token. + """ + return await self._get( + "/v1/app/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppStatusResponse, + ) + + +class AppResourceWithRawResponse: + def __init__(self, app: AppResource) -> None: + self._app = app + + self.status = to_raw_response_wrapper( + app.status, + ) + + @cached_property + def login(self) -> LoginResourceWithRawResponse: + """Complete first-party Beeper app login""" + return LoginResourceWithRawResponse(self._app.login) + + @cached_property + def e2ee(self) -> E2eeResourceWithRawResponse: + """Manage encrypted messaging setup""" + return E2eeResourceWithRawResponse(self._app.e2ee) + + +class AsyncAppResourceWithRawResponse: + def __init__(self, app: AsyncAppResource) -> None: + self._app = app + + self.status = async_to_raw_response_wrapper( + app.status, + ) + + @cached_property + def login(self) -> AsyncLoginResourceWithRawResponse: + """Complete first-party Beeper app login""" + return AsyncLoginResourceWithRawResponse(self._app.login) + + @cached_property + def e2ee(self) -> AsyncE2eeResourceWithRawResponse: + """Manage encrypted messaging setup""" + return AsyncE2eeResourceWithRawResponse(self._app.e2ee) + + +class AppResourceWithStreamingResponse: + def __init__(self, app: AppResource) -> None: + self._app = app + + self.status = to_streamed_response_wrapper( + app.status, + ) + + @cached_property + def login(self) -> LoginResourceWithStreamingResponse: + """Complete first-party Beeper app login""" + return LoginResourceWithStreamingResponse(self._app.login) + + @cached_property + def e2ee(self) -> E2eeResourceWithStreamingResponse: + """Manage encrypted messaging setup""" + return E2eeResourceWithStreamingResponse(self._app.e2ee) + + +class AsyncAppResourceWithStreamingResponse: + def __init__(self, app: AsyncAppResource) -> None: + self._app = app + + self.status = async_to_streamed_response_wrapper( + app.status, + ) + + @cached_property + def login(self) -> AsyncLoginResourceWithStreamingResponse: + """Complete first-party Beeper app login""" + return AsyncLoginResourceWithStreamingResponse(self._app.login) + + @cached_property + def e2ee(self) -> AsyncE2eeResourceWithStreamingResponse: + """Manage encrypted messaging setup""" + return AsyncE2eeResourceWithStreamingResponse(self._app.e2ee) diff --git a/src/beeper_desktop_api/resources/app/e2ee/__init__.py b/src/beeper_desktop_api/resources/app/e2ee/__init__.py new file mode 100644 index 0000000..f7fa574 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .e2ee import ( + E2eeResource, + AsyncE2eeResource, + E2eeResourceWithRawResponse, + AsyncE2eeResourceWithRawResponse, + E2eeResourceWithStreamingResponse, + AsyncE2eeResourceWithStreamingResponse, +) +from .verification import ( + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, +) +from .recovery_code import ( + RecoveryCodeResource, + AsyncRecoveryCodeResource, + RecoveryCodeResourceWithRawResponse, + AsyncRecoveryCodeResourceWithRawResponse, + RecoveryCodeResourceWithStreamingResponse, + AsyncRecoveryCodeResourceWithStreamingResponse, +) + +__all__ = [ + "RecoveryCodeResource", + "AsyncRecoveryCodeResource", + "RecoveryCodeResourceWithRawResponse", + "AsyncRecoveryCodeResourceWithRawResponse", + "RecoveryCodeResourceWithStreamingResponse", + "AsyncRecoveryCodeResourceWithStreamingResponse", + "VerificationResource", + "AsyncVerificationResource", + "VerificationResourceWithRawResponse", + "AsyncVerificationResourceWithRawResponse", + "VerificationResourceWithStreamingResponse", + "AsyncVerificationResourceWithStreamingResponse", + "E2eeResource", + "AsyncE2eeResource", + "E2eeResourceWithRawResponse", + "AsyncE2eeResourceWithRawResponse", + "E2eeResourceWithStreamingResponse", + "AsyncE2eeResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/e2ee/e2ee.py b/src/beeper_desktop_api/resources/app/e2ee/e2ee.py new file mode 100644 index 0000000..285e853 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/e2ee.py @@ -0,0 +1,150 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .verification.verification import ( + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, +) +from .recovery_code.recovery_code import ( + RecoveryCodeResource, + AsyncRecoveryCodeResource, + RecoveryCodeResourceWithRawResponse, + AsyncRecoveryCodeResourceWithRawResponse, + RecoveryCodeResourceWithStreamingResponse, + AsyncRecoveryCodeResourceWithStreamingResponse, +) + +__all__ = ["E2eeResource", "AsyncE2eeResource"] + + +class E2eeResource(SyncAPIResource): + """Manage encrypted messaging setup""" + + @cached_property + def recovery_code(self) -> RecoveryCodeResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return RecoveryCodeResource(self._client) + + @cached_property + def verification(self) -> VerificationResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return VerificationResource(self._client) + + @cached_property + def with_raw_response(self) -> E2eeResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return E2eeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> E2eeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return E2eeResourceWithStreamingResponse(self) + + +class AsyncE2eeResource(AsyncAPIResource): + """Manage encrypted messaging setup""" + + @cached_property + def recovery_code(self) -> AsyncRecoveryCodeResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncRecoveryCodeResource(self._client) + + @cached_property + def verification(self) -> AsyncVerificationResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncVerificationResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncE2eeResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncE2eeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncE2eeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncE2eeResourceWithStreamingResponse(self) + + +class E2eeResourceWithRawResponse: + def __init__(self, e2ee: E2eeResource) -> None: + self._e2ee = e2ee + + @cached_property + def recovery_code(self) -> RecoveryCodeResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return RecoveryCodeResourceWithRawResponse(self._e2ee.recovery_code) + + @cached_property + def verification(self) -> VerificationResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return VerificationResourceWithRawResponse(self._e2ee.verification) + + +class AsyncE2eeResourceWithRawResponse: + def __init__(self, e2ee: AsyncE2eeResource) -> None: + self._e2ee = e2ee + + @cached_property + def recovery_code(self) -> AsyncRecoveryCodeResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncRecoveryCodeResourceWithRawResponse(self._e2ee.recovery_code) + + @cached_property + def verification(self) -> AsyncVerificationResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncVerificationResourceWithRawResponse(self._e2ee.verification) + + +class E2eeResourceWithStreamingResponse: + def __init__(self, e2ee: E2eeResource) -> None: + self._e2ee = e2ee + + @cached_property + def recovery_code(self) -> RecoveryCodeResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return RecoveryCodeResourceWithStreamingResponse(self._e2ee.recovery_code) + + @cached_property + def verification(self) -> VerificationResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return VerificationResourceWithStreamingResponse(self._e2ee.verification) + + +class AsyncE2eeResourceWithStreamingResponse: + def __init__(self, e2ee: AsyncE2eeResource) -> None: + self._e2ee = e2ee + + @cached_property + def recovery_code(self) -> AsyncRecoveryCodeResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncRecoveryCodeResourceWithStreamingResponse(self._e2ee.recovery_code) + + @cached_property + def verification(self) -> AsyncVerificationResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncVerificationResourceWithStreamingResponse(self._e2ee.verification) diff --git a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py new file mode 100644 index 0000000..f60d377 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .reset import ( + ResetResource, + AsyncResetResource, + ResetResourceWithRawResponse, + AsyncResetResourceWithRawResponse, + ResetResourceWithStreamingResponse, + AsyncResetResourceWithStreamingResponse, +) +from .recovery_code import ( + RecoveryCodeResource, + AsyncRecoveryCodeResource, + RecoveryCodeResourceWithRawResponse, + AsyncRecoveryCodeResourceWithRawResponse, + RecoveryCodeResourceWithStreamingResponse, + AsyncRecoveryCodeResourceWithStreamingResponse, +) + +__all__ = [ + "ResetResource", + "AsyncResetResource", + "ResetResourceWithRawResponse", + "AsyncResetResourceWithRawResponse", + "ResetResourceWithStreamingResponse", + "AsyncResetResourceWithStreamingResponse", + "RecoveryCodeResource", + "AsyncRecoveryCodeResource", + "RecoveryCodeResourceWithRawResponse", + "AsyncRecoveryCodeResourceWithRawResponse", + "RecoveryCodeResourceWithStreamingResponse", + "AsyncRecoveryCodeResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py new file mode 100644 index 0000000..47a7804 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py @@ -0,0 +1,264 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .reset import ( + ResetResource, + AsyncResetResource, + ResetResourceWithRawResponse, + AsyncResetResourceWithRawResponse, + ResetResourceWithStreamingResponse, + AsyncResetResourceWithStreamingResponse, +) +from ....._types import Body, Query, Headers, NotGiven, 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.app.e2ee import recovery_code_verify_params +from .....types.app.e2ee.recovery_code_verify_response import RecoveryCodeVerifyResponse +from .....types.app.e2ee.recovery_code_mark_backed_up_response import RecoveryCodeMarkBackedUpResponse + +__all__ = ["RecoveryCodeResource", "AsyncRecoveryCodeResource"] + + +class RecoveryCodeResource(SyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def reset(self) -> ResetResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return ResetResource(self._client) + + @cached_property + def with_raw_response(self) -> RecoveryCodeResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return RecoveryCodeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RecoveryCodeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return RecoveryCodeResourceWithStreamingResponse(self) + + def mark_backed_up( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RecoveryCodeMarkBackedUpResponse: + """Record that the user saved their recovery key.""" + return self._post( + "/v1/app/e2ee/recovery-code/mark-backed-up", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RecoveryCodeMarkBackedUpResponse, + ) + + def verify( + self, + *, + recovery_code: 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, + ) -> RecoveryCodeVerifyResponse: + """ + Unlock encrypted messages with the user recovery key. + + Args: + recovery_code: Recovery key saved by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/recovery-code/verify", + body=maybe_transform( + {"recovery_code": recovery_code}, recovery_code_verify_params.RecoveryCodeVerifyParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RecoveryCodeVerifyResponse, + ) + + +class AsyncRecoveryCodeResource(AsyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def reset(self) -> AsyncResetResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncResetResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncRecoveryCodeResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncRecoveryCodeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRecoveryCodeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncRecoveryCodeResourceWithStreamingResponse(self) + + async def mark_backed_up( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RecoveryCodeMarkBackedUpResponse: + """Record that the user saved their recovery key.""" + return await self._post( + "/v1/app/e2ee/recovery-code/mark-backed-up", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RecoveryCodeMarkBackedUpResponse, + ) + + async def verify( + self, + *, + recovery_code: 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, + ) -> RecoveryCodeVerifyResponse: + """ + Unlock encrypted messages with the user recovery key. + + Args: + recovery_code: Recovery key saved by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/recovery-code/verify", + body=await async_maybe_transform( + {"recovery_code": recovery_code}, recovery_code_verify_params.RecoveryCodeVerifyParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RecoveryCodeVerifyResponse, + ) + + +class RecoveryCodeResourceWithRawResponse: + def __init__(self, recovery_code: RecoveryCodeResource) -> None: + self._recovery_code = recovery_code + + self.mark_backed_up = to_raw_response_wrapper( + recovery_code.mark_backed_up, + ) + self.verify = to_raw_response_wrapper( + recovery_code.verify, + ) + + @cached_property + def reset(self) -> ResetResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return ResetResourceWithRawResponse(self._recovery_code.reset) + + +class AsyncRecoveryCodeResourceWithRawResponse: + def __init__(self, recovery_code: AsyncRecoveryCodeResource) -> None: + self._recovery_code = recovery_code + + self.mark_backed_up = async_to_raw_response_wrapper( + recovery_code.mark_backed_up, + ) + self.verify = async_to_raw_response_wrapper( + recovery_code.verify, + ) + + @cached_property + def reset(self) -> AsyncResetResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncResetResourceWithRawResponse(self._recovery_code.reset) + + +class RecoveryCodeResourceWithStreamingResponse: + def __init__(self, recovery_code: RecoveryCodeResource) -> None: + self._recovery_code = recovery_code + + self.mark_backed_up = to_streamed_response_wrapper( + recovery_code.mark_backed_up, + ) + self.verify = to_streamed_response_wrapper( + recovery_code.verify, + ) + + @cached_property + def reset(self) -> ResetResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return ResetResourceWithStreamingResponse(self._recovery_code.reset) + + +class AsyncRecoveryCodeResourceWithStreamingResponse: + def __init__(self, recovery_code: AsyncRecoveryCodeResource) -> None: + self._recovery_code = recovery_code + + self.mark_backed_up = async_to_streamed_response_wrapper( + recovery_code.mark_backed_up, + ) + self.verify = async_to_streamed_response_wrapper( + recovery_code.verify, + ) + + @cached_property + def reset(self) -> AsyncResetResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncResetResourceWithStreamingResponse(self._recovery_code.reset) diff --git a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py new file mode 100644 index 0000000..63a7fa0 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py @@ -0,0 +1,252 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import 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.app.e2ee.recovery_code import reset_create_params, reset_confirm_params +from .....types.app.e2ee.recovery_code.reset_create_response import ResetCreateResponse +from .....types.app.e2ee.recovery_code.reset_confirm_response import ResetConfirmResponse + +__all__ = ["ResetResource", "AsyncResetResource"] + + +class ResetResource(SyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def with_raw_response(self) -> ResetResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return ResetResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ResetResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return ResetResourceWithStreamingResponse(self) + + def create( + self, + *, + recovery_code: 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, + ) -> ResetCreateResponse: + """ + Create a new recovery key when the user cannot use the existing one. + + Args: + recovery_code: Existing recovery key, if the user has it. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/recovery-code/reset", + body=maybe_transform({"recovery_code": recovery_code}, reset_create_params.ResetCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetCreateResponse, + ) + + def confirm( + self, + *, + recovery_code: 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, + ) -> ResetConfirmResponse: + """ + Confirm that the new recovery key should be used for this account. + + Args: + recovery_code: New recovery key returned by the reset step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/recovery-code/reset/confirm", + body=maybe_transform({"recovery_code": recovery_code}, reset_confirm_params.ResetConfirmParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetConfirmResponse, + ) + + +class AsyncResetResource(AsyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def with_raw_response(self) -> AsyncResetResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncResetResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncResetResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncResetResourceWithStreamingResponse(self) + + async def create( + self, + *, + recovery_code: 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, + ) -> ResetCreateResponse: + """ + Create a new recovery key when the user cannot use the existing one. + + Args: + recovery_code: Existing recovery key, if the user has it. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/recovery-code/reset", + body=await async_maybe_transform({"recovery_code": recovery_code}, reset_create_params.ResetCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetCreateResponse, + ) + + async def confirm( + self, + *, + recovery_code: 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, + ) -> ResetConfirmResponse: + """ + Confirm that the new recovery key should be used for this account. + + Args: + recovery_code: New recovery key returned by the reset step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/recovery-code/reset/confirm", + body=await async_maybe_transform({"recovery_code": recovery_code}, reset_confirm_params.ResetConfirmParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetConfirmResponse, + ) + + +class ResetResourceWithRawResponse: + def __init__(self, reset: ResetResource) -> None: + self._reset = reset + + self.create = to_raw_response_wrapper( + reset.create, + ) + self.confirm = to_raw_response_wrapper( + reset.confirm, + ) + + +class AsyncResetResourceWithRawResponse: + def __init__(self, reset: AsyncResetResource) -> None: + self._reset = reset + + self.create = async_to_raw_response_wrapper( + reset.create, + ) + self.confirm = async_to_raw_response_wrapper( + reset.confirm, + ) + + +class ResetResourceWithStreamingResponse: + def __init__(self, reset: ResetResource) -> None: + self._reset = reset + + self.create = to_streamed_response_wrapper( + reset.create, + ) + self.confirm = to_streamed_response_wrapper( + reset.confirm, + ) + + +class AsyncResetResourceWithStreamingResponse: + def __init__(self, reset: AsyncResetResource) -> None: + self._reset = reset + + self.create = async_to_streamed_response_wrapper( + reset.create, + ) + self.confirm = async_to_streamed_response_wrapper( + reset.confirm, + ) diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py b/src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py new file mode 100644 index 0000000..920dcd8 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .qr import ( + QrResource, + AsyncQrResource, + QrResourceWithRawResponse, + AsyncQrResourceWithRawResponse, + QrResourceWithStreamingResponse, + AsyncQrResourceWithStreamingResponse, +) +from .sas import ( + SasResource, + AsyncSasResource, + SasResourceWithRawResponse, + AsyncSasResourceWithRawResponse, + SasResourceWithStreamingResponse, + AsyncSasResourceWithStreamingResponse, +) +from .verification import ( + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, +) + +__all__ = [ + "QrResource", + "AsyncQrResource", + "QrResourceWithRawResponse", + "AsyncQrResourceWithRawResponse", + "QrResourceWithStreamingResponse", + "AsyncQrResourceWithStreamingResponse", + "SasResource", + "AsyncSasResource", + "SasResourceWithRawResponse", + "AsyncSasResourceWithRawResponse", + "SasResourceWithStreamingResponse", + "AsyncSasResourceWithStreamingResponse", + "VerificationResource", + "AsyncVerificationResource", + "VerificationResourceWithRawResponse", + "AsyncVerificationResourceWithRawResponse", + "VerificationResourceWithStreamingResponse", + "AsyncVerificationResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/qr.py b/src/beeper_desktop_api/resources/app/e2ee/verification/qr.py new file mode 100644 index 0000000..a501c23 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/verification/qr.py @@ -0,0 +1,258 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._utils import path_template, 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.app.e2ee.verification import qr_scan_params +from .....types.app.e2ee.verification.qr_scan_response import QrScanResponse +from .....types.app.e2ee.verification.qr_confirm_scanned_response import QrConfirmScannedResponse + +__all__ = ["QrResource", "AsyncQrResource"] + + +class QrResource(SyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def with_raw_response(self) -> QrResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return QrResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> QrResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return QrResourceWithStreamingResponse(self) + + def confirm_scanned( + self, + verification_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, + ) -> QrConfirmScannedResponse: + """ + Confirm that another device scanned this device QR code. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template( + "/v1/app/e2ee/verification/{verification_id}/qr/confirm-scanned", verification_id=verification_id + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrConfirmScannedResponse, + ) + + def scan( + self, + *, + data: 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, + ) -> QrScanResponse: + """ + Submit the QR code scanned from another signed-in device. + + Args: + data: QR code payload scanned from the other device. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/verification/qr/scan", + body=maybe_transform({"data": data}, qr_scan_params.QrScanParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrScanResponse, + ) + + +class AsyncQrResource(AsyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def with_raw_response(self) -> AsyncQrResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncQrResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncQrResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncQrResourceWithStreamingResponse(self) + + async def confirm_scanned( + self, + verification_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, + ) -> QrConfirmScannedResponse: + """ + Confirm that another device scanned this device QR code. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template( + "/v1/app/e2ee/verification/{verification_id}/qr/confirm-scanned", verification_id=verification_id + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrConfirmScannedResponse, + ) + + async def scan( + self, + *, + data: 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, + ) -> QrScanResponse: + """ + Submit the QR code scanned from another signed-in device. + + Args: + data: QR code payload scanned from the other device. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/verification/qr/scan", + body=await async_maybe_transform({"data": data}, qr_scan_params.QrScanParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrScanResponse, + ) + + +class QrResourceWithRawResponse: + def __init__(self, qr: QrResource) -> None: + self._qr = qr + + self.confirm_scanned = to_raw_response_wrapper( + qr.confirm_scanned, + ) + self.scan = to_raw_response_wrapper( + qr.scan, + ) + + +class AsyncQrResourceWithRawResponse: + def __init__(self, qr: AsyncQrResource) -> None: + self._qr = qr + + self.confirm_scanned = async_to_raw_response_wrapper( + qr.confirm_scanned, + ) + self.scan = async_to_raw_response_wrapper( + qr.scan, + ) + + +class QrResourceWithStreamingResponse: + def __init__(self, qr: QrResource) -> None: + self._qr = qr + + self.confirm_scanned = to_streamed_response_wrapper( + qr.confirm_scanned, + ) + self.scan = to_streamed_response_wrapper( + qr.scan, + ) + + +class AsyncQrResourceWithStreamingResponse: + def __init__(self, qr: AsyncQrResource) -> None: + self._qr = qr + + self.confirm_scanned = async_to_streamed_response_wrapper( + qr.confirm_scanned, + ) + self.scan = async_to_streamed_response_wrapper( + qr.scan, + ) diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/sas.py b/src/beeper_desktop_api/resources/app/e2ee/verification/sas.py new file mode 100644 index 0000000..f72cd16 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/verification/sas.py @@ -0,0 +1,255 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._utils import path_template +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.app.e2ee.verification.sa_start_response import SaStartResponse +from .....types.app.e2ee.verification.sa_confirm_response import SaConfirmResponse + +__all__ = ["SasResource", "AsyncSasResource"] + + +class SasResource(SyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def with_raw_response(self) -> SasResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return SasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return SasResourceWithStreamingResponse(self) + + def confirm( + self, + verification_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, + ) -> SaConfirmResponse: + """ + Confirm that the emoji or number sequence matches on both devices. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/sas/confirm", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SaConfirmResponse, + ) + + def start( + self, + verification_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, + ) -> SaStartResponse: + """ + Start emoji comparison for device verification. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/sas/start", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SaStartResponse, + ) + + +class AsyncSasResource(AsyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def with_raw_response(self) -> AsyncSasResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncSasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncSasResourceWithStreamingResponse(self) + + async def confirm( + self, + verification_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, + ) -> SaConfirmResponse: + """ + Confirm that the emoji or number sequence matches on both devices. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/sas/confirm", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SaConfirmResponse, + ) + + async def start( + self, + verification_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, + ) -> SaStartResponse: + """ + Start emoji comparison for device verification. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/sas/start", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SaStartResponse, + ) + + +class SasResourceWithRawResponse: + def __init__(self, sas: SasResource) -> None: + self._sas = sas + + self.confirm = to_raw_response_wrapper( + sas.confirm, + ) + self.start = to_raw_response_wrapper( + sas.start, + ) + + +class AsyncSasResourceWithRawResponse: + def __init__(self, sas: AsyncSasResource) -> None: + self._sas = sas + + self.confirm = async_to_raw_response_wrapper( + sas.confirm, + ) + self.start = async_to_raw_response_wrapper( + sas.start, + ) + + +class SasResourceWithStreamingResponse: + def __init__(self, sas: SasResource) -> None: + self._sas = sas + + self.confirm = to_streamed_response_wrapper( + sas.confirm, + ) + self.start = to_streamed_response_wrapper( + sas.start, + ) + + +class AsyncSasResourceWithStreamingResponse: + def __init__(self, sas: AsyncSasResource) -> None: + self._sas = sas + + self.confirm = async_to_streamed_response_wrapper( + sas.confirm, + ) + self.start = async_to_streamed_response_wrapper( + sas.start, + ) diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/verification.py b/src/beeper_desktop_api/resources/app/e2ee/verification/verification.py new file mode 100644 index 0000000..589e07f --- /dev/null +++ b/src/beeper_desktop_api/resources/app/e2ee/verification/verification.py @@ -0,0 +1,439 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .qr import ( + QrResource, + AsyncQrResource, + QrResourceWithRawResponse, + AsyncQrResourceWithRawResponse, + QrResourceWithStreamingResponse, + AsyncQrResourceWithStreamingResponse, +) +from .sas import ( + SasResource, + AsyncSasResource, + SasResourceWithRawResponse, + AsyncSasResourceWithRawResponse, + SasResourceWithStreamingResponse, + AsyncSasResourceWithStreamingResponse, +) +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import path_template, maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.app.e2ee import verification_cancel_params, verification_create_params +from .....types.app.e2ee.verification_accept_response import VerificationAcceptResponse +from .....types.app.e2ee.verification_cancel_response import VerificationCancelResponse +from .....types.app.e2ee.verification_create_response import VerificationCreateResponse + +__all__ = ["VerificationResource", "AsyncVerificationResource"] + + +class VerificationResource(SyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def qr(self) -> QrResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return QrResource(self._client) + + @cached_property + def sas(self) -> SasResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return SasResource(self._client) + + @cached_property + def with_raw_response(self) -> VerificationResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return VerificationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VerificationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return VerificationResourceWithStreamingResponse(self) + + def create( + self, + *, + user_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> VerificationCreateResponse: + """ + Start verifying this device from another signed-in device. + + Args: + user_id: User ID to verify. Defaults to the signed-in user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/verification", + body=maybe_transform({"user_id": user_id}, verification_create_params.VerificationCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCreateResponse, + ) + + def accept( + self, + verification_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, + ) -> VerificationAcceptResponse: + """ + Accept an incoming device verification request. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/accept", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationAcceptResponse, + ) + + def cancel( + self, + verification_id: str, + *, + code: str | Omit = omit, + reason: 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, + ) -> VerificationCancelResponse: + """ + Cancel an active device verification request. + + Args: + verification_id: Verification ID. + + code: Optional cancellation code. + + reason: Optional user-facing cancellation reason. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/cancel", verification_id=verification_id), + body=maybe_transform( + { + "code": code, + "reason": reason, + }, + verification_cancel_params.VerificationCancelParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCancelResponse, + ) + + +class AsyncVerificationResource(AsyncAPIResource): + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + + @cached_property + def qr(self) -> AsyncQrResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncQrResource(self._client) + + @cached_property + def sas(self) -> AsyncSasResource: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncSasResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncVerificationResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncVerificationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVerificationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncVerificationResourceWithStreamingResponse(self) + + async def create( + self, + *, + user_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> VerificationCreateResponse: + """ + Start verifying this device from another signed-in device. + + Args: + user_id: User ID to verify. Defaults to the signed-in user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/e2ee/verification", + body=await async_maybe_transform({"user_id": user_id}, verification_create_params.VerificationCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCreateResponse, + ) + + async def accept( + self, + verification_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, + ) -> VerificationAcceptResponse: + """ + Accept an incoming device verification request. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/accept", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationAcceptResponse, + ) + + async def cancel( + self, + verification_id: str, + *, + code: str | Omit = omit, + reason: 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, + ) -> VerificationCancelResponse: + """ + Cancel an active device verification request. + + Args: + verification_id: Verification ID. + + code: Optional cancellation code. + + reason: Optional user-facing cancellation reason. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/e2ee/verification/{verification_id}/cancel", verification_id=verification_id), + body=await async_maybe_transform( + { + "code": code, + "reason": reason, + }, + verification_cancel_params.VerificationCancelParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCancelResponse, + ) + + +class VerificationResourceWithRawResponse: + def __init__(self, verification: VerificationResource) -> None: + self._verification = verification + + self.create = to_raw_response_wrapper( + verification.create, + ) + self.accept = to_raw_response_wrapper( + verification.accept, + ) + self.cancel = to_raw_response_wrapper( + verification.cancel, + ) + + @cached_property + def qr(self) -> QrResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return QrResourceWithRawResponse(self._verification.qr) + + @cached_property + def sas(self) -> SasResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return SasResourceWithRawResponse(self._verification.sas) + + +class AsyncVerificationResourceWithRawResponse: + def __init__(self, verification: AsyncVerificationResource) -> None: + self._verification = verification + + self.create = async_to_raw_response_wrapper( + verification.create, + ) + self.accept = async_to_raw_response_wrapper( + verification.accept, + ) + self.cancel = async_to_raw_response_wrapper( + verification.cancel, + ) + + @cached_property + def qr(self) -> AsyncQrResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncQrResourceWithRawResponse(self._verification.qr) + + @cached_property + def sas(self) -> AsyncSasResourceWithRawResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncSasResourceWithRawResponse(self._verification.sas) + + +class VerificationResourceWithStreamingResponse: + def __init__(self, verification: VerificationResource) -> None: + self._verification = verification + + self.create = to_streamed_response_wrapper( + verification.create, + ) + self.accept = to_streamed_response_wrapper( + verification.accept, + ) + self.cancel = to_streamed_response_wrapper( + verification.cancel, + ) + + @cached_property + def qr(self) -> QrResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return QrResourceWithStreamingResponse(self._verification.qr) + + @cached_property + def sas(self) -> SasResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return SasResourceWithStreamingResponse(self._verification.sas) + + +class AsyncVerificationResourceWithStreamingResponse: + def __init__(self, verification: AsyncVerificationResource) -> None: + self._verification = verification + + self.create = async_to_streamed_response_wrapper( + verification.create, + ) + self.accept = async_to_streamed_response_wrapper( + verification.accept, + ) + self.cancel = async_to_streamed_response_wrapper( + verification.cancel, + ) + + @cached_property + def qr(self) -> AsyncQrResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncQrResourceWithStreamingResponse(self._verification.qr) + + @cached_property + def sas(self) -> AsyncSasResourceWithStreamingResponse: + """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" + return AsyncSasResourceWithStreamingResponse(self._verification.sas) diff --git a/src/beeper_desktop_api/resources/app/login.py b/src/beeper_desktop_api/resources/app/login.py new file mode 100644 index 0000000..e67ff28 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login.py @@ -0,0 +1,508 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, cast +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, 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 ...types.app import login_email_params, login_register_params, login_response_params +from ..._base_client import make_request_options +from ...types.app.login_start_response import LoginStartResponse +from ...types.app.login_register_response import LoginRegisterResponse +from ...types.app.login_response_response import LoginResponseResponse + +__all__ = ["LoginResource", "AsyncLoginResource"] + + +class LoginResource(SyncAPIResource): + """Complete first-party Beeper app login""" + + @cached_property + def with_raw_response(self) -> LoginResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return LoginResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LoginResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return LoginResourceWithStreamingResponse(self) + + def email( + self, + *, + email: str, + request: 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, + ) -> object: + """ + Send a sign-in code to the user email address. + + Args: + email: Email address to send the sign-in code to. + + request: Login request ID returned by the start step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/login/email", + body=maybe_transform( + { + "email": email, + "request": request, + }, + login_email_params.LoginEmailParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=object, + ) + + def register( + self, + *, + accept_terms: Literal[True], + lead_token: str, + request: str, + username: 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, + ) -> LoginRegisterResponse: + """ + Create a Beeper account after the user chooses a username and accepts the Terms + of Use. + + Args: + accept_terms: Confirms that the user accepted the Terms of Use and acknowledged the Privacy + Policy. + + lead_token: Registration token returned by Beeper. + + request: Login request ID returned by the start step. + + username: Username selected by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/login/register", + body=maybe_transform( + { + "accept_terms": accept_terms, + "lead_token": lead_token, + "request": request, + "username": username, + }, + login_register_params.LoginRegisterParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginRegisterResponse, + ) + + def response( + self, + *, + request: str, + response: 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, + ) -> LoginResponseResponse: + """Finish sign-in with the code sent to the user email address. + + If the user needs a + new account, the response includes account creation copy and username + suggestions. + + Args: + request: Login request ID returned by the start step. + + response: Sign-in code from the user email. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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 cast( + LoginResponseResponse, + self._post( + "/v1/app/login/response", + body=maybe_transform( + { + "request": request, + "response": response, + }, + login_response_params.LoginResponseParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=cast( + Any, LoginResponseResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def start( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginStartResponse: + """Start a first-party Beeper Desktop sign-in session.""" + return self._post( + "/v1/app/login/start", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginStartResponse, + ) + + +class AsyncLoginResource(AsyncAPIResource): + """Complete first-party Beeper app login""" + + @cached_property + def with_raw_response(self) -> AsyncLoginResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncLoginResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLoginResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncLoginResourceWithStreamingResponse(self) + + async def email( + self, + *, + email: str, + request: 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, + ) -> object: + """ + Send a sign-in code to the user email address. + + Args: + email: Email address to send the sign-in code to. + + request: Login request ID returned by the start step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/login/email", + body=await async_maybe_transform( + { + "email": email, + "request": request, + }, + login_email_params.LoginEmailParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=object, + ) + + async def register( + self, + *, + accept_terms: Literal[True], + lead_token: str, + request: str, + username: 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, + ) -> LoginRegisterResponse: + """ + Create a Beeper account after the user chooses a username and accepts the Terms + of Use. + + Args: + accept_terms: Confirms that the user accepted the Terms of Use and acknowledged the Privacy + Policy. + + lead_token: Registration token returned by Beeper. + + request: Login request ID returned by the start step. + + username: Username selected by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/login/register", + body=await async_maybe_transform( + { + "accept_terms": accept_terms, + "lead_token": lead_token, + "request": request, + "username": username, + }, + login_register_params.LoginRegisterParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginRegisterResponse, + ) + + async def response( + self, + *, + request: str, + response: 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, + ) -> LoginResponseResponse: + """Finish sign-in with the code sent to the user email address. + + If the user needs a + new account, the response includes account creation copy and username + suggestions. + + Args: + request: Login request ID returned by the start step. + + response: Sign-in code from the user email. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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 cast( + LoginResponseResponse, + await self._post( + "/v1/app/login/response", + body=await async_maybe_transform( + { + "request": request, + "response": response, + }, + login_response_params.LoginResponseParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=cast( + Any, LoginResponseResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def start( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginStartResponse: + """Start a first-party Beeper Desktop sign-in session.""" + return await self._post( + "/v1/app/login/start", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginStartResponse, + ) + + +class LoginResourceWithRawResponse: + def __init__(self, login: LoginResource) -> None: + self._login = login + + self.email = to_raw_response_wrapper( + login.email, + ) + self.register = to_raw_response_wrapper( + login.register, + ) + self.response = to_raw_response_wrapper( + login.response, + ) + self.start = to_raw_response_wrapper( + login.start, + ) + + +class AsyncLoginResourceWithRawResponse: + def __init__(self, login: AsyncLoginResource) -> None: + self._login = login + + self.email = async_to_raw_response_wrapper( + login.email, + ) + self.register = async_to_raw_response_wrapper( + login.register, + ) + self.response = async_to_raw_response_wrapper( + login.response, + ) + self.start = async_to_raw_response_wrapper( + login.start, + ) + + +class LoginResourceWithStreamingResponse: + def __init__(self, login: LoginResource) -> None: + self._login = login + + self.email = to_streamed_response_wrapper( + login.email, + ) + self.register = to_streamed_response_wrapper( + login.register, + ) + self.response = to_streamed_response_wrapper( + login.response, + ) + self.start = to_streamed_response_wrapper( + login.start, + ) + + +class AsyncLoginResourceWithStreamingResponse: + def __init__(self, login: AsyncLoginResource) -> None: + self._login = login + + self.email = async_to_streamed_response_wrapper( + login.email, + ) + self.register = async_to_streamed_response_wrapper( + login.register, + ) + self.response = async_to_streamed_response_wrapper( + login.response, + ) + self.start = async_to_streamed_response_wrapper( + login.start, + ) diff --git a/src/beeper_desktop_api/resources/bridges.py b/src/beeper_desktop_api/resources/bridges.py new file mode 100644 index 0000000..1d9e25a --- /dev/null +++ b/src/beeper_desktop_api/resources/bridges.py @@ -0,0 +1,145 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import Body, Query, Headers, NotGiven, not_given +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.bridge_list_response import BridgeListResponse + +__all__ = ["BridgesResource", "AsyncBridgesResource"] + + +class BridgesResource(SyncAPIResource): + """Manage bridge-backed account types and account availability""" + + @cached_property + def with_raw_response(self) -> BridgesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return BridgesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BridgesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return BridgesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BridgeListResponse: + """ + List bridge-backed account types that can be shown in add-account flows, grouped + with connected accounts that use the same Account schema as GET /v1/accounts. + """ + return self._get( + "/v1/bridges", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BridgeListResponse, + ) + + +class AsyncBridgesResource(AsyncAPIResource): + """Manage bridge-backed account types and account availability""" + + @cached_property + def with_raw_response(self) -> AsyncBridgesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncBridgesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBridgesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncBridgesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BridgeListResponse: + """ + List bridge-backed account types that can be shown in add-account flows, grouped + with connected accounts that use the same Account schema as GET /v1/accounts. + """ + return await self._get( + "/v1/bridges", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BridgeListResponse, + ) + + +class BridgesResourceWithRawResponse: + def __init__(self, bridges: BridgesResource) -> None: + self._bridges = bridges + + self.list = to_raw_response_wrapper( + bridges.list, + ) + + +class AsyncBridgesResourceWithRawResponse: + def __init__(self, bridges: AsyncBridgesResource) -> None: + self._bridges = bridges + + self.list = async_to_raw_response_wrapper( + bridges.list, + ) + + +class BridgesResourceWithStreamingResponse: + def __init__(self, bridges: BridgesResource) -> None: + self._bridges = bridges + + self.list = to_streamed_response_wrapper( + bridges.list, + ) + + +class AsyncBridgesResourceWithStreamingResponse: + def __init__(self, bridges: AsyncBridgesResource) -> None: + self._bridges = bridges + + self.list = async_to_streamed_response_wrapper( + bridges.list, + ) diff --git a/src/beeper_desktop_api/resources/matrix/__init__.py b/src/beeper_desktop_api/resources/matrix/__init__.py new file mode 100644 index 0000000..7d5901f --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rooms import ( + RoomsResource, + AsyncRoomsResource, + RoomsResourceWithRawResponse, + AsyncRoomsResourceWithRawResponse, + RoomsResourceWithStreamingResponse, + AsyncRoomsResourceWithStreamingResponse, +) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .matrix import ( + MatrixResource, + AsyncMatrixResource, + MatrixResourceWithRawResponse, + AsyncMatrixResourceWithRawResponse, + MatrixResourceWithStreamingResponse, + AsyncMatrixResourceWithStreamingResponse, +) +from .bridges import ( + BridgesResource, + AsyncBridgesResource, + BridgesResourceWithRawResponse, + AsyncBridgesResourceWithRawResponse, + BridgesResourceWithStreamingResponse, + AsyncBridgesResourceWithStreamingResponse, +) + +__all__ = [ + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", + "RoomsResource", + "AsyncRoomsResource", + "RoomsResourceWithRawResponse", + "AsyncRoomsResourceWithRawResponse", + "RoomsResourceWithStreamingResponse", + "AsyncRoomsResourceWithStreamingResponse", + "BridgesResource", + "AsyncBridgesResource", + "BridgesResourceWithRawResponse", + "AsyncBridgesResourceWithRawResponse", + "BridgesResourceWithStreamingResponse", + "AsyncBridgesResourceWithStreamingResponse", + "MatrixResource", + "AsyncMatrixResource", + "MatrixResourceWithRawResponse", + "AsyncMatrixResourceWithRawResponse", + "MatrixResourceWithStreamingResponse", + "AsyncMatrixResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/matrix/bridges/__init__.py b/src/beeper_desktop_api/resources/matrix/bridges/__init__.py new file mode 100644 index 0000000..e25079a --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/bridges/__init__.py @@ -0,0 +1,89 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .auth import ( + AuthResource, + AsyncAuthResource, + AuthResourceWithRawResponse, + AsyncAuthResourceWithRawResponse, + AuthResourceWithStreamingResponse, + AsyncAuthResourceWithStreamingResponse, +) +from .rooms import ( + RoomsResource, + AsyncRoomsResource, + RoomsResourceWithRawResponse, + AsyncRoomsResourceWithRawResponse, + RoomsResourceWithStreamingResponse, + AsyncRoomsResourceWithStreamingResponse, +) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .bridges import ( + BridgesResource, + AsyncBridgesResource, + BridgesResourceWithRawResponse, + AsyncBridgesResourceWithRawResponse, + BridgesResourceWithStreamingResponse, + AsyncBridgesResourceWithStreamingResponse, +) +from .contacts import ( + ContactsResource, + AsyncContactsResource, + ContactsResourceWithRawResponse, + AsyncContactsResourceWithRawResponse, + ContactsResourceWithStreamingResponse, + AsyncContactsResourceWithStreamingResponse, +) +from .capabilities import ( + CapabilitiesResource, + AsyncCapabilitiesResource, + CapabilitiesResourceWithRawResponse, + AsyncCapabilitiesResourceWithRawResponse, + CapabilitiesResourceWithStreamingResponse, + AsyncCapabilitiesResourceWithStreamingResponse, +) + +__all__ = [ + "AuthResource", + "AsyncAuthResource", + "AuthResourceWithRawResponse", + "AsyncAuthResourceWithRawResponse", + "AuthResourceWithStreamingResponse", + "AsyncAuthResourceWithStreamingResponse", + "ContactsResource", + "AsyncContactsResource", + "ContactsResourceWithRawResponse", + "AsyncContactsResourceWithRawResponse", + "ContactsResourceWithStreamingResponse", + "AsyncContactsResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", + "RoomsResource", + "AsyncRoomsResource", + "RoomsResourceWithRawResponse", + "AsyncRoomsResourceWithRawResponse", + "RoomsResourceWithStreamingResponse", + "AsyncRoomsResourceWithStreamingResponse", + "CapabilitiesResource", + "AsyncCapabilitiesResource", + "CapabilitiesResourceWithRawResponse", + "AsyncCapabilitiesResourceWithRawResponse", + "CapabilitiesResourceWithStreamingResponse", + "AsyncCapabilitiesResourceWithStreamingResponse", + "BridgesResource", + "AsyncBridgesResource", + "BridgesResourceWithRawResponse", + "AsyncBridgesResourceWithRawResponse", + "BridgesResourceWithStreamingResponse", + "AsyncBridgesResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/matrix/bridges/auth.py b/src/beeper_desktop_api/resources/matrix/bridges/auth.py new file mode 100644 index 0000000..b05ee19 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/bridges/auth.py @@ -0,0 +1,951 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, Dict, cast + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.matrix.bridges import auth_start_login_params, auth_submit_cookies_params, auth_submit_user_input_params +from ....types.matrix.bridges.auth_whoami_response import AuthWhoamiResponse +from ....types.matrix.bridges.auth_list_flows_response import AuthListFlowsResponse +from ....types.matrix.bridges.auth_list_logins_response import AuthListLoginsResponse +from ....types.matrix.bridges.auth_start_login_response import AuthStartLoginResponse +from ....types.matrix.bridges.auth_wait_for_step_response import AuthWaitForStepResponse +from ....types.matrix.bridges.auth_submit_cookies_response import AuthSubmitCookiesResponse +from ....types.matrix.bridges.auth_submit_user_input_response import AuthSubmitUserInputResponse + +__all__ = ["AuthResource", "AsyncAuthResource"] + + +class AuthResource(SyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> AuthResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AuthResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AuthResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AuthResourceWithStreamingResponse(self) + + def list_flows( + self, + bridge_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, + ) -> AuthListFlowsResponse: + """ + Get the available login flows. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/flows", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthListFlowsResponse, + ) + + def list_logins( + self, + bridge_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, + ) -> AuthListLoginsResponse: + """ + Get the login IDs of the current user. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logins", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthListLoginsResponse, + ) + + def logout( + self, + login_id: str, + *, + bridge_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, + ) -> object: + """Log out of an existing login. + + Args: + login_id: The unique ID of a login. + + Defined by the network connector. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_id: + raise ValueError(f"Expected a non-empty value for `login_id` but received {login_id!r}") + return self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logout/{login_id}", + bridge_id=bridge_id, + login_id=login_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def start_login( + self, + flow_id: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AuthStartLoginResponse: + """ + This endpoint starts a new login process, which is used to log into the bridge. + + The basic flow of the entire login, including calling this endpoint, is: + + 1. Call `GET /v3/login/flows` to get the list of available flows. If there's + more than one flow, ask the user to pick which one they want to use. + 2. Call this endpoint with the chosen flow ID to start the login. The first + login step will be returned. + 3. Render the information provided in the step. + 4. Call the `/login/step/...` endpoint corresponding to the step type: + - For `user_input` and `cookies`, acquire the requested fields before calling + the endpoint. + - For `display_and_wait`, call the endpoint immediately (as there's nothing + to acquire on the client side). + 5. Handle the data returned by the login step endpoint: + - If an error is returned, the login has failed and must be restarted (from + either step 1 or step 2) if the user wants to try again. + - If step type `complete` is returned, the login finished successfully. + - Otherwise, go to step 3 with the new data. + + Args: + login_id: An existing login ID to re-login as. If this is specified and the user logs into + a different account, the provided ID will be logged out. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return cast( + AuthStartLoginResponse, + self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/start/{flow_id}", + bridge_id=bridge_id, + flow_id=flow_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"login_id": login_id}, auth_start_login_params.AuthStartLoginParams), + ), + cast_to=cast( + Any, AuthStartLoginResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def submit_cookies( + self, + step_id: str, + *, + bridge_id: str, + login_process_id: str, + body: Dict[str, 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, + ) -> AuthSubmitCookiesResponse: + """ + Submit extracted cookies in a login process. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_process_id: + raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return cast( + AuthSubmitCookiesResponse, + self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/cookies", + bridge_id=bridge_id, + login_process_id=login_process_id, + step_id=step_id, + ), + body=maybe_transform(body, auth_submit_cookies_params.AuthSubmitCookiesParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast( + Any, AuthSubmitCookiesResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def submit_user_input( + self, + step_id: str, + *, + bridge_id: str, + login_process_id: str, + body: Dict[str, 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, + ) -> AuthSubmitUserInputResponse: + """ + Submit user input in a login process. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_process_id: + raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return cast( + AuthSubmitUserInputResponse, + self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/user_input", + bridge_id=bridge_id, + login_process_id=login_process_id, + step_id=step_id, + ), + body=maybe_transform(body, auth_submit_user_input_params.AuthSubmitUserInputParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast( + Any, AuthSubmitUserInputResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def wait_for_step( + self, + step_id: str, + *, + bridge_id: str, + login_process_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, + ) -> AuthWaitForStepResponse: + """ + Wait for the next step after displaying data to the user. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_process_id: + raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return cast( + AuthWaitForStepResponse, + self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/display_and_wait", + bridge_id=bridge_id, + login_process_id=login_process_id, + step_id=step_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast( + Any, AuthWaitForStepResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def whoami( + self, + bridge_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, + ) -> AuthWhoamiResponse: + """ + Get all info that is useful for presenting this bridge in a manager interface. + + - Server details: remote network details, available login flows, homeserver + name, bridge bot user ID, command prefix + - User details: management room ID, list of logins with current state and info + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/whoami", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthWhoamiResponse, + ) + + +class AsyncAuthResource(AsyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> AsyncAuthResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncAuthResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAuthResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncAuthResourceWithStreamingResponse(self) + + async def list_flows( + self, + bridge_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, + ) -> AuthListFlowsResponse: + """ + Get the available login flows. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/flows", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthListFlowsResponse, + ) + + async def list_logins( + self, + bridge_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, + ) -> AuthListLoginsResponse: + """ + Get the login IDs of the current user. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logins", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthListLoginsResponse, + ) + + async def logout( + self, + login_id: str, + *, + bridge_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, + ) -> object: + """Log out of an existing login. + + Args: + login_id: The unique ID of a login. + + Defined by the network connector. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_id: + raise ValueError(f"Expected a non-empty value for `login_id` but received {login_id!r}") + return await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logout/{login_id}", + bridge_id=bridge_id, + login_id=login_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def start_login( + self, + flow_id: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AuthStartLoginResponse: + """ + This endpoint starts a new login process, which is used to log into the bridge. + + The basic flow of the entire login, including calling this endpoint, is: + + 1. Call `GET /v3/login/flows` to get the list of available flows. If there's + more than one flow, ask the user to pick which one they want to use. + 2. Call this endpoint with the chosen flow ID to start the login. The first + login step will be returned. + 3. Render the information provided in the step. + 4. Call the `/login/step/...` endpoint corresponding to the step type: + - For `user_input` and `cookies`, acquire the requested fields before calling + the endpoint. + - For `display_and_wait`, call the endpoint immediately (as there's nothing + to acquire on the client side). + 5. Handle the data returned by the login step endpoint: + - If an error is returned, the login has failed and must be restarted (from + either step 1 or step 2) if the user wants to try again. + - If step type `complete` is returned, the login finished successfully. + - Otherwise, go to step 3 with the new data. + + Args: + login_id: An existing login ID to re-login as. If this is specified and the user logs into + a different account, the provided ID will be logged out. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not flow_id: + raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") + return cast( + AuthStartLoginResponse, + await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/start/{flow_id}", + bridge_id=bridge_id, + flow_id=flow_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"login_id": login_id}, auth_start_login_params.AuthStartLoginParams + ), + ), + cast_to=cast( + Any, AuthStartLoginResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def submit_cookies( + self, + step_id: str, + *, + bridge_id: str, + login_process_id: str, + body: Dict[str, 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, + ) -> AuthSubmitCookiesResponse: + """ + Submit extracted cookies in a login process. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_process_id: + raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return cast( + AuthSubmitCookiesResponse, + await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/cookies", + bridge_id=bridge_id, + login_process_id=login_process_id, + step_id=step_id, + ), + body=await async_maybe_transform(body, auth_submit_cookies_params.AuthSubmitCookiesParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast( + Any, AuthSubmitCookiesResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def submit_user_input( + self, + step_id: str, + *, + bridge_id: str, + login_process_id: str, + body: Dict[str, 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, + ) -> AuthSubmitUserInputResponse: + """ + Submit user input in a login process. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_process_id: + raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return cast( + AuthSubmitUserInputResponse, + await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/user_input", + bridge_id=bridge_id, + login_process_id=login_process_id, + step_id=step_id, + ), + body=await async_maybe_transform(body, auth_submit_user_input_params.AuthSubmitUserInputParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast( + Any, AuthSubmitUserInputResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def wait_for_step( + self, + step_id: str, + *, + bridge_id: str, + login_process_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, + ) -> AuthWaitForStepResponse: + """ + Wait for the next step after displaying data to the user. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_process_id: + raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return cast( + AuthWaitForStepResponse, + await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/display_and_wait", + bridge_id=bridge_id, + login_process_id=login_process_id, + step_id=step_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast( + Any, AuthWaitForStepResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def whoami( + self, + bridge_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, + ) -> AuthWhoamiResponse: + """ + Get all info that is useful for presenting this bridge in a manager interface. + + - Server details: remote network details, available login flows, homeserver + name, bridge bot user ID, command prefix + - User details: management room ID, list of logins with current state and info + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/whoami", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AuthWhoamiResponse, + ) + + +class AuthResourceWithRawResponse: + def __init__(self, auth: AuthResource) -> None: + self._auth = auth + + self.list_flows = to_raw_response_wrapper( + auth.list_flows, + ) + self.list_logins = to_raw_response_wrapper( + auth.list_logins, + ) + self.logout = to_raw_response_wrapper( + auth.logout, + ) + self.start_login = to_raw_response_wrapper( + auth.start_login, + ) + self.submit_cookies = to_raw_response_wrapper( + auth.submit_cookies, + ) + self.submit_user_input = to_raw_response_wrapper( + auth.submit_user_input, + ) + self.wait_for_step = to_raw_response_wrapper( + auth.wait_for_step, + ) + self.whoami = to_raw_response_wrapper( + auth.whoami, + ) + + +class AsyncAuthResourceWithRawResponse: + def __init__(self, auth: AsyncAuthResource) -> None: + self._auth = auth + + self.list_flows = async_to_raw_response_wrapper( + auth.list_flows, + ) + self.list_logins = async_to_raw_response_wrapper( + auth.list_logins, + ) + self.logout = async_to_raw_response_wrapper( + auth.logout, + ) + self.start_login = async_to_raw_response_wrapper( + auth.start_login, + ) + self.submit_cookies = async_to_raw_response_wrapper( + auth.submit_cookies, + ) + self.submit_user_input = async_to_raw_response_wrapper( + auth.submit_user_input, + ) + self.wait_for_step = async_to_raw_response_wrapper( + auth.wait_for_step, + ) + self.whoami = async_to_raw_response_wrapper( + auth.whoami, + ) + + +class AuthResourceWithStreamingResponse: + def __init__(self, auth: AuthResource) -> None: + self._auth = auth + + self.list_flows = to_streamed_response_wrapper( + auth.list_flows, + ) + self.list_logins = to_streamed_response_wrapper( + auth.list_logins, + ) + self.logout = to_streamed_response_wrapper( + auth.logout, + ) + self.start_login = to_streamed_response_wrapper( + auth.start_login, + ) + self.submit_cookies = to_streamed_response_wrapper( + auth.submit_cookies, + ) + self.submit_user_input = to_streamed_response_wrapper( + auth.submit_user_input, + ) + self.wait_for_step = to_streamed_response_wrapper( + auth.wait_for_step, + ) + self.whoami = to_streamed_response_wrapper( + auth.whoami, + ) + + +class AsyncAuthResourceWithStreamingResponse: + def __init__(self, auth: AsyncAuthResource) -> None: + self._auth = auth + + self.list_flows = async_to_streamed_response_wrapper( + auth.list_flows, + ) + self.list_logins = async_to_streamed_response_wrapper( + auth.list_logins, + ) + self.logout = async_to_streamed_response_wrapper( + auth.logout, + ) + self.start_login = async_to_streamed_response_wrapper( + auth.start_login, + ) + self.submit_cookies = async_to_streamed_response_wrapper( + auth.submit_cookies, + ) + self.submit_user_input = async_to_streamed_response_wrapper( + auth.submit_user_input, + ) + self.wait_for_step = async_to_streamed_response_wrapper( + auth.wait_for_step, + ) + self.whoami = async_to_streamed_response_wrapper( + auth.whoami, + ) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/bridges.py b/src/beeper_desktop_api/resources/matrix/bridges/bridges.py new file mode 100644 index 0000000..f2922c9 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/bridges/bridges.py @@ -0,0 +1,264 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .auth import ( + AuthResource, + AsyncAuthResource, + AuthResourceWithRawResponse, + AsyncAuthResourceWithRawResponse, + AuthResourceWithStreamingResponse, + AsyncAuthResourceWithStreamingResponse, +) +from .rooms import ( + RoomsResource, + AsyncRoomsResource, + RoomsResourceWithRawResponse, + AsyncRoomsResourceWithRawResponse, + RoomsResourceWithStreamingResponse, + AsyncRoomsResourceWithStreamingResponse, +) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .contacts import ( + ContactsResource, + AsyncContactsResource, + ContactsResourceWithRawResponse, + AsyncContactsResourceWithRawResponse, + ContactsResourceWithStreamingResponse, + AsyncContactsResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .capabilities import ( + CapabilitiesResource, + AsyncCapabilitiesResource, + CapabilitiesResourceWithRawResponse, + AsyncCapabilitiesResourceWithRawResponse, + CapabilitiesResourceWithStreamingResponse, + AsyncCapabilitiesResourceWithStreamingResponse, +) + +__all__ = ["BridgesResource", "AsyncBridgesResource"] + + +class BridgesResource(SyncAPIResource): + """Matrix-compatible APIs for connected network bridges.""" + + @cached_property + def auth(self) -> AuthResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AuthResource(self._client) + + @cached_property + def contacts(self) -> ContactsResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return ContactsResource(self._client) + + @cached_property + def users(self) -> UsersResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return UsersResource(self._client) + + @cached_property + def rooms(self) -> RoomsResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return RoomsResource(self._client) + + @cached_property + def capabilities(self) -> CapabilitiesResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return CapabilitiesResource(self._client) + + @cached_property + def with_raw_response(self) -> BridgesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return BridgesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BridgesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return BridgesResourceWithStreamingResponse(self) + + +class AsyncBridgesResource(AsyncAPIResource): + """Matrix-compatible APIs for connected network bridges.""" + + @cached_property + def auth(self) -> AsyncAuthResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncAuthResource(self._client) + + @cached_property + def contacts(self) -> AsyncContactsResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncContactsResource(self._client) + + @cached_property + def users(self) -> AsyncUsersResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncUsersResource(self._client) + + @cached_property + def rooms(self) -> AsyncRoomsResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncRoomsResource(self._client) + + @cached_property + def capabilities(self) -> AsyncCapabilitiesResource: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncCapabilitiesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncBridgesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncBridgesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBridgesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncBridgesResourceWithStreamingResponse(self) + + +class BridgesResourceWithRawResponse: + def __init__(self, bridges: BridgesResource) -> None: + self._bridges = bridges + + @cached_property + def auth(self) -> AuthResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AuthResourceWithRawResponse(self._bridges.auth) + + @cached_property + def contacts(self) -> ContactsResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return ContactsResourceWithRawResponse(self._bridges.contacts) + + @cached_property + def users(self) -> UsersResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return UsersResourceWithRawResponse(self._bridges.users) + + @cached_property + def rooms(self) -> RoomsResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return RoomsResourceWithRawResponse(self._bridges.rooms) + + @cached_property + def capabilities(self) -> CapabilitiesResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return CapabilitiesResourceWithRawResponse(self._bridges.capabilities) + + +class AsyncBridgesResourceWithRawResponse: + def __init__(self, bridges: AsyncBridgesResource) -> None: + self._bridges = bridges + + @cached_property + def auth(self) -> AsyncAuthResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncAuthResourceWithRawResponse(self._bridges.auth) + + @cached_property + def contacts(self) -> AsyncContactsResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncContactsResourceWithRawResponse(self._bridges.contacts) + + @cached_property + def users(self) -> AsyncUsersResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncUsersResourceWithRawResponse(self._bridges.users) + + @cached_property + def rooms(self) -> AsyncRoomsResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncRoomsResourceWithRawResponse(self._bridges.rooms) + + @cached_property + def capabilities(self) -> AsyncCapabilitiesResourceWithRawResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncCapabilitiesResourceWithRawResponse(self._bridges.capabilities) + + +class BridgesResourceWithStreamingResponse: + def __init__(self, bridges: BridgesResource) -> None: + self._bridges = bridges + + @cached_property + def auth(self) -> AuthResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AuthResourceWithStreamingResponse(self._bridges.auth) + + @cached_property + def contacts(self) -> ContactsResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return ContactsResourceWithStreamingResponse(self._bridges.contacts) + + @cached_property + def users(self) -> UsersResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return UsersResourceWithStreamingResponse(self._bridges.users) + + @cached_property + def rooms(self) -> RoomsResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return RoomsResourceWithStreamingResponse(self._bridges.rooms) + + @cached_property + def capabilities(self) -> CapabilitiesResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return CapabilitiesResourceWithStreamingResponse(self._bridges.capabilities) + + +class AsyncBridgesResourceWithStreamingResponse: + def __init__(self, bridges: AsyncBridgesResource) -> None: + self._bridges = bridges + + @cached_property + def auth(self) -> AsyncAuthResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncAuthResourceWithStreamingResponse(self._bridges.auth) + + @cached_property + def contacts(self) -> AsyncContactsResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncContactsResourceWithStreamingResponse(self._bridges.contacts) + + @cached_property + def users(self) -> AsyncUsersResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncUsersResourceWithStreamingResponse(self._bridges.users) + + @cached_property + def rooms(self) -> AsyncRoomsResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncRoomsResourceWithStreamingResponse(self._bridges.rooms) + + @cached_property + def capabilities(self) -> AsyncCapabilitiesResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts and connected network bridges.""" + return AsyncCapabilitiesResourceWithStreamingResponse(self._bridges.capabilities) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/capabilities.py b/src/beeper_desktop_api/resources/matrix/bridges/capabilities.py new file mode 100644 index 0000000..48338bc --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/bridges/capabilities.py @@ -0,0 +1,174 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.matrix.bridges.capability_retrieve_response import CapabilityRetrieveResponse + +__all__ = ["CapabilitiesResource", "AsyncCapabilitiesResource"] + + +class CapabilitiesResource(SyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> CapabilitiesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return CapabilitiesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CapabilitiesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return CapabilitiesResourceWithStreamingResponse(self) + + def retrieve( + self, + bridge_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, + ) -> CapabilityRetrieveResponse: + """ + Get bridge capabilities + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/capabilities", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CapabilityRetrieveResponse, + ) + + +class AsyncCapabilitiesResource(AsyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> AsyncCapabilitiesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncCapabilitiesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCapabilitiesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncCapabilitiesResourceWithStreamingResponse(self) + + async def retrieve( + self, + bridge_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, + ) -> CapabilityRetrieveResponse: + """ + Get bridge capabilities + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/capabilities", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CapabilityRetrieveResponse, + ) + + +class CapabilitiesResourceWithRawResponse: + def __init__(self, capabilities: CapabilitiesResource) -> None: + self._capabilities = capabilities + + self.retrieve = to_raw_response_wrapper( + capabilities.retrieve, + ) + + +class AsyncCapabilitiesResourceWithRawResponse: + def __init__(self, capabilities: AsyncCapabilitiesResource) -> None: + self._capabilities = capabilities + + self.retrieve = async_to_raw_response_wrapper( + capabilities.retrieve, + ) + + +class CapabilitiesResourceWithStreamingResponse: + def __init__(self, capabilities: CapabilitiesResource) -> None: + self._capabilities = capabilities + + self.retrieve = to_streamed_response_wrapper( + capabilities.retrieve, + ) + + +class AsyncCapabilitiesResourceWithStreamingResponse: + def __init__(self, capabilities: AsyncCapabilitiesResource) -> None: + self._capabilities = capabilities + + self.retrieve = async_to_streamed_response_wrapper( + capabilities.retrieve, + ) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/contacts.py b/src/beeper_desktop_api/resources/matrix/bridges/contacts.py new file mode 100644 index 0000000..1b7c10b --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/bridges/contacts.py @@ -0,0 +1,189 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.matrix.bridges import contact_list_params +from ....types.matrix.bridges.contact_list_response import ContactListResponse + +__all__ = ["ContactsResource", "AsyncContactsResource"] + + +class ContactsResource(SyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> ContactsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return ContactsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ContactsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return ContactsResourceWithStreamingResponse(self) + + def list( + self, + bridge_id: str, + *, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ContactListResponse: + """ + Get a list of contacts. + + Args: + login_id: An optional explicit login ID to do the action through. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/contacts", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"login_id": login_id}, contact_list_params.ContactListParams), + ), + cast_to=ContactListResponse, + ) + + +class AsyncContactsResource(AsyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> AsyncContactsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncContactsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncContactsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncContactsResourceWithStreamingResponse(self) + + async def list( + self, + bridge_id: str, + *, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ContactListResponse: + """ + Get a list of contacts. + + Args: + login_id: An optional explicit login ID to do the action through. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/contacts", + bridge_id=bridge_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"login_id": login_id}, contact_list_params.ContactListParams), + ), + cast_to=ContactListResponse, + ) + + +class ContactsResourceWithRawResponse: + def __init__(self, contacts: ContactsResource) -> None: + self._contacts = contacts + + self.list = to_raw_response_wrapper( + contacts.list, + ) + + +class AsyncContactsResourceWithRawResponse: + def __init__(self, contacts: AsyncContactsResource) -> None: + self._contacts = contacts + + self.list = async_to_raw_response_wrapper( + contacts.list, + ) + + +class ContactsResourceWithStreamingResponse: + def __init__(self, contacts: ContactsResource) -> None: + self._contacts = contacts + + self.list = to_streamed_response_wrapper( + contacts.list, + ) + + +class AsyncContactsResourceWithStreamingResponse: + def __init__(self, contacts: AsyncContactsResource) -> None: + self._contacts = contacts + + self.list = async_to_streamed_response_wrapper( + contacts.list, + ) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/rooms.py b/src/beeper_desktop_api/resources/matrix/bridges/rooms.py new file mode 100644 index 0000000..fcd9d9b --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/bridges/rooms.py @@ -0,0 +1,386 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.matrix.bridges import room_create_dm_params, room_create_group_params +from ....types.matrix.bridges.room_create_dm_response import RoomCreateDmResponse +from ....types.matrix.bridges.room_create_group_response import RoomCreateGroupResponse + +__all__ = ["RoomsResource", "AsyncRoomsResource"] + + +class RoomsResource(SyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> RoomsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return RoomsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoomsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return RoomsResourceWithStreamingResponse(self) + + def create_dm( + self, + identifier: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RoomCreateDmResponse: + """ + Create a direct chat with a user on the remote network. + + Args: + login_id: An optional explicit login ID to do the action through. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_dm/{identifier}", + bridge_id=bridge_id, + identifier=identifier, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"login_id": login_id}, room_create_dm_params.RoomCreateDmParams), + ), + cast_to=RoomCreateDmResponse, + ) + + def create_group( + self, + group_type: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + avatar: room_create_group_params.Avatar | Omit = omit, + disappear: room_create_group_params.Disappear | Omit = omit, + name: room_create_group_params.Name | Omit = omit, + parent: object | Omit = omit, + participants: SequenceNotStr[str] | Omit = omit, + room_id: str | Omit = omit, + topic: room_create_group_params.Topic | Omit = omit, + type: str | Omit = omit, + username: 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, + ) -> RoomCreateGroupResponse: + """ + Create a group chat on the remote network. + + Args: + login_id: An optional explicit login ID to do the action through. + + avatar: The `m.room.avatar` event content for the room. + + disappear: The `com.beeper.disappearing_timer` event content for the room. + + name: The `m.room.name` event content for the room. + + participants: The users to add to the group initially. + + room_id: An existing Matrix room ID to bridge to. The other parameters must be already in + sync with the room state when using this parameter. + + topic: The `m.room.topic` event content for the room. + + type: The type of group to create. + + username: The public username for the created group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not group_type: + raise ValueError(f"Expected a non-empty value for `group_type` but received {group_type!r}") + return self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_group/{group_type}", + bridge_id=bridge_id, + group_type=group_type, + ), + body=maybe_transform( + { + "avatar": avatar, + "disappear": disappear, + "name": name, + "parent": parent, + "participants": participants, + "room_id": room_id, + "topic": topic, + "type": type, + "username": username, + }, + room_create_group_params.RoomCreateGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"login_id": login_id}, room_create_group_params.RoomCreateGroupParams), + ), + cast_to=RoomCreateGroupResponse, + ) + + +class AsyncRoomsResource(AsyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> AsyncRoomsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoomsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoomsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncRoomsResourceWithStreamingResponse(self) + + async def create_dm( + self, + identifier: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RoomCreateDmResponse: + """ + Create a direct chat with a user on the remote network. + + Args: + login_id: An optional explicit login ID to do the action through. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_dm/{identifier}", + bridge_id=bridge_id, + identifier=identifier, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"login_id": login_id}, room_create_dm_params.RoomCreateDmParams), + ), + cast_to=RoomCreateDmResponse, + ) + + async def create_group( + self, + group_type: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + avatar: room_create_group_params.Avatar | Omit = omit, + disappear: room_create_group_params.Disappear | Omit = omit, + name: room_create_group_params.Name | Omit = omit, + parent: object | Omit = omit, + participants: SequenceNotStr[str] | Omit = omit, + room_id: str | Omit = omit, + topic: room_create_group_params.Topic | Omit = omit, + type: str | Omit = omit, + username: 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, + ) -> RoomCreateGroupResponse: + """ + Create a group chat on the remote network. + + Args: + login_id: An optional explicit login ID to do the action through. + + avatar: The `m.room.avatar` event content for the room. + + disappear: The `com.beeper.disappearing_timer` event content for the room. + + name: The `m.room.name` event content for the room. + + participants: The users to add to the group initially. + + room_id: An existing Matrix room ID to bridge to. The other parameters must be already in + sync with the room state when using this parameter. + + topic: The `m.room.topic` event content for the room. + + type: The type of group to create. + + username: The public username for the created group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not group_type: + raise ValueError(f"Expected a non-empty value for `group_type` but received {group_type!r}") + return await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_group/{group_type}", + bridge_id=bridge_id, + group_type=group_type, + ), + body=await async_maybe_transform( + { + "avatar": avatar, + "disappear": disappear, + "name": name, + "parent": parent, + "participants": participants, + "room_id": room_id, + "topic": topic, + "type": type, + "username": username, + }, + room_create_group_params.RoomCreateGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"login_id": login_id}, room_create_group_params.RoomCreateGroupParams + ), + ), + cast_to=RoomCreateGroupResponse, + ) + + +class RoomsResourceWithRawResponse: + def __init__(self, rooms: RoomsResource) -> None: + self._rooms = rooms + + self.create_dm = to_raw_response_wrapper( + rooms.create_dm, + ) + self.create_group = to_raw_response_wrapper( + rooms.create_group, + ) + + +class AsyncRoomsResourceWithRawResponse: + def __init__(self, rooms: AsyncRoomsResource) -> None: + self._rooms = rooms + + self.create_dm = async_to_raw_response_wrapper( + rooms.create_dm, + ) + self.create_group = async_to_raw_response_wrapper( + rooms.create_group, + ) + + +class RoomsResourceWithStreamingResponse: + def __init__(self, rooms: RoomsResource) -> None: + self._rooms = rooms + + self.create_dm = to_streamed_response_wrapper( + rooms.create_dm, + ) + self.create_group = to_streamed_response_wrapper( + rooms.create_group, + ) + + +class AsyncRoomsResourceWithStreamingResponse: + def __init__(self, rooms: AsyncRoomsResource) -> None: + self._rooms = rooms + + self.create_dm = async_to_streamed_response_wrapper( + rooms.create_dm, + ) + self.create_group = async_to_streamed_response_wrapper( + rooms.create_group, + ) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/users.py b/src/beeper_desktop_api/resources/matrix/bridges/users.py new file mode 100644 index 0000000..541fc05 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/bridges/users.py @@ -0,0 +1,304 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.matrix.bridges import user_search_params, user_resolve_params +from ....types.matrix.bridges.user_search_response import UserSearchResponse +from ....types.matrix.bridges.user_resolve_response import UserResolveResponse + +__all__ = ["UsersResource", "AsyncUsersResource"] + + +class UsersResource(SyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> UsersResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return UsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return UsersResourceWithStreamingResponse(self) + + def resolve( + self, + identifier: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> UserResolveResponse: + """ + Resolve an identifier to a user on the remote network. + + Args: + login_id: An optional explicit login ID to do the action through. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/resolve_identifier/{identifier}", + bridge_id=bridge_id, + identifier=identifier, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"login_id": login_id}, user_resolve_params.UserResolveParams), + ), + cast_to=UserResolveResponse, + ) + + def search( + self, + bridge_id: str, + *, + login_id: str | Omit = omit, + query: 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, + ) -> UserSearchResponse: + """ + Search for users on the remote network + + Args: + login_id: An optional explicit login ID to do the action through. + + query: The search query to send to the remote network + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/search_users", + bridge_id=bridge_id, + ), + body=maybe_transform({"query": query}, user_search_params.UserSearchParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"login_id": login_id}, user_search_params.UserSearchParams), + ), + cast_to=UserSearchResponse, + ) + + +class AsyncUsersResource(AsyncAPIResource): + """Matrix-compatible APIs for accounts and connected network bridges.""" + + @cached_property + def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncUsersResourceWithStreamingResponse(self) + + async def resolve( + self, + identifier: str, + *, + bridge_id: str, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> UserResolveResponse: + """ + Resolve an identifier to a user on the remote network. + + Args: + login_id: An optional explicit login ID to do the action through. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not identifier: + raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") + return await self._get( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/resolve_identifier/{identifier}", + bridge_id=bridge_id, + identifier=identifier, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"login_id": login_id}, user_resolve_params.UserResolveParams), + ), + cast_to=UserResolveResponse, + ) + + async def search( + self, + bridge_id: str, + *, + login_id: str | Omit = omit, + query: 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, + ) -> UserSearchResponse: + """ + Search for users on the remote network + + Args: + login_id: An optional explicit login ID to do the action through. + + query: The search query to send to the remote network + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._post( + path_template( + "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/search_users", + bridge_id=bridge_id, + ), + body=await async_maybe_transform({"query": query}, user_search_params.UserSearchParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"login_id": login_id}, user_search_params.UserSearchParams), + ), + cast_to=UserSearchResponse, + ) + + +class UsersResourceWithRawResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.resolve = to_raw_response_wrapper( + users.resolve, + ) + self.search = to_raw_response_wrapper( + users.search, + ) + + +class AsyncUsersResourceWithRawResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.resolve = async_to_raw_response_wrapper( + users.resolve, + ) + self.search = async_to_raw_response_wrapper( + users.search, + ) + + +class UsersResourceWithStreamingResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.resolve = to_streamed_response_wrapper( + users.resolve, + ) + self.search = to_streamed_response_wrapper( + users.search, + ) + + +class AsyncUsersResourceWithStreamingResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.resolve = async_to_streamed_response_wrapper( + users.resolve, + ) + self.search = async_to_streamed_response_wrapper( + users.search, + ) diff --git a/src/beeper_desktop_api/resources/matrix/matrix.py b/src/beeper_desktop_api/resources/matrix/matrix.py new file mode 100644 index 0000000..8a494a3 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/matrix.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from .rooms.rooms import ( + RoomsResource, + AsyncRoomsResource, + RoomsResourceWithRawResponse, + AsyncRoomsResourceWithRawResponse, + RoomsResourceWithStreamingResponse, + AsyncRoomsResourceWithStreamingResponse, +) +from .users.users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .bridges.bridges import ( + BridgesResource, + AsyncBridgesResource, + BridgesResourceWithRawResponse, + AsyncBridgesResourceWithRawResponse, + BridgesResourceWithStreamingResponse, + AsyncBridgesResourceWithStreamingResponse, +) + +__all__ = ["MatrixResource", "AsyncMatrixResource"] + + +class MatrixResource(SyncAPIResource): + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + + @cached_property + def users(self) -> UsersResource: + return UsersResource(self._client) + + @cached_property + def rooms(self) -> RoomsResource: + return RoomsResource(self._client) + + @cached_property + def bridges(self) -> BridgesResource: + """Matrix-compatible APIs for connected network bridges.""" + return BridgesResource(self._client) + + @cached_property + def with_raw_response(self) -> MatrixResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return MatrixResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MatrixResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return MatrixResourceWithStreamingResponse(self) + + +class AsyncMatrixResource(AsyncAPIResource): + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + + @cached_property + def users(self) -> AsyncUsersResource: + return AsyncUsersResource(self._client) + + @cached_property + def rooms(self) -> AsyncRoomsResource: + return AsyncRoomsResource(self._client) + + @cached_property + def bridges(self) -> AsyncBridgesResource: + """Matrix-compatible APIs for connected network bridges.""" + return AsyncBridgesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncMatrixResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncMatrixResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMatrixResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncMatrixResourceWithStreamingResponse(self) + + +class MatrixResourceWithRawResponse: + def __init__(self, matrix: MatrixResource) -> None: + self._matrix = matrix + + @cached_property + def users(self) -> UsersResourceWithRawResponse: + return UsersResourceWithRawResponse(self._matrix.users) + + @cached_property + def rooms(self) -> RoomsResourceWithRawResponse: + return RoomsResourceWithRawResponse(self._matrix.rooms) + + @cached_property + def bridges(self) -> BridgesResourceWithRawResponse: + """Matrix-compatible APIs for connected network bridges.""" + return BridgesResourceWithRawResponse(self._matrix.bridges) + + +class AsyncMatrixResourceWithRawResponse: + def __init__(self, matrix: AsyncMatrixResource) -> None: + self._matrix = matrix + + @cached_property + def users(self) -> AsyncUsersResourceWithRawResponse: + return AsyncUsersResourceWithRawResponse(self._matrix.users) + + @cached_property + def rooms(self) -> AsyncRoomsResourceWithRawResponse: + return AsyncRoomsResourceWithRawResponse(self._matrix.rooms) + + @cached_property + def bridges(self) -> AsyncBridgesResourceWithRawResponse: + """Matrix-compatible APIs for connected network bridges.""" + return AsyncBridgesResourceWithRawResponse(self._matrix.bridges) + + +class MatrixResourceWithStreamingResponse: + def __init__(self, matrix: MatrixResource) -> None: + self._matrix = matrix + + @cached_property + def users(self) -> UsersResourceWithStreamingResponse: + return UsersResourceWithStreamingResponse(self._matrix.users) + + @cached_property + def rooms(self) -> RoomsResourceWithStreamingResponse: + return RoomsResourceWithStreamingResponse(self._matrix.rooms) + + @cached_property + def bridges(self) -> BridgesResourceWithStreamingResponse: + """Matrix-compatible APIs for connected network bridges.""" + return BridgesResourceWithStreamingResponse(self._matrix.bridges) + + +class AsyncMatrixResourceWithStreamingResponse: + def __init__(self, matrix: AsyncMatrixResource) -> None: + self._matrix = matrix + + @cached_property + def users(self) -> AsyncUsersResourceWithStreamingResponse: + return AsyncUsersResourceWithStreamingResponse(self._matrix.users) + + @cached_property + def rooms(self) -> AsyncRoomsResourceWithStreamingResponse: + return AsyncRoomsResourceWithStreamingResponse(self._matrix.rooms) + + @cached_property + def bridges(self) -> AsyncBridgesResourceWithStreamingResponse: + """Matrix-compatible APIs for connected network bridges.""" + return AsyncBridgesResourceWithStreamingResponse(self._matrix.bridges) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/__init__.py b/src/beeper_desktop_api/resources/matrix/rooms/__init__.py new file mode 100644 index 0000000..443fc1b --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/rooms/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rooms import ( + RoomsResource, + AsyncRoomsResource, + RoomsResourceWithRawResponse, + AsyncRoomsResourceWithRawResponse, + RoomsResourceWithStreamingResponse, + AsyncRoomsResourceWithStreamingResponse, +) +from .state import ( + StateResource, + AsyncStateResource, + StateResourceWithRawResponse, + AsyncStateResourceWithRawResponse, + StateResourceWithStreamingResponse, + AsyncStateResourceWithStreamingResponse, +) +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .account_data import ( + AccountDataResource, + AsyncAccountDataResource, + AccountDataResourceWithRawResponse, + AsyncAccountDataResourceWithRawResponse, + AccountDataResourceWithStreamingResponse, + AsyncAccountDataResourceWithStreamingResponse, +) + +__all__ = [ + "AccountDataResource", + "AsyncAccountDataResource", + "AccountDataResourceWithRawResponse", + "AsyncAccountDataResourceWithRawResponse", + "AccountDataResourceWithStreamingResponse", + "AsyncAccountDataResourceWithStreamingResponse", + "StateResource", + "AsyncStateResource", + "StateResourceWithRawResponse", + "AsyncStateResourceWithRawResponse", + "StateResourceWithStreamingResponse", + "AsyncStateResourceWithStreamingResponse", + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "RoomsResource", + "AsyncRoomsResource", + "RoomsResourceWithRawResponse", + "AsyncRoomsResourceWithRawResponse", + "RoomsResourceWithStreamingResponse", + "AsyncRoomsResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/matrix/rooms/account_data.py b/src/beeper_desktop_api/resources/matrix/rooms/account_data.py new file mode 100644 index 0000000..967c27c --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/rooms/account_data.py @@ -0,0 +1,302 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template, 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.matrix.rooms import account_data_update_params + +__all__ = ["AccountDataResource", "AsyncAccountDataResource"] + + +class AccountDataResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AccountDataResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AccountDataResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AccountDataResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AccountDataResourceWithStreamingResponse(self) + + def retrieve( + self, + type: str, + *, + user_id: str, + room_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, + ) -> object: + """Get some account data for the client on a given room. + + This config is only + visible to the user that set the account data. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return self._get( + path_template( + "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", + user_id=user_id, + room_id=room_id, + type=type, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def update( + self, + type: str, + *, + user_id: str, + room_id: str, + body: object, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Set some account data for the client on a given room. + + This config is only + visible to the user that set the account data. The config will be delivered to + clients in the per-room entries via + [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return self._put( + path_template( + "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", + user_id=user_id, + room_id=room_id, + type=type, + ), + body=maybe_transform(body, account_data_update_params.AccountDataUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncAccountDataResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAccountDataResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountDataResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAccountDataResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncAccountDataResourceWithStreamingResponse(self) + + async def retrieve( + self, + type: str, + *, + user_id: str, + room_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, + ) -> object: + """Get some account data for the client on a given room. + + This config is only + visible to the user that set the account data. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return await self._get( + path_template( + "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", + user_id=user_id, + room_id=room_id, + type=type, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def update( + self, + type: str, + *, + user_id: str, + room_id: str, + body: object, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Set some account data for the client on a given room. + + This config is only + visible to the user that set the account data. The config will be delivered to + clients in the per-room entries via + [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return await self._put( + path_template( + "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", + user_id=user_id, + room_id=room_id, + type=type, + ), + body=await async_maybe_transform(body, account_data_update_params.AccountDataUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AccountDataResourceWithRawResponse: + def __init__(self, account_data: AccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = to_raw_response_wrapper( + account_data.retrieve, + ) + self.update = to_raw_response_wrapper( + account_data.update, + ) + + +class AsyncAccountDataResourceWithRawResponse: + def __init__(self, account_data: AsyncAccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = async_to_raw_response_wrapper( + account_data.retrieve, + ) + self.update = async_to_raw_response_wrapper( + account_data.update, + ) + + +class AccountDataResourceWithStreamingResponse: + def __init__(self, account_data: AccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = to_streamed_response_wrapper( + account_data.retrieve, + ) + self.update = to_streamed_response_wrapper( + account_data.update, + ) + + +class AsyncAccountDataResourceWithStreamingResponse: + def __init__(self, account_data: AsyncAccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = async_to_streamed_response_wrapper( + account_data.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + account_data.update, + ) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/events.py b/src/beeper_desktop_api/resources/matrix/rooms/events.py new file mode 100644 index 0000000..c7dc565 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/rooms/events.py @@ -0,0 +1,174 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.matrix.rooms.event_retrieve_response import EventRetrieveResponse + +__all__ = ["EventsResource", "AsyncEventsResource"] + + +class EventsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EventsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return EventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return EventsResourceWithStreamingResponse(self) + + def retrieve( + self, + event_id: str, + *, + room_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, + ) -> EventRetrieveResponse: + """Get a single event based on `roomId/eventId`. + + You must have permission to + retrieve this event e.g. by being a member in the room for this event. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not event_id: + raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") + return self._get( + path_template("/_matrix/client/v3/rooms/{room_id}/event/{event_id}", room_id=room_id, event_id=event_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EventRetrieveResponse, + ) + + +class AsyncEventsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncEventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncEventsResourceWithStreamingResponse(self) + + async def retrieve( + self, + event_id: str, + *, + room_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, + ) -> EventRetrieveResponse: + """Get a single event based on `roomId/eventId`. + + You must have permission to + retrieve this event e.g. by being a member in the room for this event. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not event_id: + raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") + return await self._get( + path_template("/_matrix/client/v3/rooms/{room_id}/event/{event_id}", room_id=room_id, event_id=event_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EventRetrieveResponse, + ) + + +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.retrieve = to_raw_response_wrapper( + events.retrieve, + ) + + +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.retrieve = async_to_raw_response_wrapper( + events.retrieve, + ) + + +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.retrieve = to_streamed_response_wrapper( + events.retrieve, + ) + + +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.retrieve = async_to_streamed_response_wrapper( + events.retrieve, + ) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/rooms.py b/src/beeper_desktop_api/resources/matrix/rooms/rooms.py new file mode 100644 index 0000000..2686e32 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/rooms/rooms.py @@ -0,0 +1,845 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal + +import httpx + +from .state import ( + StateResource, + AsyncStateResource, + StateResourceWithRawResponse, + AsyncStateResourceWithRawResponse, + StateResourceWithStreamingResponse, + AsyncStateResourceWithStreamingResponse, +) +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .account_data import ( + AccountDataResource, + AsyncAccountDataResource, + AccountDataResourceWithRawResponse, + AsyncAccountDataResourceWithRawResponse, + AccountDataResourceWithStreamingResponse, + AsyncAccountDataResourceWithStreamingResponse, +) +from ...._base_client import make_request_options +from ....types.matrix import room_join_params, room_leave_params, room_create_params +from ....types.matrix.room_join_response import RoomJoinResponse +from ....types.matrix.room_create_response import RoomCreateResponse + +__all__ = ["RoomsResource", "AsyncRoomsResource"] + + +class RoomsResource(SyncAPIResource): + @cached_property + def account_data(self) -> AccountDataResource: + return AccountDataResource(self._client) + + @cached_property + def state(self) -> StateResource: + return StateResource(self._client) + + @cached_property + def events(self) -> EventsResource: + return EventsResource(self._client) + + @cached_property + def with_raw_response(self) -> RoomsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return RoomsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoomsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return RoomsResourceWithStreamingResponse(self) + + def create( + self, + *, + creation_content: object | Omit = omit, + initial_state: Iterable[room_create_params.InitialState] | Omit = omit, + invite: SequenceNotStr[str] | Omit = omit, + invite_3pid: Iterable[room_create_params.Invite3pid] | Omit = omit, + is_direct: bool | Omit = omit, + name: str | Omit = omit, + power_level_content_override: object | Omit = omit, + preset: Literal["private_chat", "public_chat", "trusted_private_chat"] | Omit = omit, + room_alias_name: str | Omit = omit, + room_version: str | Omit = omit, + topic: str | Omit = omit, + visibility: Literal["public", "private"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RoomCreateResponse: + """ + Create a new room with various configuration options. + + The server MUST apply the normal state resolution rules when creating the new + room, including checking power levels for each event. It MUST apply the events + implied by the request in the following order: + + 1. The `m.room.create` event itself. Must be the first event in the room. + + 2. An `m.room.member` event for the creator to join the room. This is needed so + the remaining events can be sent. + + 3. A default `m.room.power_levels` event. Overridden by the + `power_level_content_override` parameter. + + In [room versions](https://spec.matrix.org/v1.18/rooms) 1 through 11, the + room creator (and not other members) will be given permission to send state + events. + + In room versions 12 and later, the room creator is given infinite power level + and cannot be specified in the `users` field of `m.room.power_levels`, so is + not listed explicitly. + + **Note**: For `trusted_private_chat`, the users specified in the `invite` + parameter SHOULD also be appended to `additional_creators` by the server, per + the `creation_content` parameter. + + If the room's version is 12 or higher, the power level for sending + `m.room.tombstone` events MUST explicitly be higher than `state_default`. For + example, set to 150 instead of 100. + + 4. An `m.room.canonical_alias` event if `room_alias_name` is given. + + 5. Events set by the `preset`. Currently these are the `m.room.join_rules`, + `m.room.history_visibility`, and `m.room.guest_access` state events. + + 6. Events listed in `initial_state`, in the order that they are listed. + + 7. Events implied by `name` and `topic` (`m.room.name` and `m.room.topic` state + events). + + 8. Invite events implied by `invite` and `invite_3pid` (`m.room.member` with + `membership: invite` and `m.room.third_party_invite`). + + The available presets do the following with respect to room state: + + | Preset | `join_rules` | `history_visibility` | `guest_access` | Other | + | ---------------------- | ------------ | -------------------- | -------------- | ---------------------------------------------------------------- | + | `private_chat` | `invite` | `shared` | `can_join` | | + | `trusted_private_chat` | `invite` | `shared` | `can_join` | All invitees are given the same power level as the room creator. | + | `public_chat` | `public` | `shared` | `forbidden` | | + + The server will create a `m.room.create` event in the room with the requesting + user as the creator, alongside other keys provided in the `creation_content` or + implied by behaviour of `creation_content`. + + Args: + creation_content: Extra keys, such as `m.federate`, to be added to the content of the + [`m.room.create`](https://spec.matrix.org/v1.18/client-server-api/#mroomcreate) + event. + + The server will overwrite the following keys: `creator`, `room_version`. Future + versions of the specification may allow the server to overwrite other keys. + + When using the `trusted_private_chat` preset, the server SHOULD combine + `additional_creators` specified here and the `invite` array into the eventual + `m.room.create` event's `additional_creators`, deduplicating between the two + parameters. + + initial_state: A list of state events to set in the new room. This allows the user to override + the default state events set in the new room. The expected format of the state + events are an object with type, state_key and content keys set. + + Takes precedence over events set by `preset`, but gets overridden by `name` and + `topic` keys. + + invite: A list of user IDs to invite to the room. This will tell the server to invite + everyone in the list to the newly created room. + + invite_3pid: A list of objects representing third-party IDs to invite into the room. + + is_direct: This flag makes the server set the `is_direct` flag on the `m.room.member` + events sent to the users in `invite` and `invite_3pid`. See + [Direct Messaging](https://spec.matrix.org/v1.18/client-server-api/#direct-messaging) + for more information. + + name: If this is included, an + [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) + event will be sent into the room to indicate the name for the room. This + overwrites any + [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) + event in `initial_state`. + + power_level_content_override: The power level content to override in the default power level event. This + object is applied on top of the generated + [`m.room.power_levels`](https://spec.matrix.org/v1.18/client-server-api/#mroompower_levels) + event content prior to it being sent to the room. Defaults to overriding + nothing. + + preset: Convenience parameter for setting various default state events based on a + preset. + + If unspecified, the server should use the `visibility` to determine which preset + to use. A visibility of `public` equates to a preset of `public_chat` and + `private` visibility equates to a preset of `private_chat`. + + room_alias_name: The desired room alias **local part**. If this is included, a room alias will be + created and mapped to the newly created room. The alias will belong on the + _same_ homeserver which created the room. For example, if this was set to "foo" + and sent to the homeserver "example.com" the complete room alias would be + `#foo:example.com`. + + The complete room alias will become the canonical alias for the room and an + `m.room.canonical_alias` event will be sent into the room. + + room_version: The room version to set for the room. If not provided, the homeserver is to use + its configured default. If provided, the homeserver will return a 400 error with + the errcode `M_UNSUPPORTED_ROOM_VERSION` if it does not support the room + version. + + topic: If this is included, an + [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) + event with a `text/plain` mimetype will be sent into the room to indicate the + topic for the room. This overwrites any + [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) + event in `initial_state`. + + visibility: The room's visibility in the server's + [published room directory](https://spec.matrix.org/v1.18/client-server-api#published-room-directory). + Defaults to `private`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/_matrix/client/v3/createRoom", + body=maybe_transform( + { + "creation_content": creation_content, + "initial_state": initial_state, + "invite": invite, + "invite_3pid": invite_3pid, + "is_direct": is_direct, + "name": name, + "power_level_content_override": power_level_content_override, + "preset": preset, + "room_alias_name": room_alias_name, + "room_version": room_version, + "topic": topic, + "visibility": visibility, + }, + room_create_params.RoomCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoomCreateResponse, + ) + + def join( + self, + room_id_or_alias: str, + *, + via: SequenceNotStr[str] | Omit = omit, + reason: str | Omit = omit, + third_party_signed: room_join_params.ThirdPartySigned | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RoomJoinResponse: + """ + _Note that this API takes either a room ID or alias, unlike_ + `/rooms/{roomId}/join`. + + This API starts a user's participation in a particular room, if that user is + allowed to participate in that room. After this call, the client is allowed to + see all current state events in the room, and all subsequent events associated + with the room until the user leaves the room. + + After a user has joined a room, the room will appear as an entry in the response + of the + [`/initialSync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3initialsync) + and + [`/sync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync) + APIs. + + Args: + via: The servers to attempt to join the room through. One of the servers must be + participating in the room. + + reason: Optional reason to be included as the `reason` on the subsequent membership + event. + + third_party_signed: A signature of an `m.third_party_invite` token to prove that this user owns a + third-party identity which has been invited to the room. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id_or_alias: + raise ValueError(f"Expected a non-empty value for `room_id_or_alias` but received {room_id_or_alias!r}") + return self._post( + path_template("/_matrix/client/v3/join/{room_id_or_alias}", room_id_or_alias=room_id_or_alias), + body=maybe_transform( + { + "reason": reason, + "third_party_signed": third_party_signed, + }, + room_join_params.RoomJoinParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"via": via}, room_join_params.RoomJoinParams), + ), + cast_to=RoomJoinResponse, + ) + + def leave( + self, + room_id: str, + *, + reason: 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, + ) -> object: + """ + This API stops a user participating in a particular room. + + If the user was already in the room, they will no longer be able to see new + events in the room. If the room requires an invite to join, they will need to be + re-invited before they can re-join. + + If the user was invited to the room, but had not joined, this call serves to + reject the invite. + + Servers MAY additionally forget the room when this endpoint is called – just as + if the user had also invoked + [`/forget`](https://spec.matrix.org/v1.18/client-server-api/#post_matrixclientv3roomsroomidforget). + Servers that do this, MUST inform clients about this behavior using the + [`m.forget_forced_upon_leave`](https://spec.matrix.org/v1.18/client-server-api/#mforget_forced_upon_leave-capability) + capability. + + If the server doesn't automatically forget the room, the user will still be + allowed to retrieve history from the room which they were previously allowed to + see. + + Args: + reason: Optional reason to be included as the `reason` on the subsequent membership + event. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + return self._post( + path_template("/_matrix/client/v3/rooms/{room_id}/leave", room_id=room_id), + body=maybe_transform({"reason": reason}, room_leave_params.RoomLeaveParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncRoomsResource(AsyncAPIResource): + @cached_property + def account_data(self) -> AsyncAccountDataResource: + return AsyncAccountDataResource(self._client) + + @cached_property + def state(self) -> AsyncStateResource: + return AsyncStateResource(self._client) + + @cached_property + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncRoomsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoomsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoomsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncRoomsResourceWithStreamingResponse(self) + + async def create( + self, + *, + creation_content: object | Omit = omit, + initial_state: Iterable[room_create_params.InitialState] | Omit = omit, + invite: SequenceNotStr[str] | Omit = omit, + invite_3pid: Iterable[room_create_params.Invite3pid] | Omit = omit, + is_direct: bool | Omit = omit, + name: str | Omit = omit, + power_level_content_override: object | Omit = omit, + preset: Literal["private_chat", "public_chat", "trusted_private_chat"] | Omit = omit, + room_alias_name: str | Omit = omit, + room_version: str | Omit = omit, + topic: str | Omit = omit, + visibility: Literal["public", "private"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RoomCreateResponse: + """ + Create a new room with various configuration options. + + The server MUST apply the normal state resolution rules when creating the new + room, including checking power levels for each event. It MUST apply the events + implied by the request in the following order: + + 1. The `m.room.create` event itself. Must be the first event in the room. + + 2. An `m.room.member` event for the creator to join the room. This is needed so + the remaining events can be sent. + + 3. A default `m.room.power_levels` event. Overridden by the + `power_level_content_override` parameter. + + In [room versions](https://spec.matrix.org/v1.18/rooms) 1 through 11, the + room creator (and not other members) will be given permission to send state + events. + + In room versions 12 and later, the room creator is given infinite power level + and cannot be specified in the `users` field of `m.room.power_levels`, so is + not listed explicitly. + + **Note**: For `trusted_private_chat`, the users specified in the `invite` + parameter SHOULD also be appended to `additional_creators` by the server, per + the `creation_content` parameter. + + If the room's version is 12 or higher, the power level for sending + `m.room.tombstone` events MUST explicitly be higher than `state_default`. For + example, set to 150 instead of 100. + + 4. An `m.room.canonical_alias` event if `room_alias_name` is given. + + 5. Events set by the `preset`. Currently these are the `m.room.join_rules`, + `m.room.history_visibility`, and `m.room.guest_access` state events. + + 6. Events listed in `initial_state`, in the order that they are listed. + + 7. Events implied by `name` and `topic` (`m.room.name` and `m.room.topic` state + events). + + 8. Invite events implied by `invite` and `invite_3pid` (`m.room.member` with + `membership: invite` and `m.room.third_party_invite`). + + The available presets do the following with respect to room state: + + | Preset | `join_rules` | `history_visibility` | `guest_access` | Other | + | ---------------------- | ------------ | -------------------- | -------------- | ---------------------------------------------------------------- | + | `private_chat` | `invite` | `shared` | `can_join` | | + | `trusted_private_chat` | `invite` | `shared` | `can_join` | All invitees are given the same power level as the room creator. | + | `public_chat` | `public` | `shared` | `forbidden` | | + + The server will create a `m.room.create` event in the room with the requesting + user as the creator, alongside other keys provided in the `creation_content` or + implied by behaviour of `creation_content`. + + Args: + creation_content: Extra keys, such as `m.federate`, to be added to the content of the + [`m.room.create`](https://spec.matrix.org/v1.18/client-server-api/#mroomcreate) + event. + + The server will overwrite the following keys: `creator`, `room_version`. Future + versions of the specification may allow the server to overwrite other keys. + + When using the `trusted_private_chat` preset, the server SHOULD combine + `additional_creators` specified here and the `invite` array into the eventual + `m.room.create` event's `additional_creators`, deduplicating between the two + parameters. + + initial_state: A list of state events to set in the new room. This allows the user to override + the default state events set in the new room. The expected format of the state + events are an object with type, state_key and content keys set. + + Takes precedence over events set by `preset`, but gets overridden by `name` and + `topic` keys. + + invite: A list of user IDs to invite to the room. This will tell the server to invite + everyone in the list to the newly created room. + + invite_3pid: A list of objects representing third-party IDs to invite into the room. + + is_direct: This flag makes the server set the `is_direct` flag on the `m.room.member` + events sent to the users in `invite` and `invite_3pid`. See + [Direct Messaging](https://spec.matrix.org/v1.18/client-server-api/#direct-messaging) + for more information. + + name: If this is included, an + [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) + event will be sent into the room to indicate the name for the room. This + overwrites any + [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) + event in `initial_state`. + + power_level_content_override: The power level content to override in the default power level event. This + object is applied on top of the generated + [`m.room.power_levels`](https://spec.matrix.org/v1.18/client-server-api/#mroompower_levels) + event content prior to it being sent to the room. Defaults to overriding + nothing. + + preset: Convenience parameter for setting various default state events based on a + preset. + + If unspecified, the server should use the `visibility` to determine which preset + to use. A visibility of `public` equates to a preset of `public_chat` and + `private` visibility equates to a preset of `private_chat`. + + room_alias_name: The desired room alias **local part**. If this is included, a room alias will be + created and mapped to the newly created room. The alias will belong on the + _same_ homeserver which created the room. For example, if this was set to "foo" + and sent to the homeserver "example.com" the complete room alias would be + `#foo:example.com`. + + The complete room alias will become the canonical alias for the room and an + `m.room.canonical_alias` event will be sent into the room. + + room_version: The room version to set for the room. If not provided, the homeserver is to use + its configured default. If provided, the homeserver will return a 400 error with + the errcode `M_UNSUPPORTED_ROOM_VERSION` if it does not support the room + version. + + topic: If this is included, an + [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) + event with a `text/plain` mimetype will be sent into the room to indicate the + topic for the room. This overwrites any + [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) + event in `initial_state`. + + visibility: The room's visibility in the server's + [published room directory](https://spec.matrix.org/v1.18/client-server-api#published-room-directory). + Defaults to `private`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/_matrix/client/v3/createRoom", + body=await async_maybe_transform( + { + "creation_content": creation_content, + "initial_state": initial_state, + "invite": invite, + "invite_3pid": invite_3pid, + "is_direct": is_direct, + "name": name, + "power_level_content_override": power_level_content_override, + "preset": preset, + "room_alias_name": room_alias_name, + "room_version": room_version, + "topic": topic, + "visibility": visibility, + }, + room_create_params.RoomCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoomCreateResponse, + ) + + async def join( + self, + room_id_or_alias: str, + *, + via: SequenceNotStr[str] | Omit = omit, + reason: str | Omit = omit, + third_party_signed: room_join_params.ThirdPartySigned | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RoomJoinResponse: + """ + _Note that this API takes either a room ID or alias, unlike_ + `/rooms/{roomId}/join`. + + This API starts a user's participation in a particular room, if that user is + allowed to participate in that room. After this call, the client is allowed to + see all current state events in the room, and all subsequent events associated + with the room until the user leaves the room. + + After a user has joined a room, the room will appear as an entry in the response + of the + [`/initialSync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3initialsync) + and + [`/sync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync) + APIs. + + Args: + via: The servers to attempt to join the room through. One of the servers must be + participating in the room. + + reason: Optional reason to be included as the `reason` on the subsequent membership + event. + + third_party_signed: A signature of an `m.third_party_invite` token to prove that this user owns a + third-party identity which has been invited to the room. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id_or_alias: + raise ValueError(f"Expected a non-empty value for `room_id_or_alias` but received {room_id_or_alias!r}") + return await self._post( + path_template("/_matrix/client/v3/join/{room_id_or_alias}", room_id_or_alias=room_id_or_alias), + body=await async_maybe_transform( + { + "reason": reason, + "third_party_signed": third_party_signed, + }, + room_join_params.RoomJoinParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"via": via}, room_join_params.RoomJoinParams), + ), + cast_to=RoomJoinResponse, + ) + + async def leave( + self, + room_id: str, + *, + reason: 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, + ) -> object: + """ + This API stops a user participating in a particular room. + + If the user was already in the room, they will no longer be able to see new + events in the room. If the room requires an invite to join, they will need to be + re-invited before they can re-join. + + If the user was invited to the room, but had not joined, this call serves to + reject the invite. + + Servers MAY additionally forget the room when this endpoint is called – just as + if the user had also invoked + [`/forget`](https://spec.matrix.org/v1.18/client-server-api/#post_matrixclientv3roomsroomidforget). + Servers that do this, MUST inform clients about this behavior using the + [`m.forget_forced_upon_leave`](https://spec.matrix.org/v1.18/client-server-api/#mforget_forced_upon_leave-capability) + capability. + + If the server doesn't automatically forget the room, the user will still be + allowed to retrieve history from the room which they were previously allowed to + see. + + Args: + reason: Optional reason to be included as the `reason` on the subsequent membership + event. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + return await self._post( + path_template("/_matrix/client/v3/rooms/{room_id}/leave", room_id=room_id), + body=await async_maybe_transform({"reason": reason}, room_leave_params.RoomLeaveParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class RoomsResourceWithRawResponse: + def __init__(self, rooms: RoomsResource) -> None: + self._rooms = rooms + + self.create = to_raw_response_wrapper( + rooms.create, + ) + self.join = to_raw_response_wrapper( + rooms.join, + ) + self.leave = to_raw_response_wrapper( + rooms.leave, + ) + + @cached_property + def account_data(self) -> AccountDataResourceWithRawResponse: + return AccountDataResourceWithRawResponse(self._rooms.account_data) + + @cached_property + def state(self) -> StateResourceWithRawResponse: + return StateResourceWithRawResponse(self._rooms.state) + + @cached_property + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._rooms.events) + + +class AsyncRoomsResourceWithRawResponse: + def __init__(self, rooms: AsyncRoomsResource) -> None: + self._rooms = rooms + + self.create = async_to_raw_response_wrapper( + rooms.create, + ) + self.join = async_to_raw_response_wrapper( + rooms.join, + ) + self.leave = async_to_raw_response_wrapper( + rooms.leave, + ) + + @cached_property + def account_data(self) -> AsyncAccountDataResourceWithRawResponse: + return AsyncAccountDataResourceWithRawResponse(self._rooms.account_data) + + @cached_property + def state(self) -> AsyncStateResourceWithRawResponse: + return AsyncStateResourceWithRawResponse(self._rooms.state) + + @cached_property + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._rooms.events) + + +class RoomsResourceWithStreamingResponse: + def __init__(self, rooms: RoomsResource) -> None: + self._rooms = rooms + + self.create = to_streamed_response_wrapper( + rooms.create, + ) + self.join = to_streamed_response_wrapper( + rooms.join, + ) + self.leave = to_streamed_response_wrapper( + rooms.leave, + ) + + @cached_property + def account_data(self) -> AccountDataResourceWithStreamingResponse: + return AccountDataResourceWithStreamingResponse(self._rooms.account_data) + + @cached_property + def state(self) -> StateResourceWithStreamingResponse: + return StateResourceWithStreamingResponse(self._rooms.state) + + @cached_property + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._rooms.events) + + +class AsyncRoomsResourceWithStreamingResponse: + def __init__(self, rooms: AsyncRoomsResource) -> None: + self._rooms = rooms + + self.create = async_to_streamed_response_wrapper( + rooms.create, + ) + self.join = async_to_streamed_response_wrapper( + rooms.join, + ) + self.leave = async_to_streamed_response_wrapper( + rooms.leave, + ) + + @cached_property + def account_data(self) -> AsyncAccountDataResourceWithStreamingResponse: + return AsyncAccountDataResourceWithStreamingResponse(self._rooms.account_data) + + @cached_property + def state(self) -> AsyncStateResourceWithStreamingResponse: + return AsyncStateResourceWithStreamingResponse(self._rooms.state) + + @cached_property + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._rooms.events) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/state.py b/src/beeper_desktop_api/resources/matrix/rooms/state.py new file mode 100644 index 0000000..dc7f15f --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/rooms/state.py @@ -0,0 +1,294 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.matrix.rooms import state_retrieve_params +from ....types.matrix.rooms.state_list_response import StateListResponse +from ....types.matrix.rooms.state_retrieve_response import StateRetrieveResponse + +__all__ = ["StateResource", "AsyncStateResource"] + + +class StateResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StateResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return StateResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StateResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return StateResourceWithStreamingResponse(self) + + def retrieve( + self, + state_key: str, + *, + room_id: str, + event_type: str, + format: Literal["content", "event"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> StateRetrieveResponse: + """Looks up the contents of a state event in a room. + + If the user is joined to the + room then the state is taken from the current state of the room. If the user has + left the room then the state is taken from the state of the room when they left. + + Args: + format: The format to use for the returned data. `content` (the default) will return + only the content of the state event. `event` will return the entire event in the + usual format suitable for clients, including fields like event ID, sender and + timestamp. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not event_type: + raise ValueError(f"Expected a non-empty value for `event_type` but received {event_type!r}") + if not state_key: + raise ValueError(f"Expected a non-empty value for `state_key` but received {state_key!r}") + return self._get( + path_template( + "/_matrix/client/v3/rooms/{room_id}/state/{event_type}/{state_key}", + room_id=room_id, + event_type=event_type, + state_key=state_key, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"format": format}, state_retrieve_params.StateRetrieveParams), + ), + cast_to=StateRetrieveResponse, + ) + + def list( + self, + room_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, + ) -> StateListResponse: + """ + Get the state events for the current state of a room. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + return self._get( + path_template("/_matrix/client/v3/rooms/{room_id}/state", room_id=room_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StateListResponse, + ) + + +class AsyncStateResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStateResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncStateResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStateResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncStateResourceWithStreamingResponse(self) + + async def retrieve( + self, + state_key: str, + *, + room_id: str, + event_type: str, + format: Literal["content", "event"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> StateRetrieveResponse: + """Looks up the contents of a state event in a room. + + If the user is joined to the + room then the state is taken from the current state of the room. If the user has + left the room then the state is taken from the state of the room when they left. + + Args: + format: The format to use for the returned data. `content` (the default) will return + only the content of the state event. `event` will return the entire event in the + usual format suitable for clients, including fields like event ID, sender and + timestamp. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + if not event_type: + raise ValueError(f"Expected a non-empty value for `event_type` but received {event_type!r}") + if not state_key: + raise ValueError(f"Expected a non-empty value for `state_key` but received {state_key!r}") + return await self._get( + path_template( + "/_matrix/client/v3/rooms/{room_id}/state/{event_type}/{state_key}", + room_id=room_id, + event_type=event_type, + state_key=state_key, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"format": format}, state_retrieve_params.StateRetrieveParams), + ), + cast_to=StateRetrieveResponse, + ) + + async def list( + self, + room_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, + ) -> StateListResponse: + """ + Get the state events for the current state of a room. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not room_id: + raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") + return await self._get( + path_template("/_matrix/client/v3/rooms/{room_id}/state", room_id=room_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StateListResponse, + ) + + +class StateResourceWithRawResponse: + def __init__(self, state: StateResource) -> None: + self._state = state + + self.retrieve = to_raw_response_wrapper( + state.retrieve, + ) + self.list = to_raw_response_wrapper( + state.list, + ) + + +class AsyncStateResourceWithRawResponse: + def __init__(self, state: AsyncStateResource) -> None: + self._state = state + + self.retrieve = async_to_raw_response_wrapper( + state.retrieve, + ) + self.list = async_to_raw_response_wrapper( + state.list, + ) + + +class StateResourceWithStreamingResponse: + def __init__(self, state: StateResource) -> None: + self._state = state + + self.retrieve = to_streamed_response_wrapper( + state.retrieve, + ) + self.list = to_streamed_response_wrapper( + state.list, + ) + + +class AsyncStateResourceWithStreamingResponse: + def __init__(self, state: AsyncStateResource) -> None: + self._state = state + + self.retrieve = async_to_streamed_response_wrapper( + state.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + state.list, + ) diff --git a/src/beeper_desktop_api/resources/matrix/users/__init__.py b/src/beeper_desktop_api/resources/matrix/users/__init__.py new file mode 100644 index 0000000..84ad0d9 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/users/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .account_data import ( + AccountDataResource, + AsyncAccountDataResource, + AccountDataResourceWithRawResponse, + AsyncAccountDataResourceWithRawResponse, + AccountDataResourceWithStreamingResponse, + AsyncAccountDataResourceWithStreamingResponse, +) + +__all__ = [ + "AccountDataResource", + "AsyncAccountDataResource", + "AccountDataResourceWithRawResponse", + "AsyncAccountDataResourceWithRawResponse", + "AccountDataResourceWithStreamingResponse", + "AsyncAccountDataResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/matrix/users/account_data.py b/src/beeper_desktop_api/resources/matrix/users/account_data.py new file mode 100644 index 0000000..2c8a316 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/users/account_data.py @@ -0,0 +1,270 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template, 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.matrix.users import account_data_update_params + +__all__ = ["AccountDataResource", "AsyncAccountDataResource"] + + +class AccountDataResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AccountDataResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AccountDataResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AccountDataResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AccountDataResourceWithStreamingResponse(self) + + def retrieve( + self, + type: str, + *, + user_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, + ) -> object: + """Get some account data for the client. + + This config is only visible to the user + that set the account data. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return self._get( + path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def update( + self, + type: str, + *, + user_id: str, + body: object, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Set some account data for the client. + + This config is only visible to the user + that set the account data. The config will be available to clients through the + top-level `account_data` field in the homeserver response to + [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return self._put( + path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), + body=maybe_transform(body, account_data_update_params.AccountDataUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncAccountDataResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAccountDataResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountDataResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAccountDataResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncAccountDataResourceWithStreamingResponse(self) + + async def retrieve( + self, + type: str, + *, + user_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, + ) -> object: + """Get some account data for the client. + + This config is only visible to the user + that set the account data. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return await self._get( + path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def update( + self, + type: str, + *, + user_id: str, + body: object, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Set some account data for the client. + + This config is only visible to the user + that set the account data. The config will be available to clients through the + top-level `account_data` field in the homeserver response to + [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + if not type: + raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") + return await self._put( + path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), + body=await async_maybe_transform(body, account_data_update_params.AccountDataUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AccountDataResourceWithRawResponse: + def __init__(self, account_data: AccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = to_raw_response_wrapper( + account_data.retrieve, + ) + self.update = to_raw_response_wrapper( + account_data.update, + ) + + +class AsyncAccountDataResourceWithRawResponse: + def __init__(self, account_data: AsyncAccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = async_to_raw_response_wrapper( + account_data.retrieve, + ) + self.update = async_to_raw_response_wrapper( + account_data.update, + ) + + +class AccountDataResourceWithStreamingResponse: + def __init__(self, account_data: AccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = to_streamed_response_wrapper( + account_data.retrieve, + ) + self.update = to_streamed_response_wrapper( + account_data.update, + ) + + +class AsyncAccountDataResourceWithStreamingResponse: + def __init__(self, account_data: AsyncAccountDataResource) -> None: + self._account_data = account_data + + self.retrieve = async_to_streamed_response_wrapper( + account_data.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + account_data.update, + ) diff --git a/src/beeper_desktop_api/resources/matrix/users/users.py b/src/beeper_desktop_api/resources/matrix/users/users.py new file mode 100644 index 0000000..f7bdfb6 --- /dev/null +++ b/src/beeper_desktop_api/resources/matrix/users/users.py @@ -0,0 +1,196 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .account_data import ( + AccountDataResource, + AsyncAccountDataResource, + AccountDataResourceWithRawResponse, + AsyncAccountDataResourceWithRawResponse, + AccountDataResourceWithStreamingResponse, + AsyncAccountDataResourceWithStreamingResponse, +) +from ...._base_client import make_request_options +from ....types.matrix.user_retrieve_profile_response import UserRetrieveProfileResponse + +__all__ = ["UsersResource", "AsyncUsersResource"] + + +class UsersResource(SyncAPIResource): + @cached_property + def account_data(self) -> AccountDataResource: + return AccountDataResource(self._client) + + @cached_property + def with_raw_response(self) -> UsersResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return UsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return UsersResourceWithStreamingResponse(self) + + def retrieve_profile( + self, + user_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, + ) -> UserRetrieveProfileResponse: + """ + Get the complete profile for a user. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + return self._get( + path_template("/_matrix/client/v3/profile/{user_id}", user_id=user_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserRetrieveProfileResponse, + ) + + +class AsyncUsersResource(AsyncAPIResource): + @cached_property + def account_data(self) -> AsyncAccountDataResource: + return AsyncAccountDataResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncUsersResourceWithStreamingResponse(self) + + async def retrieve_profile( + self, + user_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, + ) -> UserRetrieveProfileResponse: + """ + Get the complete profile for a user. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") + return await self._get( + path_template("/_matrix/client/v3/profile/{user_id}", user_id=user_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserRetrieveProfileResponse, + ) + + +class UsersResourceWithRawResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.retrieve_profile = to_raw_response_wrapper( + users.retrieve_profile, + ) + + @cached_property + def account_data(self) -> AccountDataResourceWithRawResponse: + return AccountDataResourceWithRawResponse(self._users.account_data) + + +class AsyncUsersResourceWithRawResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.retrieve_profile = async_to_raw_response_wrapper( + users.retrieve_profile, + ) + + @cached_property + def account_data(self) -> AsyncAccountDataResourceWithRawResponse: + return AsyncAccountDataResourceWithRawResponse(self._users.account_data) + + +class UsersResourceWithStreamingResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.retrieve_profile = to_streamed_response_wrapper( + users.retrieve_profile, + ) + + @cached_property + def account_data(self) -> AccountDataResourceWithStreamingResponse: + return AccountDataResourceWithStreamingResponse(self._users.account_data) + + +class AsyncUsersResourceWithStreamingResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.retrieve_profile = async_to_streamed_response_wrapper( + users.retrieve_profile, + ) + + @cached_property + def account_data(self) -> AsyncAccountDataResourceWithStreamingResponse: + return AsyncAccountDataResourceWithStreamingResponse(self._users.account_data) diff --git a/src/beeper_desktop_api/types/__init__.py b/src/beeper_desktop_api/types/__init__.py index 78ec780..fdfcad3 100644 --- a/src/beeper_desktop_api/types/__init__.py +++ b/src/beeper_desktop_api/types/__init__.py @@ -3,7 +3,14 @@ from __future__ import annotations from .chat import Chat as Chat -from .shared import User as User, Error as Error, Message as Message, Reaction as Reaction, Attachment as Attachment +from .shared import ( + User as User, + Error as Error, + Message as Message, + Reaction as Reaction, + Attachment as Attachment, + AppStateSnapshot as AppStateSnapshot, +) from .account import Account as Account from .focus_response import FocusResponse as FocusResponse from .search_response import SearchResponse as SearchResponse @@ -14,12 +21,15 @@ from .chat_list_response import ChatListResponse as ChatListResponse from .chat_search_params import ChatSearchParams as ChatSearchParams from .chat_update_params import ChatUpdateParams as ChatUpdateParams +from .app_status_response import AppStatusResponse as AppStatusResponse from .asset_upload_params import AssetUploadParams as AssetUploadParams +from .bridge_availability import BridgeAvailability as BridgeAvailability from .chat_archive_params import ChatArchiveParams as ChatArchiveParams from .chat_start_response import ChatStartResponse as ChatStartResponse from .client_focus_params import ClientFocusParams as ClientFocusParams from .message_list_params import MessageListParams as MessageListParams from .message_send_params import MessageSendParams as MessageSendParams +from .bridge_list_response import BridgeListResponse as BridgeListResponse from .chat_create_response import ChatCreateResponse as ChatCreateResponse from .chat_retrieve_params import ChatRetrieveParams as ChatRetrieveParams from .client_search_params import ClientSearchParams as ClientSearchParams diff --git a/src/beeper_desktop_api/types/app/__init__.py b/src/beeper_desktop_api/types/app/__init__.py new file mode 100644 index 0000000..bf025a8 --- /dev/null +++ b/src/beeper_desktop_api/types/app/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .login_email_params import LoginEmailParams as LoginEmailParams +from .login_start_response import LoginStartResponse as LoginStartResponse +from .login_register_params import LoginRegisterParams as LoginRegisterParams +from .login_response_params import LoginResponseParams as LoginResponseParams +from .login_register_response import LoginRegisterResponse as LoginRegisterResponse +from .login_response_response import LoginResponseResponse as LoginResponseResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/__init__.py b/src/beeper_desktop_api/types/app/e2ee/__init__.py new file mode 100644 index 0000000..2cd79cf --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/__init__.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .verification_cancel_params import VerificationCancelParams as VerificationCancelParams +from .verification_create_params import VerificationCreateParams as VerificationCreateParams +from .recovery_code_verify_params import RecoveryCodeVerifyParams as RecoveryCodeVerifyParams +from .verification_accept_response import VerificationAcceptResponse as VerificationAcceptResponse +from .verification_cancel_response import VerificationCancelResponse as VerificationCancelResponse +from .verification_create_response import VerificationCreateResponse as VerificationCreateResponse +from .recovery_code_verify_response import RecoveryCodeVerifyResponse as RecoveryCodeVerifyResponse +from .recovery_code_mark_backed_up_response import RecoveryCodeMarkBackedUpResponse as RecoveryCodeMarkBackedUpResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py new file mode 100644 index 0000000..0299c46 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .reset_create_params import ResetCreateParams as ResetCreateParams +from .reset_confirm_params import ResetConfirmParams as ResetConfirmParams +from .reset_create_response import ResetCreateResponse as ResetCreateResponse +from .reset_confirm_response import ResetConfirmResponse as ResetConfirmResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py new file mode 100644 index 0000000..745927e --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["ResetConfirmParams"] + + +class ResetConfirmParams(TypedDict, total=False): + recovery_code: Required[Annotated[str, PropertyInfo(alias="recoveryCode")]] + """New recovery key returned by the reset step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py new file mode 100644 index 0000000..9ba8280 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "ResetConfirmResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class ResetConfirmResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py new file mode 100644 index 0000000..05928a2 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py @@ -0,0 +1,14 @@ +# 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__ = ["ResetCreateParams"] + + +class ResetCreateParams(TypedDict, total=False): + recovery_code: Annotated[str, PropertyInfo(alias="recoveryCode")] + """Existing recovery key, if the user has it.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py new file mode 100644 index 0000000..8efd2b0 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py @@ -0,0 +1,173 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "ResetCreateResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after creating the new recovery key.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class ResetCreateResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after creating the new recovery key.""" + + recovery_code: str = FieldInfo(alias="recoveryCode") + """New recovery key. Show it once and ask the user to save it.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py new file mode 100644 index 0000000..a9b8f1d --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "RecoveryCodeMarkBackedUpResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class RecoveryCodeMarkBackedUpResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py new file mode 100644 index 0000000..9869a2d --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["RecoveryCodeVerifyParams"] + + +class RecoveryCodeVerifyParams(TypedDict, total=False): + recovery_code: Required[Annotated[str, PropertyInfo(alias="recoveryCode")]] + """Recovery key saved by the user.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py new file mode 100644 index 0000000..4af7794 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "RecoveryCodeVerifyResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class RecoveryCodeVerifyResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/__init__.py b/src/beeper_desktop_api/types/app/e2ee/verification/__init__.py new file mode 100644 index 0000000..d0eff7c --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .qr_scan_params import QrScanParams as QrScanParams +from .qr_scan_response import QrScanResponse as QrScanResponse +from .sa_start_response import SaStartResponse as SaStartResponse +from .sa_confirm_response import SaConfirmResponse as SaConfirmResponse +from .qr_confirm_scanned_response import QrConfirmScannedResponse as QrConfirmScannedResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py new file mode 100644 index 0000000..a2032d8 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "QrConfirmScannedResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class QrConfirmScannedResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py b/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py new file mode 100644 index 0000000..a16f78e --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["QrScanParams"] + + +class QrScanParams(TypedDict, total=False): + data: Required[str] + """QR code payload scanned from the other device.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py new file mode 100644 index 0000000..ef7014b --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "QrScanResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class QrScanResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py new file mode 100644 index 0000000..9f90136 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "SaConfirmResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class SaConfirmResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py new file mode 100644 index 0000000..b68ed95 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "SaStartResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class SaStartResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py b/src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py new file mode 100644 index 0000000..5e3cc0e --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "VerificationAcceptResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class VerificationAcceptResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py b/src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py new file mode 100644 index 0000000..d954b97 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["VerificationCancelParams"] + + +class VerificationCancelParams(TypedDict, total=False): + code: str + """Optional cancellation code.""" + + reason: str + """Optional user-facing cancellation reason.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py b/src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py new file mode 100644 index 0000000..4f19689 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "VerificationCancelResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after the requested step.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class VerificationCancelResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_create_params.py b/src/beeper_desktop_api/types/app/e2ee/verification_create_params.py new file mode 100644 index 0000000..c46feac --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification_create_params.py @@ -0,0 +1,14 @@ +# 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__ = ["VerificationCreateParams"] + + +class VerificationCreateParams(TypedDict, total=False): + user_id: Annotated[str, PropertyInfo(alias="userID")] + """User ID to verify. Defaults to the signed-in user.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_create_response.py b/src/beeper_desktop_api/types/app/e2ee/verification_create_response.py new file mode 100644 index 0000000..d5ccc58 --- /dev/null +++ b/src/beeper_desktop_api/types/app/e2ee/verification_create_response.py @@ -0,0 +1,173 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "VerificationCreateResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after starting verification.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class VerificationCreateResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after starting verification.""" + + verification_id: str = FieldInfo(alias="verificationID") + """Verification ID to pass in verification action paths.""" diff --git a/src/beeper_desktop_api/types/app/login_email_params.py b/src/beeper_desktop_api/types/app/login_email_params.py new file mode 100644 index 0000000..bbf1d19 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_email_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LoginEmailParams"] + + +class LoginEmailParams(TypedDict, total=False): + email: Required[str] + """Email address to send the sign-in code to.""" + + request: Required[str] + """Login request ID returned by the start step.""" diff --git a/src/beeper_desktop_api/types/app/login_register_params.py b/src/beeper_desktop_api/types/app/login_register_params.py new file mode 100644 index 0000000..f6ea523 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_register_params.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LoginRegisterParams"] + + +class LoginRegisterParams(TypedDict, total=False): + accept_terms: Required[Annotated[Literal[True], PropertyInfo(alias="acceptTerms")]] + """ + Confirms that the user accepted the Terms of Use and acknowledged the Privacy + Policy. + """ + + lead_token: Required[Annotated[str, PropertyInfo(alias="leadToken")]] + """Registration token returned by Beeper.""" + + request: Required[str] + """Login request ID returned by the start step.""" + + username: Required[str] + """Username selected by the user.""" diff --git a/src/beeper_desktop_api/types/app/login_register_response.py b/src/beeper_desktop_api/types/app/login_register_response.py new file mode 100644 index 0000000..1296355 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_register_response.py @@ -0,0 +1,207 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "LoginRegisterResponse", + "AppState", + "AppStateE2ee", + "AppStateE2eeSecrets", + "AppStateMatrix", + "AppStateVerification", + "AppStateVerificationError", + "AppStateVerificationSas", + "DesktopAPI", + "Matrix", +] + + +class AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppState(BaseModel): + """Current onboarding state after sign-in.""" + + e2ee: AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[AppStateVerification] = None + """Trusted-device verification progress.""" + + +class DesktopAPI(BaseModel): + """Desktop API credentials for the signed-in app session.""" + + access_token: str = FieldInfo(alias="accessToken") + """Desktop API access token for this app session.""" + + scope: Literal["read write"] + """Granted Desktop API scopes.""" + + token_type: Literal["Bearer"] = FieldInfo(alias="tokenType") + """Access token type.""" + + +class Matrix(BaseModel): + """Account credentials for first-party app setup.""" + + access_token: str = FieldInfo(alias="accessToken") + """Account access token. Returned once for first-party app setup.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class LoginRegisterResponse(BaseModel): + app_state: AppState = FieldInfo(alias="appState") + """Current onboarding state after sign-in.""" + + desktop_api: DesktopAPI = FieldInfo(alias="desktopAPI") + """Desktop API credentials for the signed-in app session.""" + + matrix: Matrix + """Account credentials for first-party app setup.""" diff --git a/src/beeper_desktop_api/types/app/login_response_params.py b/src/beeper_desktop_api/types/app/login_response_params.py new file mode 100644 index 0000000..f218f96 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_response_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LoginResponseParams"] + + +class LoginResponseParams(TypedDict, total=False): + request: Required[str] + """Login request ID returned by the start step.""" + + response: Required[str] + """Sign-in code from the user email.""" diff --git a/src/beeper_desktop_api/types/app/login_response_response.py b/src/beeper_desktop_api/types/app/login_response_response.py new file mode 100644 index 0000000..e28b77d --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_response_response.py @@ -0,0 +1,246 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "LoginResponseResponse", + "UnionMember0", + "UnionMember0AppState", + "UnionMember0AppStateE2ee", + "UnionMember0AppStateE2eeSecrets", + "UnionMember0AppStateMatrix", + "UnionMember0AppStateVerification", + "UnionMember0AppStateVerificationError", + "UnionMember0AppStateVerificationSas", + "UnionMember0DesktopAPI", + "UnionMember0Matrix", + "UnionMember1", + "UnionMember1Copy", +] + + +class UnionMember0AppStateE2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class UnionMember0AppStateE2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: UnionMember0AppStateE2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class UnionMember0AppStateMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class UnionMember0AppStateVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class UnionMember0AppStateVerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class UnionMember0AppStateVerification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[UnionMember0AppStateVerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[UnionMember0AppStateVerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class UnionMember0AppState(BaseModel): + """Current onboarding state after sign-in.""" + + e2ee: UnionMember0AppStateE2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[UnionMember0AppStateMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[UnionMember0AppStateVerification] = None + """Trusted-device verification progress.""" + + +class UnionMember0DesktopAPI(BaseModel): + """Desktop API credentials for the signed-in app session.""" + + access_token: str = FieldInfo(alias="accessToken") + """Desktop API access token for this app session.""" + + scope: Literal["read write"] + """Granted Desktop API scopes.""" + + token_type: Literal["Bearer"] = FieldInfo(alias="tokenType") + """Access token type.""" + + +class UnionMember0Matrix(BaseModel): + """Account credentials for first-party app setup.""" + + access_token: str = FieldInfo(alias="accessToken") + """Account access token. Returned once for first-party app setup.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class UnionMember0(BaseModel): + app_state: UnionMember0AppState = FieldInfo(alias="appState") + """Current onboarding state after sign-in.""" + + desktop_api: UnionMember0DesktopAPI = FieldInfo(alias="desktopAPI") + """Desktop API credentials for the signed-in app session.""" + + matrix: UnionMember0Matrix + """Account credentials for first-party app setup.""" + + +class UnionMember1Copy(BaseModel): + """Copy to display during account creation.""" + + submit: Literal["Continue"] + """Submit button label.""" + + terms: Literal["By continuing, you agree to the Terms of Use and acknowledge the Privacy Policy."] + """Terms and privacy notice to show before account creation.""" + + title: Literal["Choose your username"] + """Title for the username step.""" + + username_placeholder: Literal["Username"] = FieldInfo(alias="usernamePlaceholder") + """Placeholder for the username field.""" + + +class UnionMember1(BaseModel): + copy_: UnionMember1Copy = FieldInfo(alias="copy") + """Copy to display during account creation.""" + + lead_token: str = FieldInfo(alias="leadToken") + """Registration token returned by Beeper.""" + + registration_required: Literal[True] = FieldInfo(alias="registrationRequired") + """Indicates that the user needs to create a Beeper account.""" + + request: str + """Login request ID to use when creating the account.""" + + username_suggestions: Optional[List[str]] = FieldInfo(alias="usernameSuggestions", default=None) + """Suggested usernames for the new account.""" + + +LoginResponseResponse: TypeAlias = Union[UnionMember0, UnionMember1] diff --git a/src/beeper_desktop_api/types/app/login_start_response.py b/src/beeper_desktop_api/types/app/login_start_response.py new file mode 100644 index 0000000..d108b0d --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_start_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["LoginStartResponse"] + + +class LoginStartResponse(BaseModel): + request: str + """Login request ID to use in the next sign-in step.""" + + type: List[str] + """Available sign-in methods for this request.""" diff --git a/src/beeper_desktop_api/types/app_status_response.py b/src/beeper_desktop_api/types/app_status_response.py new file mode 100644 index 0000000..dbc8499 --- /dev/null +++ b/src/beeper_desktop_api/types/app_status_response.py @@ -0,0 +1,154 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["AppStatusResponse", "E2ee", "E2eeSecrets", "Matrix", "Verification", "VerificationError", "VerificationSas"] + + +class E2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class E2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: E2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class Matrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[VerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppStatusResponse(BaseModel): + e2ee: E2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[Matrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[Verification] = None + """Trusted-device verification progress.""" diff --git a/src/beeper_desktop_api/types/bridge_availability.py b/src/beeper_desktop_api/types/bridge_availability.py new file mode 100644 index 0000000..abf7746 --- /dev/null +++ b/src/beeper_desktop_api/types/bridge_availability.py @@ -0,0 +1,63 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .account import Account +from .._models import BaseModel + +__all__ = ["BridgeAvailability", "Bridge"] + + +class Bridge(BaseModel): + """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" + + id: str + """Bridge instance identifier. + + Matrix and cloud bridges often use the bridge type (for example matrix or + discordgo); local bridges use a local bridge ID (for example local-whatsapp). + Available in Beeper Desktop v4.2.785+. + """ + + provider: Literal["cloud", "self-hosted", "local", "platform-sdk"] + """Bridge provider for the account. Available in Beeper Desktop v4.2.785+.""" + + type: str + """Bridge type, such as matrix, discordgo, slackgo, whatsapp, telegram, or twitter. + + Available in Beeper Desktop v4.2.785+. + """ + + +class BridgeAvailability(BaseModel): + """Bridge-backed account type that can be shown in add-account flows.""" + + accounts: List[Account] + """Connected accounts for this bridge. + + Uses the same Account schema as GET /v1/accounts. + """ + + active_account_count: int = FieldInfo(alias="activeAccountCount") + """Number of active accounts for this network on this device.""" + + bridge: Bridge + """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" + + display_name: str = FieldInfo(alias="displayName") + """Human-friendly account type name shown in Beeper Desktop.""" + + login_mode: str = FieldInfo(alias="loginMode") + """Login mode used by Beeper Desktop for this bridge.""" + + status: Literal["available", "connected", "limit_reached", "temporarily_unavailable"] + """Whether this bridge can currently be used to add an account.""" + + network: Optional[str] = None + """Network grouping used for account counts and limits.""" + + status_text: Optional[str] = FieldInfo(alias="statusText", default=None) + """Human-friendly status text matching Beeper Desktop account management language.""" diff --git a/src/beeper_desktop_api/types/bridge_list_response.py b/src/beeper_desktop_api/types/bridge_list_response.py new file mode 100644 index 0000000..fc09661 --- /dev/null +++ b/src/beeper_desktop_api/types/bridge_list_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .bridge_availability import BridgeAvailability + +__all__ = ["BridgeListResponse"] + + +class BridgeListResponse(BaseModel): + """Bridge-backed account types and their connected accounts.""" + + items: List[BridgeAvailability] diff --git a/src/beeper_desktop_api/types/matrix/__init__.py b/src/beeper_desktop_api/types/matrix/__init__.py new file mode 100644 index 0000000..1dfecfe --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .room_join_params import RoomJoinParams as RoomJoinParams +from .room_leave_params import RoomLeaveParams as RoomLeaveParams +from .room_create_params import RoomCreateParams as RoomCreateParams +from .room_join_response import RoomJoinResponse as RoomJoinResponse +from .room_create_response import RoomCreateResponse as RoomCreateResponse +from .user_retrieve_profile_response import UserRetrieveProfileResponse as UserRetrieveProfileResponse diff --git a/src/beeper_desktop_api/types/matrix/bridges/__init__.py b/src/beeper_desktop_api/types/matrix/bridges/__init__.py new file mode 100644 index 0000000..ff6da5f --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/__init__.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .user_search_params import UserSearchParams as UserSearchParams +from .contact_list_params import ContactListParams as ContactListParams +from .user_resolve_params import UserResolveParams as UserResolveParams +from .auth_whoami_response import AuthWhoamiResponse as AuthWhoamiResponse +from .user_search_response import UserSearchResponse as UserSearchResponse +from .contact_list_response import ContactListResponse as ContactListResponse +from .room_create_dm_params import RoomCreateDmParams as RoomCreateDmParams +from .user_resolve_response import UserResolveResponse as UserResolveResponse +from .auth_start_login_params import AuthStartLoginParams as AuthStartLoginParams +from .room_create_dm_response import RoomCreateDmResponse as RoomCreateDmResponse +from .auth_list_flows_response import AuthListFlowsResponse as AuthListFlowsResponse +from .room_create_group_params import RoomCreateGroupParams as RoomCreateGroupParams +from .auth_list_logins_response import AuthListLoginsResponse as AuthListLoginsResponse +from .auth_start_login_response import AuthStartLoginResponse as AuthStartLoginResponse +from .auth_submit_cookies_params import AuthSubmitCookiesParams as AuthSubmitCookiesParams +from .room_create_group_response import RoomCreateGroupResponse as RoomCreateGroupResponse +from .auth_wait_for_step_response import AuthWaitForStepResponse as AuthWaitForStepResponse +from .auth_submit_cookies_response import AuthSubmitCookiesResponse as AuthSubmitCookiesResponse +from .capability_retrieve_response import CapabilityRetrieveResponse as CapabilityRetrieveResponse +from .auth_submit_user_input_params import AuthSubmitUserInputParams as AuthSubmitUserInputParams +from .auth_submit_user_input_response import AuthSubmitUserInputResponse as AuthSubmitUserInputResponse diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py new file mode 100644 index 0000000..05de99c --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["AuthListFlowsResponse", "Flow"] + + +class Flow(BaseModel): + """An individual login flow which can be used to sign into the remote network.""" + + id: str + """ + An internal ID that is passed to the /login/start call to start a login with + this flow. + """ + + description: str + """A human-readable description of the login flow.""" + + name: str + """A human-readable name for the login flow.""" + + +class AuthListFlowsResponse(BaseModel): + flows: Optional[List[Flow]] = None diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py new file mode 100644 index 0000000..a0e9d3a --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["AuthListLoginsResponse"] + + +class AuthListLoginsResponse(BaseModel): + login_ids: Optional[List[str]] = None diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py b/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py new file mode 100644 index 0000000..83368eb --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AuthStartLoginParams"] + + +class AuthStartLoginParams(TypedDict, total=False): + bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] + + login_id: str + """An existing login ID to re-login as. + + If this is specified and the user logs into a different account, the provided ID + will be logged out. + """ diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py new file mode 100644 index 0000000..a63c5d6 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py @@ -0,0 +1,278 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel + +__all__ = [ + "AuthStartLoginResponse", + "UnionMember0", + "UnionMember0DisplayAndWait", + "UnionMember1", + "UnionMember1UserInput", + "UnionMember1UserInputField", + "UnionMember1UserInputAttachment", + "UnionMember1UserInputAttachmentInfo", + "UnionMember2", + "UnionMember2Cookies", + "UnionMember2CookiesField", + "UnionMember3", + "UnionMember3Complete", +] + + +class UnionMember0DisplayAndWait(BaseModel): + """Parameters for the display and wait login step""" + + type: Literal["qr", "emoji", "code", "nothing"] + """The type of thing to display""" + + data: Optional[str] = None + """ + The thing to display (raw data for QR, unicode emoji for emoji, plain string for + code) + """ + + image_url: Optional[str] = None + """An image containing the thing to display. + + If present, this is recommended over using data directly. For emojis, the URL to + the canonical image representation of the emoji + """ + + +class UnionMember0(BaseModel): + """Display and wait login step""" + + display_and_wait: UnionMember0DisplayAndWait + """Parameters for the display and wait login step""" + + type: Literal["display_and_wait"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember1UserInputField(BaseModel): + """A field that the user can fill.""" + + id: str + """The internal ID of the field. + + This must be used as the key in the object when submitting the data back to the + bridge. + """ + + name: str + """The name of the field shown to the user.""" + + type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] + """The type of field.""" + + default_value: Optional[str] = None + """A default value that the client can pre-fill the field with.""" + + description: Optional[str] = None + """A more detailed description of the field shown to the user.""" + + options: Optional[List[str]] = None + """For fields of type select, the valid options.""" + + pattern: Optional[str] = None + """A regular expression that the field value must match.""" + + +class UnionMember1UserInputAttachmentInfo(BaseModel): + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + h: Optional[float] = None + """The height of the media in pixels. Only applicable for images and videos.""" + + mimetype: Optional[str] = None + """The MIME type for the media content.""" + + size: Optional[float] = None + """The size of the media content in number of bytes. + + Strongly recommended to include. + """ + + w: Optional[float] = None + """The width of the media in pixels. Only applicable for images and videos.""" + + +class UnionMember1UserInputAttachment(BaseModel): + """A media attachment to show the user.""" + + content: str + """The raw file content for the attachment encoded in base64.""" + + filename: str + """The filename for the media attachment.""" + + type: Literal["m.image", "m.audio"] + """ + The type of media attachment, using the same media type identifiers as Matrix + attachments. Only some are supported. + """ + + info: Optional[UnionMember1UserInputAttachmentInfo] = None + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + +class UnionMember1UserInput(BaseModel): + """Parameters for the user input login step""" + + fields: List[UnionMember1UserInputField] + """The list of fields that the user is requested to fill.""" + + attachments: Optional[List[UnionMember1UserInputAttachment]] = None + """A list of media attachments to show the user alongside the form fields.""" + + +class UnionMember1(BaseModel): + """User input login step""" + + type: Literal["user_input"] + + user_input: UnionMember1UserInput + """Parameters for the user input login step""" + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember2CookiesField(BaseModel): + """An individual cookie or other stored data item that must be extracted.""" + + name: str + """The name of the item to extract.""" + + type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] + """The type of data to extract.""" + + cookie_domain: Optional[str] = None + """For the `cookie` type, the domain of the cookie.""" + + request_url_regex: Optional[str] = None + """ + For the `request_header` and `request_body` types, a regex that matches the URLs + from which the values can be extracted. + """ + + +class UnionMember2Cookies(BaseModel): + """Parameters for the cookie login step""" + + fields: List[UnionMember2CookiesField] + """The list of cookies or other stored data that must be extracted.""" + + url: str + """The URL to open when using a webview to extract cookies.""" + + extract_js: Optional[str] = None + """ + A JavaScript snippet that can extract some or all of the fields. The snippet + will evaluate to a promise that resolves when the relevant fields are found. + Fields that are not present in the promise result must be extracted another way. + """ + + user_agent: Optional[str] = None + """An optional user agent that the webview should use.""" + + wait_for_url_pattern: Optional[str] = None + """A regex pattern that the URL should match before the client closes the webview. + + The client may submit the login if the user closes the webview after all cookies + are collected even if this URL is not reached, but it should only automatically + close the webview after both cookies and the URL match. + """ + + +class UnionMember2(BaseModel): + """Cookie login step""" + + cookies: UnionMember2Cookies + """Parameters for the cookie login step""" + + type: Literal["cookies"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember3Complete(BaseModel): + """Information about the completed login""" + + user_login_id: Optional[str] = None + """The unique ID of a login. Defined by the network connector.""" + + +class UnionMember3(BaseModel): + """Login complete""" + + complete: UnionMember3Complete + """Information about the completed login""" + + type: Literal["complete"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +AuthStartLoginResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py new file mode 100644 index 0000000..21a5979 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AuthSubmitCookiesParams"] + + +class AuthSubmitCookiesParams(TypedDict, total=False): + bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] + + login_process_id: Required[Annotated[str, PropertyInfo(alias="loginProcessID")]] + + body: Required[Dict[str, str]] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py new file mode 100644 index 0000000..a4c0ce0 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py @@ -0,0 +1,278 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel + +__all__ = [ + "AuthSubmitCookiesResponse", + "UnionMember0", + "UnionMember0DisplayAndWait", + "UnionMember1", + "UnionMember1UserInput", + "UnionMember1UserInputField", + "UnionMember1UserInputAttachment", + "UnionMember1UserInputAttachmentInfo", + "UnionMember2", + "UnionMember2Cookies", + "UnionMember2CookiesField", + "UnionMember3", + "UnionMember3Complete", +] + + +class UnionMember0DisplayAndWait(BaseModel): + """Parameters for the display and wait login step""" + + type: Literal["qr", "emoji", "code", "nothing"] + """The type of thing to display""" + + data: Optional[str] = None + """ + The thing to display (raw data for QR, unicode emoji for emoji, plain string for + code) + """ + + image_url: Optional[str] = None + """An image containing the thing to display. + + If present, this is recommended over using data directly. For emojis, the URL to + the canonical image representation of the emoji + """ + + +class UnionMember0(BaseModel): + """Display and wait login step""" + + display_and_wait: UnionMember0DisplayAndWait + """Parameters for the display and wait login step""" + + type: Literal["display_and_wait"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember1UserInputField(BaseModel): + """A field that the user can fill.""" + + id: str + """The internal ID of the field. + + This must be used as the key in the object when submitting the data back to the + bridge. + """ + + name: str + """The name of the field shown to the user.""" + + type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] + """The type of field.""" + + default_value: Optional[str] = None + """A default value that the client can pre-fill the field with.""" + + description: Optional[str] = None + """A more detailed description of the field shown to the user.""" + + options: Optional[List[str]] = None + """For fields of type select, the valid options.""" + + pattern: Optional[str] = None + """A regular expression that the field value must match.""" + + +class UnionMember1UserInputAttachmentInfo(BaseModel): + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + h: Optional[float] = None + """The height of the media in pixels. Only applicable for images and videos.""" + + mimetype: Optional[str] = None + """The MIME type for the media content.""" + + size: Optional[float] = None + """The size of the media content in number of bytes. + + Strongly recommended to include. + """ + + w: Optional[float] = None + """The width of the media in pixels. Only applicable for images and videos.""" + + +class UnionMember1UserInputAttachment(BaseModel): + """A media attachment to show the user.""" + + content: str + """The raw file content for the attachment encoded in base64.""" + + filename: str + """The filename for the media attachment.""" + + type: Literal["m.image", "m.audio"] + """ + The type of media attachment, using the same media type identifiers as Matrix + attachments. Only some are supported. + """ + + info: Optional[UnionMember1UserInputAttachmentInfo] = None + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + +class UnionMember1UserInput(BaseModel): + """Parameters for the user input login step""" + + fields: List[UnionMember1UserInputField] + """The list of fields that the user is requested to fill.""" + + attachments: Optional[List[UnionMember1UserInputAttachment]] = None + """A list of media attachments to show the user alongside the form fields.""" + + +class UnionMember1(BaseModel): + """User input login step""" + + type: Literal["user_input"] + + user_input: UnionMember1UserInput + """Parameters for the user input login step""" + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember2CookiesField(BaseModel): + """An individual cookie or other stored data item that must be extracted.""" + + name: str + """The name of the item to extract.""" + + type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] + """The type of data to extract.""" + + cookie_domain: Optional[str] = None + """For the `cookie` type, the domain of the cookie.""" + + request_url_regex: Optional[str] = None + """ + For the `request_header` and `request_body` types, a regex that matches the URLs + from which the values can be extracted. + """ + + +class UnionMember2Cookies(BaseModel): + """Parameters for the cookie login step""" + + fields: List[UnionMember2CookiesField] + """The list of cookies or other stored data that must be extracted.""" + + url: str + """The URL to open when using a webview to extract cookies.""" + + extract_js: Optional[str] = None + """ + A JavaScript snippet that can extract some or all of the fields. The snippet + will evaluate to a promise that resolves when the relevant fields are found. + Fields that are not present in the promise result must be extracted another way. + """ + + user_agent: Optional[str] = None + """An optional user agent that the webview should use.""" + + wait_for_url_pattern: Optional[str] = None + """A regex pattern that the URL should match before the client closes the webview. + + The client may submit the login if the user closes the webview after all cookies + are collected even if this URL is not reached, but it should only automatically + close the webview after both cookies and the URL match. + """ + + +class UnionMember2(BaseModel): + """Cookie login step""" + + cookies: UnionMember2Cookies + """Parameters for the cookie login step""" + + type: Literal["cookies"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember3Complete(BaseModel): + """Information about the completed login""" + + user_login_id: Optional[str] = None + """The unique ID of a login. Defined by the network connector.""" + + +class UnionMember3(BaseModel): + """Login complete""" + + complete: UnionMember3Complete + """Information about the completed login""" + + type: Literal["complete"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +AuthSubmitCookiesResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py new file mode 100644 index 0000000..edbb7db --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AuthSubmitUserInputParams"] + + +class AuthSubmitUserInputParams(TypedDict, total=False): + bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] + + login_process_id: Required[Annotated[str, PropertyInfo(alias="loginProcessID")]] + + body: Required[Dict[str, str]] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py new file mode 100644 index 0000000..0f2808d --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py @@ -0,0 +1,278 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel + +__all__ = [ + "AuthSubmitUserInputResponse", + "UnionMember0", + "UnionMember0DisplayAndWait", + "UnionMember1", + "UnionMember1UserInput", + "UnionMember1UserInputField", + "UnionMember1UserInputAttachment", + "UnionMember1UserInputAttachmentInfo", + "UnionMember2", + "UnionMember2Cookies", + "UnionMember2CookiesField", + "UnionMember3", + "UnionMember3Complete", +] + + +class UnionMember0DisplayAndWait(BaseModel): + """Parameters for the display and wait login step""" + + type: Literal["qr", "emoji", "code", "nothing"] + """The type of thing to display""" + + data: Optional[str] = None + """ + The thing to display (raw data for QR, unicode emoji for emoji, plain string for + code) + """ + + image_url: Optional[str] = None + """An image containing the thing to display. + + If present, this is recommended over using data directly. For emojis, the URL to + the canonical image representation of the emoji + """ + + +class UnionMember0(BaseModel): + """Display and wait login step""" + + display_and_wait: UnionMember0DisplayAndWait + """Parameters for the display and wait login step""" + + type: Literal["display_and_wait"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember1UserInputField(BaseModel): + """A field that the user can fill.""" + + id: str + """The internal ID of the field. + + This must be used as the key in the object when submitting the data back to the + bridge. + """ + + name: str + """The name of the field shown to the user.""" + + type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] + """The type of field.""" + + default_value: Optional[str] = None + """A default value that the client can pre-fill the field with.""" + + description: Optional[str] = None + """A more detailed description of the field shown to the user.""" + + options: Optional[List[str]] = None + """For fields of type select, the valid options.""" + + pattern: Optional[str] = None + """A regular expression that the field value must match.""" + + +class UnionMember1UserInputAttachmentInfo(BaseModel): + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + h: Optional[float] = None + """The height of the media in pixels. Only applicable for images and videos.""" + + mimetype: Optional[str] = None + """The MIME type for the media content.""" + + size: Optional[float] = None + """The size of the media content in number of bytes. + + Strongly recommended to include. + """ + + w: Optional[float] = None + """The width of the media in pixels. Only applicable for images and videos.""" + + +class UnionMember1UserInputAttachment(BaseModel): + """A media attachment to show the user.""" + + content: str + """The raw file content for the attachment encoded in base64.""" + + filename: str + """The filename for the media attachment.""" + + type: Literal["m.image", "m.audio"] + """ + The type of media attachment, using the same media type identifiers as Matrix + attachments. Only some are supported. + """ + + info: Optional[UnionMember1UserInputAttachmentInfo] = None + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + +class UnionMember1UserInput(BaseModel): + """Parameters for the user input login step""" + + fields: List[UnionMember1UserInputField] + """The list of fields that the user is requested to fill.""" + + attachments: Optional[List[UnionMember1UserInputAttachment]] = None + """A list of media attachments to show the user alongside the form fields.""" + + +class UnionMember1(BaseModel): + """User input login step""" + + type: Literal["user_input"] + + user_input: UnionMember1UserInput + """Parameters for the user input login step""" + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember2CookiesField(BaseModel): + """An individual cookie or other stored data item that must be extracted.""" + + name: str + """The name of the item to extract.""" + + type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] + """The type of data to extract.""" + + cookie_domain: Optional[str] = None + """For the `cookie` type, the domain of the cookie.""" + + request_url_regex: Optional[str] = None + """ + For the `request_header` and `request_body` types, a regex that matches the URLs + from which the values can be extracted. + """ + + +class UnionMember2Cookies(BaseModel): + """Parameters for the cookie login step""" + + fields: List[UnionMember2CookiesField] + """The list of cookies or other stored data that must be extracted.""" + + url: str + """The URL to open when using a webview to extract cookies.""" + + extract_js: Optional[str] = None + """ + A JavaScript snippet that can extract some or all of the fields. The snippet + will evaluate to a promise that resolves when the relevant fields are found. + Fields that are not present in the promise result must be extracted another way. + """ + + user_agent: Optional[str] = None + """An optional user agent that the webview should use.""" + + wait_for_url_pattern: Optional[str] = None + """A regex pattern that the URL should match before the client closes the webview. + + The client may submit the login if the user closes the webview after all cookies + are collected even if this URL is not reached, but it should only automatically + close the webview after both cookies and the URL match. + """ + + +class UnionMember2(BaseModel): + """Cookie login step""" + + cookies: UnionMember2Cookies + """Parameters for the cookie login step""" + + type: Literal["cookies"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember3Complete(BaseModel): + """Information about the completed login""" + + user_login_id: Optional[str] = None + """The unique ID of a login. Defined by the network connector.""" + + +class UnionMember3(BaseModel): + """Login complete""" + + complete: UnionMember3Complete + """Information about the completed login""" + + type: Literal["complete"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +AuthSubmitUserInputResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py new file mode 100644 index 0000000..bd2fb65 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py @@ -0,0 +1,278 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel + +__all__ = [ + "AuthWaitForStepResponse", + "UnionMember0", + "UnionMember0DisplayAndWait", + "UnionMember1", + "UnionMember1UserInput", + "UnionMember1UserInputField", + "UnionMember1UserInputAttachment", + "UnionMember1UserInputAttachmentInfo", + "UnionMember2", + "UnionMember2Cookies", + "UnionMember2CookiesField", + "UnionMember3", + "UnionMember3Complete", +] + + +class UnionMember0DisplayAndWait(BaseModel): + """Parameters for the display and wait login step""" + + type: Literal["qr", "emoji", "code", "nothing"] + """The type of thing to display""" + + data: Optional[str] = None + """ + The thing to display (raw data for QR, unicode emoji for emoji, plain string for + code) + """ + + image_url: Optional[str] = None + """An image containing the thing to display. + + If present, this is recommended over using data directly. For emojis, the URL to + the canonical image representation of the emoji + """ + + +class UnionMember0(BaseModel): + """Display and wait login step""" + + display_and_wait: UnionMember0DisplayAndWait + """Parameters for the display and wait login step""" + + type: Literal["display_and_wait"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember1UserInputField(BaseModel): + """A field that the user can fill.""" + + id: str + """The internal ID of the field. + + This must be used as the key in the object when submitting the data back to the + bridge. + """ + + name: str + """The name of the field shown to the user.""" + + type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] + """The type of field.""" + + default_value: Optional[str] = None + """A default value that the client can pre-fill the field with.""" + + description: Optional[str] = None + """A more detailed description of the field shown to the user.""" + + options: Optional[List[str]] = None + """For fields of type select, the valid options.""" + + pattern: Optional[str] = None + """A regular expression that the field value must match.""" + + +class UnionMember1UserInputAttachmentInfo(BaseModel): + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + h: Optional[float] = None + """The height of the media in pixels. Only applicable for images and videos.""" + + mimetype: Optional[str] = None + """The MIME type for the media content.""" + + size: Optional[float] = None + """The size of the media content in number of bytes. + + Strongly recommended to include. + """ + + w: Optional[float] = None + """The width of the media in pixels. Only applicable for images and videos.""" + + +class UnionMember1UserInputAttachment(BaseModel): + """A media attachment to show the user.""" + + content: str + """The raw file content for the attachment encoded in base64.""" + + filename: str + """The filename for the media attachment.""" + + type: Literal["m.image", "m.audio"] + """ + The type of media attachment, using the same media type identifiers as Matrix + attachments. Only some are supported. + """ + + info: Optional[UnionMember1UserInputAttachmentInfo] = None + """Optional but recommended metadata for the attachment. + + Can generally be derived from the raw content if omitted. + """ + + +class UnionMember1UserInput(BaseModel): + """Parameters for the user input login step""" + + fields: List[UnionMember1UserInputField] + """The list of fields that the user is requested to fill.""" + + attachments: Optional[List[UnionMember1UserInputAttachment]] = None + """A list of media attachments to show the user alongside the form fields.""" + + +class UnionMember1(BaseModel): + """User input login step""" + + type: Literal["user_input"] + + user_input: UnionMember1UserInput + """Parameters for the user input login step""" + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember2CookiesField(BaseModel): + """An individual cookie or other stored data item that must be extracted.""" + + name: str + """The name of the item to extract.""" + + type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] + """The type of data to extract.""" + + cookie_domain: Optional[str] = None + """For the `cookie` type, the domain of the cookie.""" + + request_url_regex: Optional[str] = None + """ + For the `request_header` and `request_body` types, a regex that matches the URLs + from which the values can be extracted. + """ + + +class UnionMember2Cookies(BaseModel): + """Parameters for the cookie login step""" + + fields: List[UnionMember2CookiesField] + """The list of cookies or other stored data that must be extracted.""" + + url: str + """The URL to open when using a webview to extract cookies.""" + + extract_js: Optional[str] = None + """ + A JavaScript snippet that can extract some or all of the fields. The snippet + will evaluate to a promise that resolves when the relevant fields are found. + Fields that are not present in the promise result must be extracted another way. + """ + + user_agent: Optional[str] = None + """An optional user agent that the webview should use.""" + + wait_for_url_pattern: Optional[str] = None + """A regex pattern that the URL should match before the client closes the webview. + + The client may submit the login if the user closes the webview after all cookies + are collected even if this URL is not reached, but it should only automatically + close the webview after both cookies and the URL match. + """ + + +class UnionMember2(BaseModel): + """Cookie login step""" + + cookies: UnionMember2Cookies + """Parameters for the cookie login step""" + + type: Literal["cookies"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +class UnionMember3Complete(BaseModel): + """Information about the completed login""" + + user_login_id: Optional[str] = None + """The unique ID of a login. Defined by the network connector.""" + + +class UnionMember3(BaseModel): + """Login complete""" + + complete: UnionMember3Complete + """Information about the completed login""" + + type: Literal["complete"] + + instructions: Optional[str] = None + """Human-readable instructions for completing this login step.""" + + login_id: Optional[str] = None + """An identifier for the current login process. + + Must be passed to execute more steps of the login. + """ + + step_id: Optional[str] = None + """An unique ID identifying this step. + + This can be used to implement special behavior in clients. + """ + + +AuthWaitForStepResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py new file mode 100644 index 0000000..7bd7db7 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py @@ -0,0 +1,128 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AuthWhoamiResponse", "LoginFlow", "Login", "LoginProfile", "LoginState", "Network"] + + +class LoginFlow(BaseModel): + """An individual login flow which can be used to sign into the remote network.""" + + id: str + """ + An internal ID that is passed to the /login/start call to start a login with + this flow. + """ + + description: str + """A human-readable description of the login flow.""" + + name: str + """A human-readable name for the login flow.""" + + +class LoginProfile(BaseModel): + """The profile info of the logged-in user on the remote network.""" + + avatar: Optional[str] = None + """The user's avatar""" + + email: Optional[str] = None + """The user's email address""" + + name: Optional[str] = None + """The user's displayname""" + + phone: Optional[str] = None + """The user's phone number""" + + username: Optional[str] = None + """The user's username""" + + +class LoginState(BaseModel): + """The connection status of an individual login""" + + state_event: Literal["CONNECTING", "CONNECTED", "TRANSIENT_DISCONNECT", "BAD_CREDENTIALS", "UNKNOWN_ERROR"] + """The current state of this login.""" + + timestamp: float + """The time when the state was last updated.""" + + error: Optional[str] = None + """An error code defined by the network connector.""" + + info: Optional[object] = None + """Additional arbitrary info provided by the network connector.""" + + message: Optional[str] = None + """A human-readable error message defined by the network connector.""" + + reason: Optional[str] = None + """A reason code for non-error states that aren't exactly successes either.""" + + +class Login(BaseModel): + """The info of an individual login""" + + id: str + """The unique ID of a login. Defined by the network connector.""" + + name: str + """A human-readable name for the login. Defined by the network connector.""" + + profile: LoginProfile + """The profile info of the logged-in user on the remote network.""" + + state: LoginState + """The connection status of an individual login""" + + space_room: Optional[str] = None + """The personal filtering space room ID for this login.""" + + +class Network(BaseModel): + """Info about the network that the bridge is bridging to.""" + + beeper_bridge_type: str + """An identifier uniquely identifying the bridge software.""" + + displayname: str + """The displayname of the network.""" + + network_icon: str + """The icon of the network as a `mxc://` URI.""" + + network_id: str + """An identifier uniquely identifying the network.""" + + network_url: str + """The URL to the website of the network.""" + + +class AuthWhoamiResponse(BaseModel): + """Info about the bridge and user""" + + bridge_bot: str + """The Matrix user ID of the bridge bot.""" + + command_prefix: str + """The command prefix used by this bridge.""" + + homeserver: str + """The server name the bridge is running on.""" + + login_flows: List[LoginFlow] + """The login flows that the bridge supports.""" + + logins: List[Login] + """The logins of the user who made the /whoami call""" + + network: Network + """Info about the network that the bridge is bridging to.""" + + management_room: Optional[str] = None + """The Matrix management room ID of the user who made the /whoami call.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py b/src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py new file mode 100644 index 0000000..18c6716 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["CapabilityRetrieveResponse"] + +CapabilityRetrieveResponse: TypeAlias = Dict[str, object] diff --git a/src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py b/src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py new file mode 100644 index 0000000..73465db --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ContactListParams"] + + +class ContactListParams(TypedDict, total=False): + login_id: str + """An optional explicit login ID to do the action through.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py b/src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py new file mode 100644 index 0000000..c0b51dc --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["ContactListResponse", "Contact"] + + +class Contact(BaseModel): + """A successfully resolved identifier.""" + + id: str + """The internal user ID of the resolved user.""" + + avatar_url: Optional[str] = None + """The avatar of the user on the remote network.""" + + dm_room_mxid: Optional[str] = None + """The Matrix room ID of the direct chat with the user.""" + + identifiers: Optional[List[str]] = None + """A list of identifiers for the user on the remote network.""" + + mxid: Optional[str] = None + """The Matrix user ID of the ghost representing the user.""" + + name: Optional[str] = None + """The name of the user on the remote network.""" + + +class ContactListResponse(BaseModel): + contacts: Optional[List[Contact]] = None diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py new file mode 100644 index 0000000..5535a29 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["RoomCreateDmParams"] + + +class RoomCreateDmParams(TypedDict, total=False): + bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] + + login_id: str + """An optional explicit login ID to do the action through.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py new file mode 100644 index 0000000..f15debc --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["RoomCreateDmResponse"] + + +class RoomCreateDmResponse(BaseModel): + """A successfully resolved identifier.""" + + id: str + """The internal user ID of the resolved user.""" + + avatar_url: Optional[str] = None + """The avatar of the user on the remote network.""" + + dm_room_mxid: Optional[str] = None + """The Matrix room ID of the direct chat with the user.""" + + identifiers: Optional[List[str]] = None + """A list of identifiers for the user on the remote network.""" + + mxid: Optional[str] = None + """The Matrix user ID of the ghost representing the user.""" + + name: Optional[str] = None + """The name of the user on the remote network.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py new file mode 100644 index 0000000..de9c10d --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py @@ -0,0 +1,72 @@ +# 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__ = ["RoomCreateGroupParams", "Avatar", "Disappear", "Name", "Topic"] + + +class RoomCreateGroupParams(TypedDict, total=False): + bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] + + login_id: str + """An optional explicit login ID to do the action through.""" + + avatar: Avatar + """The `m.room.avatar` event content for the room.""" + + disappear: Disappear + """The `com.beeper.disappearing_timer` event content for the room.""" + + name: Name + """The `m.room.name` event content for the room.""" + + parent: object + + participants: SequenceNotStr[str] + """The users to add to the group initially.""" + + room_id: str + """ + An existing Matrix room ID to bridge to. The other parameters must be already in + sync with the room state when using this parameter. + """ + + topic: Topic + """The `m.room.topic` event content for the room.""" + + type: str + """The type of group to create.""" + + username: str + """The public username for the created group.""" + + +class Avatar(TypedDict, total=False): + """The `m.room.avatar` event content for the room.""" + + url: str + + +class Disappear(TypedDict, total=False): + """The `com.beeper.disappearing_timer` event content for the room.""" + + timer: float + + type: str + + +class Name(TypedDict, total=False): + """The `m.room.name` event content for the room.""" + + name: str + + +class Topic(TypedDict, total=False): + """The `m.room.topic` event content for the room.""" + + topic: str diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py new file mode 100644 index 0000000..824275b --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["RoomCreateGroupResponse"] + + +class RoomCreateGroupResponse(BaseModel): + """A successfully created group chat.""" + + id: str + """The internal chat ID of the created group.""" + + mxid: str + """The Matrix room ID of the portal.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py b/src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py new file mode 100644 index 0000000..46d6b21 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["UserResolveParams"] + + +class UserResolveParams(TypedDict, total=False): + bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] + + login_id: str + """An optional explicit login ID to do the action through.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py b/src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py new file mode 100644 index 0000000..22b2517 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["UserResolveResponse"] + + +class UserResolveResponse(BaseModel): + """A successfully resolved identifier.""" + + id: str + """The internal user ID of the resolved user.""" + + avatar_url: Optional[str] = None + """The avatar of the user on the remote network.""" + + dm_room_mxid: Optional[str] = None + """The Matrix room ID of the direct chat with the user.""" + + identifiers: Optional[List[str]] = None + """A list of identifiers for the user on the remote network.""" + + mxid: Optional[str] = None + """The Matrix user ID of the ghost representing the user.""" + + name: Optional[str] = None + """The name of the user on the remote network.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_search_params.py b/src/beeper_desktop_api/types/matrix/bridges/user_search_params.py new file mode 100644 index 0000000..45190a8 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/user_search_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["UserSearchParams"] + + +class UserSearchParams(TypedDict, total=False): + login_id: str + """An optional explicit login ID to do the action through.""" + + query: str + """The search query to send to the remote network""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_search_response.py b/src/beeper_desktop_api/types/matrix/bridges/user_search_response.py new file mode 100644 index 0000000..c001e5c --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/bridges/user_search_response.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["UserSearchResponse", "Result"] + + +class Result(BaseModel): + """A successfully resolved identifier.""" + + id: str + """The internal user ID of the resolved user.""" + + avatar_url: Optional[str] = None + """The avatar of the user on the remote network.""" + + dm_room_mxid: Optional[str] = None + """The Matrix room ID of the direct chat with the user.""" + + identifiers: Optional[List[str]] = None + """A list of identifiers for the user on the remote network.""" + + mxid: Optional[str] = None + """The Matrix user ID of the ghost representing the user.""" + + name: Optional[str] = None + """The name of the user on the remote network.""" + + +class UserSearchResponse(BaseModel): + results: Optional[List[Result]] = None diff --git a/src/beeper_desktop_api/types/matrix/room_create_params.py b/src/beeper_desktop_api/types/matrix/room_create_params.py new file mode 100644 index 0000000..073228e --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/room_create_params.py @@ -0,0 +1,157 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["RoomCreateParams", "InitialState", "Invite3pid"] + + +class RoomCreateParams(TypedDict, total=False): + creation_content: object + """ + Extra keys, such as `m.federate`, to be added to the content of the + [`m.room.create`](https://spec.matrix.org/v1.18/client-server-api/#mroomcreate) + event. + + The server will overwrite the following keys: `creator`, `room_version`. Future + versions of the specification may allow the server to overwrite other keys. + + When using the `trusted_private_chat` preset, the server SHOULD combine + `additional_creators` specified here and the `invite` array into the eventual + `m.room.create` event's `additional_creators`, deduplicating between the two + parameters. + """ + + initial_state: Iterable[InitialState] + """A list of state events to set in the new room. + + This allows the user to override the default state events set in the new room. + The expected format of the state events are an object with type, state_key and + content keys set. + + Takes precedence over events set by `preset`, but gets overridden by `name` and + `topic` keys. + """ + + invite: SequenceNotStr[str] + """A list of user IDs to invite to the room. + + This will tell the server to invite everyone in the list to the newly created + room. + """ + + invite_3pid: Iterable[Invite3pid] + """A list of objects representing third-party IDs to invite into the room.""" + + is_direct: bool + """ + This flag makes the server set the `is_direct` flag on the `m.room.member` + events sent to the users in `invite` and `invite_3pid`. See + [Direct Messaging](https://spec.matrix.org/v1.18/client-server-api/#direct-messaging) + for more information. + """ + + name: str + """ + If this is included, an + [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) + event will be sent into the room to indicate the name for the room. This + overwrites any + [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) + event in `initial_state`. + """ + + power_level_content_override: object + """The power level content to override in the default power level event. + + This object is applied on top of the generated + [`m.room.power_levels`](https://spec.matrix.org/v1.18/client-server-api/#mroompower_levels) + event content prior to it being sent to the room. Defaults to overriding + nothing. + """ + + preset: Literal["private_chat", "public_chat", "trusted_private_chat"] + """ + Convenience parameter for setting various default state events based on a + preset. + + If unspecified, the server should use the `visibility` to determine which preset + to use. A visibility of `public` equates to a preset of `public_chat` and + `private` visibility equates to a preset of `private_chat`. + """ + + room_alias_name: str + """The desired room alias **local part**. + + If this is included, a room alias will be created and mapped to the newly + created room. The alias will belong on the _same_ homeserver which created the + room. For example, if this was set to "foo" and sent to the homeserver + "example.com" the complete room alias would be `#foo:example.com`. + + The complete room alias will become the canonical alias for the room and an + `m.room.canonical_alias` event will be sent into the room. + """ + + room_version: str + """The room version to set for the room. + + If not provided, the homeserver is to use its configured default. If provided, + the homeserver will return a 400 error with the errcode + `M_UNSUPPORTED_ROOM_VERSION` if it does not support the room version. + """ + + topic: str + """ + If this is included, an + [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) + event with a `text/plain` mimetype will be sent into the room to indicate the + topic for the room. This overwrites any + [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) + event in `initial_state`. + """ + + visibility: Literal["public", "private"] + """ + The room's visibility in the server's + [published room directory](https://spec.matrix.org/v1.18/client-server-api#published-room-directory). + Defaults to `private`. + """ + + +class InitialState(TypedDict, total=False): + content: Required[object] + """The content of the event.""" + + type: Required[str] + """The type of event to send.""" + + state_key: str + """The state_key of the state event. Defaults to an empty string.""" + + +class Invite3pid(TypedDict, total=False): + address: Required[str] + """The invitee's third-party identifier.""" + + id_access_token: Required[str] + """An access token previously registered with the identity server. + + Servers can treat this as optional to distinguish between r0.5-compatible + clients and this specification version. + """ + + id_server: Required[str] + """ + The hostname+port of the identity server which should be used for third-party + identifier lookups. + """ + + medium: Required[str] + """ + The kind of address being passed in the address field, for example `email` (see + [the list of recognised values](https://spec.matrix.org/v1.18/appendices/#3pid-types)). + """ diff --git a/src/beeper_desktop_api/types/matrix/room_create_response.py b/src/beeper_desktop_api/types/matrix/room_create_response.py new file mode 100644 index 0000000..e8559bf --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/room_create_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["RoomCreateResponse"] + + +class RoomCreateResponse(BaseModel): + """Information about the newly created room.""" + + room_id: str + """The created room's ID.""" diff --git a/src/beeper_desktop_api/types/matrix/room_join_params.py b/src/beeper_desktop_api/types/matrix/room_join_params.py new file mode 100644 index 0000000..2bbc93b --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/room_join_params.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["RoomJoinParams", "ThirdPartySigned"] + + +class RoomJoinParams(TypedDict, total=False): + via: SequenceNotStr[str] + """The servers to attempt to join the room through. + + One of the servers must be participating in the room. + """ + + reason: str + """ + Optional reason to be included as the `reason` on the subsequent membership + event. + """ + + third_party_signed: ThirdPartySigned + """ + A signature of an `m.third_party_invite` token to prove that this user owns a + third-party identity which has been invited to the room. + """ + + +class ThirdPartySigned(TypedDict, total=False): + """ + A signature of an `m.third_party_invite` token to prove that this user + owns a third-party identity which has been invited to the room. + """ + + token: Required[str] + """The state key of the m.third_party_invite event.""" + + mxid: Required[str] + """The Matrix ID of the invitee.""" + + sender: Required[str] + """The Matrix ID of the user who issued the invite.""" + + signatures: Required[Dict[str, Dict[str, str]]] + """A signatures object containing a signature of the entire signed object.""" diff --git a/src/beeper_desktop_api/types/matrix/room_join_response.py b/src/beeper_desktop_api/types/matrix/room_join_response.py new file mode 100644 index 0000000..337f661 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/room_join_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["RoomJoinResponse"] + + +class RoomJoinResponse(BaseModel): + room_id: str + """The joined room ID.""" diff --git a/src/beeper_desktop_api/types/matrix/room_leave_params.py b/src/beeper_desktop_api/types/matrix/room_leave_params.py new file mode 100644 index 0000000..1641101 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/room_leave_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RoomLeaveParams"] + + +class RoomLeaveParams(TypedDict, total=False): + reason: str + """ + Optional reason to be included as the `reason` on the subsequent membership + event. + """ diff --git a/src/beeper_desktop_api/types/matrix/rooms/__init__.py b/src/beeper_desktop_api/types/matrix/rooms/__init__.py new file mode 100644 index 0000000..39de1f8 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/rooms/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .state_list_response import StateListResponse as StateListResponse +from .state_retrieve_params import StateRetrieveParams as StateRetrieveParams +from .event_retrieve_response import EventRetrieveResponse as EventRetrieveResponse +from .state_retrieve_response import StateRetrieveResponse as StateRetrieveResponse +from .account_data_update_params import AccountDataUpdateParams as AccountDataUpdateParams diff --git a/src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py b/src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py new file mode 100644 index 0000000..aa8463a --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AccountDataUpdateParams"] + + +class AccountDataUpdateParams(TypedDict, total=False): + user_id: Required[Annotated[str, PropertyInfo(alias="userId")]] + + room_id: Required[Annotated[str, PropertyInfo(alias="roomId")]] + + body: Required[object] diff --git a/src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py b/src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py new file mode 100644 index 0000000..f39b2fe --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py @@ -0,0 +1,94 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["EventRetrieveResponse", "Unsigned"] + + +class Unsigned(BaseModel): + age: Optional[int] = None + """The time in milliseconds that has elapsed since the event was sent. + + This field is generated by the local homeserver, and may be incorrect if the + local time on at least one of the two servers is out of sync, which can cause + the age to either be negative or greater than it actually is. + """ + + membership: Optional[str] = None + """The room membership of the user making the request, at the time of the event. + + This property is the value of the `membership` property of the requesting user's + [`m.room.member`](https://spec.matrix.org/v1.18/client-server-api#mroommember) + state at the point of the event, including any changes caused by the event. If + the user had yet to join the room at the time of the event (i.e, they have no + `m.room.member` state), this property is set to `leave`. + + Homeservers SHOULD populate this property wherever practical, but they MAY omit + it if necessary (for example, if calculating the value is expensive, servers + might choose to only implement it in encrypted rooms). The property is _not_ + normally populated in events pushed to application services via the application + service transaction API (where there is no clear definition of "requesting + user"). + """ + + prev_content: Optional[object] = None + """The previous `content` for this event. + + This field is generated by the local homeserver, and is only returned if the + event is a state event, and the client has permission to see the previous + content. + """ + + redacted_because: Optional[object] = None + + transaction_id: Optional[str] = None + """ + The client-supplied + [transaction ID](https://spec.matrix.org/v1.18/client-server-api/#transaction-identifiers), + for example, provided via + `PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}`, if the client + being given the event is the same one which sent it. + """ + + +class EventRetrieveResponse(BaseModel): + """ + The format used for events when they are returned from a homeserver to a client + via the Client-Server API, or sent to an Application Service via the Application Services API. + """ + + content: object + """The body of this event, as created by the client which sent it.""" + + event_id: str + """The globally unique identifier for this event.""" + + origin_server_ts: int + """ + Timestamp (in milliseconds since the unix epoch) on originating homeserver when + this event was sent. + """ + + room_id: str + """The ID of the room associated with this event.""" + + sender: str + """Contains the fully-qualified ID of the user who sent this event.""" + + type: str + """The type of the event.""" + + state_key: Optional[str] = None + """Present if, and only if, this event is a _state_ event. + + The key making this piece of state unique in the room. Note that it is often an + empty string. + + State keys starting with an `@` are reserved for referencing user IDs, such as + room members. With the exception of a few events, state events set with a given + user's ID as the state key MUST only be set by that user. + """ + + unsigned: Optional[Unsigned] = None diff --git a/src/beeper_desktop_api/types/matrix/rooms/state_list_response.py b/src/beeper_desktop_api/types/matrix/rooms/state_list_response.py new file mode 100644 index 0000000..1f879ef --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/rooms/state_list_response.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ...._models import BaseModel + +__all__ = ["StateListResponse", "StateListResponseItem", "StateListResponseItemUnsigned"] + + +class StateListResponseItemUnsigned(BaseModel): + age: Optional[int] = None + """The time in milliseconds that has elapsed since the event was sent. + + This field is generated by the local homeserver, and may be incorrect if the + local time on at least one of the two servers is out of sync, which can cause + the age to either be negative or greater than it actually is. + """ + + membership: Optional[str] = None + """The room membership of the user making the request, at the time of the event. + + This property is the value of the `membership` property of the requesting user's + [`m.room.member`](https://spec.matrix.org/v1.18/client-server-api#mroommember) + state at the point of the event, including any changes caused by the event. If + the user had yet to join the room at the time of the event (i.e, they have no + `m.room.member` state), this property is set to `leave`. + + Homeservers SHOULD populate this property wherever practical, but they MAY omit + it if necessary (for example, if calculating the value is expensive, servers + might choose to only implement it in encrypted rooms). The property is _not_ + normally populated in events pushed to application services via the application + service transaction API (where there is no clear definition of "requesting + user"). + """ + + prev_content: Optional[object] = None + """The previous `content` for this event. + + This field is generated by the local homeserver, and is only returned if the + event is a state event, and the client has permission to see the previous + content. + """ + + redacted_because: Optional[object] = None + + transaction_id: Optional[str] = None + """ + The client-supplied + [transaction ID](https://spec.matrix.org/v1.18/client-server-api/#transaction-identifiers), + for example, provided via + `PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}`, if the client + being given the event is the same one which sent it. + """ + + +class StateListResponseItem(BaseModel): + """ + The format used for events when they are returned from a homeserver to a client + via the Client-Server API, or sent to an Application Service via the Application Services API. + """ + + content: object + """The body of this event, as created by the client which sent it.""" + + event_id: str + """The globally unique identifier for this event.""" + + origin_server_ts: int + """ + Timestamp (in milliseconds since the unix epoch) on originating homeserver when + this event was sent. + """ + + room_id: str + """The ID of the room associated with this event.""" + + sender: str + """Contains the fully-qualified ID of the user who sent this event.""" + + type: str + """The type of the event.""" + + state_key: Optional[str] = None + """Present if, and only if, this event is a _state_ event. + + The key making this piece of state unique in the room. Note that it is often an + empty string. + + State keys starting with an `@` are reserved for referencing user IDs, such as + room members. With the exception of a few events, state events set with a given + user's ID as the state key MUST only be set by that user. + """ + + unsigned: Optional[StateListResponseItemUnsigned] = None + + +StateListResponse: TypeAlias = List[StateListResponseItem] diff --git a/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py b/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py new file mode 100644 index 0000000..c2a4d7d --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["StateRetrieveParams"] + + +class StateRetrieveParams(TypedDict, total=False): + room_id: Required[Annotated[str, PropertyInfo(alias="roomId")]] + + event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] + + format: Literal["content", "event"] + """The format to use for the returned data. + + `content` (the default) will return only the content of the state event. `event` + will return the entire event in the usual format suitable for clients, including + fields like event ID, sender and timestamp. + """ diff --git a/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py b/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py new file mode 100644 index 0000000..4f07375 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["StateRetrieveResponse"] + +StateRetrieveResponse: TypeAlias = Dict[str, object] diff --git a/src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py b/src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py new file mode 100644 index 0000000..9ad6009 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["UserRetrieveProfileResponse"] + + +class UserRetrieveProfileResponse(BaseModel): + avatar_url: Optional[str] = None + """The user's avatar URL if they have set one, otherwise not present.""" + + displayname: Optional[str] = None + """The user's display name if they have set one, otherwise not present.""" + + m_tz: Optional[str] = FieldInfo(alias="m.tz", default=None) + """The user's time zone.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/beeper_desktop_api/types/matrix/users/__init__.py b/src/beeper_desktop_api/types/matrix/users/__init__.py new file mode 100644 index 0000000..65bf6e2 --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/users/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .account_data_update_params import AccountDataUpdateParams as AccountDataUpdateParams diff --git a/src/beeper_desktop_api/types/matrix/users/account_data_update_params.py b/src/beeper_desktop_api/types/matrix/users/account_data_update_params.py new file mode 100644 index 0000000..b1d58de --- /dev/null +++ b/src/beeper_desktop_api/types/matrix/users/account_data_update_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AccountDataUpdateParams"] + + +class AccountDataUpdateParams(TypedDict, total=False): + user_id: Required[Annotated[str, PropertyInfo(alias="userId")]] + + body: Required[object] diff --git a/src/beeper_desktop_api/types/shared/__init__.py b/src/beeper_desktop_api/types/shared/__init__.py index cb669ed..63cd244 100644 --- a/src/beeper_desktop_api/types/shared/__init__.py +++ b/src/beeper_desktop_api/types/shared/__init__.py @@ -5,3 +5,4 @@ from .message import Message as Message from .reaction import Reaction as Reaction from .attachment import Attachment as Attachment +from .app_state_snapshot import AppStateSnapshot as AppStateSnapshot diff --git a/src/beeper_desktop_api/types/shared/app_state_snapshot.py b/src/beeper_desktop_api/types/shared/app_state_snapshot.py new file mode 100644 index 0000000..88fc131 --- /dev/null +++ b/src/beeper_desktop_api/types/shared/app_state_snapshot.py @@ -0,0 +1,154 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["AppStateSnapshot", "E2ee", "E2eeSecrets", "Matrix", "Verification", "VerificationError", "VerificationSas"] + + +class E2eeSecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_code: bool = FieldInfo(alias="recoveryCode") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class E2ee(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: E2eeSecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class Matrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper server URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationSas(BaseModel): + """Emoji or number comparison data for verification.""" + + decimals: str + """Number sequence to compare on both devices.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted-device verification progress.""" + + available_actions: List[ + Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] + ] = FieldInfo(alias="availableActions") + """Verification actions that are valid for the current state.""" + + state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + from_: Optional[str] = FieldInfo(alias="from", default=None) + """User ID that started verification.""" + + from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) + """Device that started verification.""" + + other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) + """QR code payload to display for verification.""" + + sas: Optional[VerificationSas] = None + """Emoji or number comparison data for verification.""" + + supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) + """Whether emoji comparison is available.""" + + supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) + """Whether QR code verification is available.""" + + verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) + """Verification ID to pass in verification action paths.""" + + +class AppStateSnapshot(BaseModel): + e2ee: E2ee + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """Current onboarding state for Beeper Desktop.""" + + matrix: Optional[Matrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[Verification] = None + """Trusted-device verification progress.""" diff --git a/tests/api_resources/app/__init__.py b/tests/api_resources/app/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/e2ee/__init__.py b/tests/api_resources/app/e2ee/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/e2ee/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/e2ee/recovery_code/__init__.py b/tests/api_resources/app/e2ee/recovery_code/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/e2ee/recovery_code/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/e2ee/recovery_code/test_reset.py b/tests/api_resources/app/e2ee/recovery_code/test_reset.py new file mode 100644 index 0000000..34aae1f --- /dev/null +++ b/tests/api_resources/app/e2ee/recovery_code/test_reset.py @@ -0,0 +1,153 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.e2ee.recovery_code import ( + ResetCreateResponse, + ResetConfirmResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestReset: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: BeeperDesktop) -> None: + reset = client.app.e2ee.recovery_code.reset.create() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: + reset = client.app.e2ee.recovery_code.reset.create( + recovery_code="recoveryCode", + ) + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.recovery_code.reset.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: BeeperDesktop) -> None: + with client.app.e2ee.recovery_code.reset.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_confirm(self, client: BeeperDesktop) -> None: + reset = client.app.e2ee.recovery_code.reset.confirm( + recovery_code="x", + ) + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + def test_raw_response_confirm(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.recovery_code.reset.with_raw_response.confirm( + recovery_code="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + def test_streaming_response_confirm(self, client: BeeperDesktop) -> None: + with client.app.e2ee.recovery_code.reset.with_streaming_response.confirm( + recovery_code="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncReset: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: + reset = await async_client.app.e2ee.recovery_code.reset.create() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + reset = await async_client.app.e2ee.recovery_code.reset.create( + recovery_code="recoveryCode", + ) + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.recovery_code.reset.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = await response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.recovery_code.reset.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = await response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_confirm(self, async_client: AsyncBeeperDesktop) -> None: + reset = await async_client.app.e2ee.recovery_code.reset.confirm( + recovery_code="x", + ) + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + async def test_raw_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.recovery_code.reset.with_raw_response.confirm( + recovery_code="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = await response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + async def test_streaming_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.recovery_code.reset.with_streaming_response.confirm( + recovery_code="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = await response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/e2ee/test_recovery_code.py b/tests/api_resources/app/e2ee/test_recovery_code.py new file mode 100644 index 0000000..c7caaf9 --- /dev/null +++ b/tests/api_resources/app/e2ee/test_recovery_code.py @@ -0,0 +1,139 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.e2ee import ( + RecoveryCodeVerifyResponse, + RecoveryCodeMarkBackedUpResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRecoveryCode: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_mark_backed_up(self, client: BeeperDesktop) -> None: + recovery_code = client.app.e2ee.recovery_code.mark_backed_up() + assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) + + @parametrize + def test_raw_response_mark_backed_up(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.recovery_code.with_raw_response.mark_backed_up() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + recovery_code = response.parse() + assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) + + @parametrize + def test_streaming_response_mark_backed_up(self, client: BeeperDesktop) -> None: + with client.app.e2ee.recovery_code.with_streaming_response.mark_backed_up() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + recovery_code = response.parse() + assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_verify(self, client: BeeperDesktop) -> None: + recovery_code = client.app.e2ee.recovery_code.verify( + recovery_code="x", + ) + assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) + + @parametrize + def test_raw_response_verify(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.recovery_code.with_raw_response.verify( + recovery_code="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + recovery_code = response.parse() + assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) + + @parametrize + def test_streaming_response_verify(self, client: BeeperDesktop) -> None: + with client.app.e2ee.recovery_code.with_streaming_response.verify( + recovery_code="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + recovery_code = response.parse() + assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRecoveryCode: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_mark_backed_up(self, async_client: AsyncBeeperDesktop) -> None: + recovery_code = await async_client.app.e2ee.recovery_code.mark_backed_up() + assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) + + @parametrize + async def test_raw_response_mark_backed_up(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.recovery_code.with_raw_response.mark_backed_up() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + recovery_code = await response.parse() + assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) + + @parametrize + async def test_streaming_response_mark_backed_up(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.recovery_code.with_streaming_response.mark_backed_up() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + recovery_code = await response.parse() + assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_verify(self, async_client: AsyncBeeperDesktop) -> None: + recovery_code = await async_client.app.e2ee.recovery_code.verify( + recovery_code="x", + ) + assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) + + @parametrize + async def test_raw_response_verify(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.recovery_code.with_raw_response.verify( + recovery_code="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + recovery_code = await response.parse() + assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) + + @parametrize + async def test_streaming_response_verify(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.recovery_code.with_streaming_response.verify( + recovery_code="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + recovery_code = await response.parse() + assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/e2ee/test_verification.py b/tests/api_resources/app/e2ee/test_verification.py new file mode 100644 index 0000000..1700f2d --- /dev/null +++ b/tests/api_resources/app/e2ee/test_verification.py @@ -0,0 +1,262 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.e2ee import ( + VerificationAcceptResponse, + VerificationCancelResponse, + VerificationCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVerification: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: BeeperDesktop) -> None: + verification = client.app.e2ee.verification.create() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: + verification = client.app.e2ee.verification.create( + user_id="userID", + ) + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.verification.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: BeeperDesktop) -> None: + with client.app.e2ee.verification.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_accept(self, client: BeeperDesktop) -> None: + verification = client.app.e2ee.verification.accept( + "x", + ) + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_accept(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.verification.with_raw_response.accept( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_accept(self, client: BeeperDesktop) -> None: + with client.app.e2ee.verification.with_streaming_response.accept( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_accept(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.e2ee.verification.with_raw_response.accept( + "", + ) + + @parametrize + def test_method_cancel(self, client: BeeperDesktop) -> None: + verification = client.app.e2ee.verification.cancel( + verification_id="x", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + def test_method_cancel_with_all_params(self, client: BeeperDesktop) -> None: + verification = client.app.e2ee.verification.cancel( + verification_id="x", + code="code", + reason="reason", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.verification.with_raw_response.cancel( + verification_id="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: BeeperDesktop) -> None: + with client.app.e2ee.verification.with_streaming_response.cancel( + verification_id="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.e2ee.verification.with_raw_response.cancel( + verification_id="", + ) + + +class TestAsyncVerification: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.e2ee.verification.create() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.e2ee.verification.create( + user_id="userID", + ) + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.verification.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.verification.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_accept(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.e2ee.verification.accept( + "x", + ) + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_accept(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.verification.with_raw_response.accept( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_accept(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.verification.with_streaming_response.accept( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_accept(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.e2ee.verification.with_raw_response.accept( + "", + ) + + @parametrize + async def test_method_cancel(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.e2ee.verification.cancel( + verification_id="x", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + async def test_method_cancel_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.e2ee.verification.cancel( + verification_id="x", + code="code", + reason="reason", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.verification.with_raw_response.cancel( + verification_id="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.verification.with_streaming_response.cancel( + verification_id="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.e2ee.verification.with_raw_response.cancel( + verification_id="", + ) diff --git a/tests/api_resources/app/e2ee/verification/__init__.py b/tests/api_resources/app/e2ee/verification/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/e2ee/verification/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/e2ee/verification/test_qr.py b/tests/api_resources/app/e2ee/verification/test_qr.py new file mode 100644 index 0000000..9eb8e0c --- /dev/null +++ b/tests/api_resources/app/e2ee/verification/test_qr.py @@ -0,0 +1,162 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.e2ee.verification import QrScanResponse, QrConfirmScannedResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestQr: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_confirm_scanned(self, client: BeeperDesktop) -> None: + qr = client.app.e2ee.verification.qr.confirm_scanned( + "x", + ) + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + def test_raw_response_confirm_scanned(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + def test_streaming_response_confirm_scanned(self, client: BeeperDesktop) -> None: + with client.app.e2ee.verification.qr.with_streaming_response.confirm_scanned( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_confirm_scanned(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( + "", + ) + + @parametrize + def test_method_scan(self, client: BeeperDesktop) -> None: + qr = client.app.e2ee.verification.qr.scan( + data="x", + ) + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + def test_raw_response_scan(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.verification.qr.with_raw_response.scan( + data="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + def test_streaming_response_scan(self, client: BeeperDesktop) -> None: + with client.app.e2ee.verification.qr.with_streaming_response.scan( + data="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncQr: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + qr = await async_client.app.e2ee.verification.qr.confirm_scanned( + "x", + ) + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + async def test_raw_response_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = await response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + async def test_streaming_response_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.verification.qr.with_streaming_response.confirm_scanned( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = await response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( + "", + ) + + @parametrize + async def test_method_scan(self, async_client: AsyncBeeperDesktop) -> None: + qr = await async_client.app.e2ee.verification.qr.scan( + data="x", + ) + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + async def test_raw_response_scan(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.verification.qr.with_raw_response.scan( + data="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = await response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + async def test_streaming_response_scan(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.verification.qr.with_streaming_response.scan( + data="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = await response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/e2ee/verification/test_sas.py b/tests/api_resources/app/e2ee/verification/test_sas.py new file mode 100644 index 0000000..7a8c43c --- /dev/null +++ b/tests/api_resources/app/e2ee/verification/test_sas.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.e2ee.verification import SaStartResponse, SaConfirmResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSas: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_confirm(self, client: BeeperDesktop) -> None: + sa = client.app.e2ee.verification.sas.confirm( + "x", + ) + assert_matches_type(SaConfirmResponse, sa, path=["response"]) + + @parametrize + def test_raw_response_confirm(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.verification.sas.with_raw_response.confirm( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sa = response.parse() + assert_matches_type(SaConfirmResponse, sa, path=["response"]) + + @parametrize + def test_streaming_response_confirm(self, client: BeeperDesktop) -> None: + with client.app.e2ee.verification.sas.with_streaming_response.confirm( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sa = response.parse() + assert_matches_type(SaConfirmResponse, sa, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_confirm(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.e2ee.verification.sas.with_raw_response.confirm( + "", + ) + + @parametrize + def test_method_start(self, client: BeeperDesktop) -> None: + sa = client.app.e2ee.verification.sas.start( + "x", + ) + assert_matches_type(SaStartResponse, sa, path=["response"]) + + @parametrize + def test_raw_response_start(self, client: BeeperDesktop) -> None: + response = client.app.e2ee.verification.sas.with_raw_response.start( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sa = response.parse() + assert_matches_type(SaStartResponse, sa, path=["response"]) + + @parametrize + def test_streaming_response_start(self, client: BeeperDesktop) -> None: + with client.app.e2ee.verification.sas.with_streaming_response.start( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sa = response.parse() + assert_matches_type(SaStartResponse, sa, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_start(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.e2ee.verification.sas.with_raw_response.start( + "", + ) + + +class TestAsyncSas: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_confirm(self, async_client: AsyncBeeperDesktop) -> None: + sa = await async_client.app.e2ee.verification.sas.confirm( + "x", + ) + assert_matches_type(SaConfirmResponse, sa, path=["response"]) + + @parametrize + async def test_raw_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.verification.sas.with_raw_response.confirm( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sa = await response.parse() + assert_matches_type(SaConfirmResponse, sa, path=["response"]) + + @parametrize + async def test_streaming_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.verification.sas.with_streaming_response.confirm( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sa = await response.parse() + assert_matches_type(SaConfirmResponse, sa, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_confirm(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.e2ee.verification.sas.with_raw_response.confirm( + "", + ) + + @parametrize + async def test_method_start(self, async_client: AsyncBeeperDesktop) -> None: + sa = await async_client.app.e2ee.verification.sas.start( + "x", + ) + assert_matches_type(SaStartResponse, sa, path=["response"]) + + @parametrize + async def test_raw_response_start(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.e2ee.verification.sas.with_raw_response.start( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sa = await response.parse() + assert_matches_type(SaStartResponse, sa, path=["response"]) + + @parametrize + async def test_streaming_response_start(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.e2ee.verification.sas.with_streaming_response.start( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sa = await response.parse() + assert_matches_type(SaStartResponse, sa, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_start(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.e2ee.verification.sas.with_raw_response.start( + "", + ) diff --git a/tests/api_resources/app/test_login.py b/tests/api_resources/app/test_login.py new file mode 100644 index 0000000..7963136 --- /dev/null +++ b/tests/api_resources/app/test_login.py @@ -0,0 +1,294 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app import ( + LoginStartResponse, + LoginRegisterResponse, + LoginResponseResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLogin: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_email(self, client: BeeperDesktop) -> None: + login = client.app.login.email( + email="dev@stainless.com", + request="request", + ) + assert_matches_type(object, login, path=["response"]) + + @parametrize + def test_raw_response_email(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.email( + email="dev@stainless.com", + request="request", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert_matches_type(object, login, path=["response"]) + + @parametrize + def test_streaming_response_email(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.email( + email="dev@stainless.com", + request="request", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert_matches_type(object, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_register(self, client: BeeperDesktop) -> None: + login = client.app.login.register( + accept_terms=True, + lead_token="leadToken", + request="request", + username="x", + ) + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + def test_raw_response_register(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.register( + accept_terms=True, + lead_token="leadToken", + request="request", + username="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + def test_streaming_response_register(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.register( + accept_terms=True, + lead_token="leadToken", + request="request", + username="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_response(self, client: BeeperDesktop) -> None: + login = client.app.login.response( + request="request", + response="response", + ) + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + def test_raw_response_response(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.response( + request="request", + response="response", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + def test_streaming_response_response(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.response( + request="request", + response="response", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_start(self, client: BeeperDesktop) -> None: + login = client.app.login.start() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + def test_raw_response_start(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.start() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + def test_streaming_response_start(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.start() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncLogin: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_email(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.email( + email="dev@stainless.com", + request="request", + ) + assert_matches_type(object, login, path=["response"]) + + @parametrize + async def test_raw_response_email(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.email( + email="dev@stainless.com", + request="request", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert_matches_type(object, login, path=["response"]) + + @parametrize + async def test_streaming_response_email(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.email( + email="dev@stainless.com", + request="request", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert_matches_type(object, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_register(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.register( + accept_terms=True, + lead_token="leadToken", + request="request", + username="x", + ) + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + async def test_raw_response_register(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.register( + accept_terms=True, + lead_token="leadToken", + request="request", + username="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + async def test_streaming_response_register(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.register( + accept_terms=True, + lead_token="leadToken", + request="request", + username="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_response(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.response( + request="request", + response="response", + ) + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + async def test_raw_response_response(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.response( + request="request", + response="response", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + async def test_streaming_response_response(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.response( + request="request", + response="response", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_start(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.start() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + async def test_raw_response_start(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.start() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + async def test_streaming_response_start(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.start() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/matrix/__init__.py b/tests/api_resources/matrix/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/matrix/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/matrix/bridges/__init__.py b/tests/api_resources/matrix/bridges/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/matrix/bridges/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/matrix/bridges/test_auth.py b/tests/api_resources/matrix/bridges/test_auth.py new file mode 100644 index 0000000..bdb57e4 --- /dev/null +++ b/tests/api_resources/matrix/bridges/test_auth.py @@ -0,0 +1,854 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix.bridges import ( + AuthWhoamiResponse, + AuthListFlowsResponse, + AuthListLoginsResponse, + AuthStartLoginResponse, + AuthWaitForStepResponse, + AuthSubmitCookiesResponse, + AuthSubmitUserInputResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAuth: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list_flows(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.list_flows( + "bridgeID", + ) + assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_list_flows(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.list_flows( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) + + @parametrize + def test_streaming_response_list_flows(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.list_flows( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list_flows(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.list_flows( + "", + ) + + @parametrize + def test_method_list_logins(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.list_logins( + "bridgeID", + ) + assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_list_logins(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.list_logins( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) + + @parametrize + def test_streaming_response_list_logins(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.list_logins( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list_logins(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.list_logins( + "", + ) + + @parametrize + def test_method_logout(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="bridgeID", + ) + assert_matches_type(object, auth, path=["response"]) + + @parametrize + def test_raw_response_logout(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(object, auth, path=["response"]) + + @parametrize + def test_streaming_response_logout(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(object, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_logout(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.logout( + login_id="", + bridge_id="bridgeID", + ) + + @parametrize + def test_method_start_login(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.start_login( + flow_id="qr", + bridge_id="bridgeID", + ) + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + @parametrize + def test_method_start_login_with_all_params(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.start_login( + flow_id="qr", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_start_login(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.start_login( + flow_id="qr", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + @parametrize + def test_streaming_response_start_login(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.start_login( + flow_id="qr", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_start_login(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.start_login( + flow_id="qr", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.start_login( + flow_id="", + bridge_id="bridgeID", + ) + + @parametrize + def test_method_submit_cookies(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_submit_cookies(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) + + @parametrize + def test_streaming_response_submit_cookies(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_submit_cookies(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="stepID", + bridge_id="", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + @parametrize + def test_method_submit_user_input(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_submit_user_input(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) + + @parametrize + def test_streaming_response_submit_user_input(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_submit_user_input(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="stepID", + bridge_id="", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + @parametrize + def test_method_wait_for_step(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) + assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_wait_for_step(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) + + @parametrize + def test_streaming_response_wait_for_step(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_wait_for_step(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="stepID", + bridge_id="", + login_process_id="loginProcessID", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) + + @parametrize + def test_method_whoami(self, client: BeeperDesktop) -> None: + auth = client.matrix.bridges.auth.whoami( + "bridgeID", + ) + assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_whoami(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.auth.with_raw_response.whoami( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) + + @parametrize + def test_streaming_response_whoami(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.auth.with_streaming_response.whoami( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = response.parse() + assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_whoami(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.auth.with_raw_response.whoami( + "", + ) + + +class TestAsyncAuth: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list_flows(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.list_flows( + "bridgeID", + ) + assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_list_flows(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.list_flows( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) + + @parametrize + async def test_streaming_response_list_flows(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.list_flows( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list_flows(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.list_flows( + "", + ) + + @parametrize + async def test_method_list_logins(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.list_logins( + "bridgeID", + ) + assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_list_logins(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.list_logins( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) + + @parametrize + async def test_streaming_response_list_logins(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.list_logins( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list_logins(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.list_logins( + "", + ) + + @parametrize + async def test_method_logout(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="bridgeID", + ) + assert_matches_type(object, auth, path=["response"]) + + @parametrize + async def test_raw_response_logout(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(object, auth, path=["response"]) + + @parametrize + async def test_streaming_response_logout(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(object, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_logout(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.logout( + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.logout( + login_id="", + bridge_id="bridgeID", + ) + + @parametrize + async def test_method_start_login(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.start_login( + flow_id="qr", + bridge_id="bridgeID", + ) + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + @parametrize + async def test_method_start_login_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.start_login( + flow_id="qr", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_start_login(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.start_login( + flow_id="qr", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + @parametrize + async def test_streaming_response_start_login(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.start_login( + flow_id="qr", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_start_login(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.start_login( + flow_id="qr", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.start_login( + flow_id="", + bridge_id="bridgeID", + ) + + @parametrize + async def test_method_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) + + @parametrize + async def test_streaming_response_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="stepID", + bridge_id="", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( + step_id="", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + @parametrize + async def test_method_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) + + @parametrize + async def test_streaming_response_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="stepID", + bridge_id="", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="", + body={"foo": "string"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( + step_id="", + bridge_id="bridgeID", + login_process_id="loginProcessID", + body={"foo": "string"}, + ) + + @parametrize + async def test_method_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) + assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) + + @parametrize + async def test_streaming_response_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="stepID", + bridge_id="", + login_process_id="loginProcessID", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="stepID", + bridge_id="bridgeID", + login_process_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( + step_id="", + bridge_id="bridgeID", + login_process_id="loginProcessID", + ) + + @parametrize + async def test_method_whoami(self, async_client: AsyncBeeperDesktop) -> None: + auth = await async_client.matrix.bridges.auth.whoami( + "bridgeID", + ) + assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_whoami(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.auth.with_raw_response.whoami( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = await response.parse() + assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) + + @parametrize + async def test_streaming_response_whoami(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.auth.with_streaming_response.whoami( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + auth = await response.parse() + assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_whoami(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.auth.with_raw_response.whoami( + "", + ) diff --git a/tests/api_resources/matrix/bridges/test_capabilities.py b/tests/api_resources/matrix/bridges/test_capabilities.py new file mode 100644 index 0000000..c1c6fc7 --- /dev/null +++ b/tests/api_resources/matrix/bridges/test_capabilities.py @@ -0,0 +1,100 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix.bridges import CapabilityRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCapabilities: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + capability = client.matrix.bridges.capabilities.retrieve( + "bridgeID", + ) + assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.capabilities.with_raw_response.retrieve( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + capability = response.parse() + assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.capabilities.with_streaming_response.retrieve( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + capability = response.parse() + assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.capabilities.with_raw_response.retrieve( + "", + ) + + +class TestAsyncCapabilities: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + capability = await async_client.matrix.bridges.capabilities.retrieve( + "bridgeID", + ) + assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.capabilities.with_raw_response.retrieve( + "bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + capability = await response.parse() + assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.capabilities.with_streaming_response.retrieve( + "bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + capability = await response.parse() + assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.capabilities.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/matrix/bridges/test_contacts.py b/tests/api_resources/matrix/bridges/test_contacts.py new file mode 100644 index 0000000..a5e9913 --- /dev/null +++ b/tests/api_resources/matrix/bridges/test_contacts.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix.bridges import ContactListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestContacts: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: BeeperDesktop) -> None: + contact = client.matrix.bridges.contacts.list( + bridge_id="bridgeID", + ) + assert_matches_type(ContactListResponse, contact, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: BeeperDesktop) -> None: + contact = client.matrix.bridges.contacts.list( + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(ContactListResponse, contact, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.contacts.with_raw_response.list( + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + contact = response.parse() + assert_matches_type(ContactListResponse, contact, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.contacts.with_streaming_response.list( + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + contact = response.parse() + assert_matches_type(ContactListResponse, contact, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.contacts.with_raw_response.list( + bridge_id="", + ) + + +class TestAsyncContacts: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: + contact = await async_client.matrix.bridges.contacts.list( + bridge_id="bridgeID", + ) + assert_matches_type(ContactListResponse, contact, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + contact = await async_client.matrix.bridges.contacts.list( + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(ContactListResponse, contact, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.contacts.with_raw_response.list( + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + contact = await response.parse() + assert_matches_type(ContactListResponse, contact, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.contacts.with_streaming_response.list( + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + contact = await response.parse() + assert_matches_type(ContactListResponse, contact, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.contacts.with_raw_response.list( + bridge_id="", + ) diff --git a/tests/api_resources/matrix/bridges/test_rooms.py b/tests/api_resources/matrix/bridges/test_rooms.py new file mode 100644 index 0000000..d637533 --- /dev/null +++ b/tests/api_resources/matrix/bridges/test_rooms.py @@ -0,0 +1,279 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix.bridges import ( + RoomCreateDmResponse, + RoomCreateGroupResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRooms: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_dm(self, client: BeeperDesktop) -> None: + room = client.matrix.bridges.rooms.create_dm( + identifier="identifier", + bridge_id="bridgeID", + ) + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + @parametrize + def test_method_create_dm_with_all_params(self, client: BeeperDesktop) -> None: + room = client.matrix.bridges.rooms.create_dm( + identifier="identifier", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + @parametrize + def test_raw_response_create_dm(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.rooms.with_raw_response.create_dm( + identifier="identifier", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = response.parse() + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + @parametrize + def test_streaming_response_create_dm(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.rooms.with_streaming_response.create_dm( + identifier="identifier", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = response.parse() + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create_dm(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.rooms.with_raw_response.create_dm( + identifier="identifier", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + client.matrix.bridges.rooms.with_raw_response.create_dm( + identifier="", + bridge_id="bridgeID", + ) + + @parametrize + def test_method_create_group(self, client: BeeperDesktop) -> None: + room = client.matrix.bridges.rooms.create_group( + group_type="groupType", + bridge_id="bridgeID", + ) + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + @parametrize + def test_method_create_group_with_all_params(self, client: BeeperDesktop) -> None: + room = client.matrix.bridges.rooms.create_group( + group_type="groupType", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + avatar={"url": "url"}, + disappear={ + "timer": 0, + "type": "type", + }, + name={"name": "name"}, + parent={}, + participants=["string"], + room_id="room_id", + topic={"topic": "topic"}, + type="channel", + username="username", + ) + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + @parametrize + def test_raw_response_create_group(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.rooms.with_raw_response.create_group( + group_type="groupType", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = response.parse() + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + @parametrize + def test_streaming_response_create_group(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.rooms.with_streaming_response.create_group( + group_type="groupType", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = response.parse() + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create_group(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.rooms.with_raw_response.create_group( + group_type="groupType", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_type` but received ''"): + client.matrix.bridges.rooms.with_raw_response.create_group( + group_type="", + bridge_id="bridgeID", + ) + + +class TestAsyncRooms: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create_dm(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.bridges.rooms.create_dm( + identifier="identifier", + bridge_id="bridgeID", + ) + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + @parametrize + async def test_method_create_dm_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.bridges.rooms.create_dm( + identifier="identifier", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + @parametrize + async def test_raw_response_create_dm(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.rooms.with_raw_response.create_dm( + identifier="identifier", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = await response.parse() + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + @parametrize + async def test_streaming_response_create_dm(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.rooms.with_streaming_response.create_dm( + identifier="identifier", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = await response.parse() + assert_matches_type(RoomCreateDmResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create_dm(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.rooms.with_raw_response.create_dm( + identifier="identifier", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + await async_client.matrix.bridges.rooms.with_raw_response.create_dm( + identifier="", + bridge_id="bridgeID", + ) + + @parametrize + async def test_method_create_group(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.bridges.rooms.create_group( + group_type="groupType", + bridge_id="bridgeID", + ) + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + @parametrize + async def test_method_create_group_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.bridges.rooms.create_group( + group_type="groupType", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + avatar={"url": "url"}, + disappear={ + "timer": 0, + "type": "type", + }, + name={"name": "name"}, + parent={}, + participants=["string"], + room_id="room_id", + topic={"topic": "topic"}, + type="channel", + username="username", + ) + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + @parametrize + async def test_raw_response_create_group(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.rooms.with_raw_response.create_group( + group_type="groupType", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = await response.parse() + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + @parametrize + async def test_streaming_response_create_group(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.rooms.with_streaming_response.create_group( + group_type="groupType", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = await response.parse() + assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create_group(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.rooms.with_raw_response.create_group( + group_type="groupType", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_type` but received ''"): + await async_client.matrix.bridges.rooms.with_raw_response.create_group( + group_type="", + bridge_id="bridgeID", + ) diff --git a/tests/api_resources/matrix/bridges/test_users.py b/tests/api_resources/matrix/bridges/test_users.py new file mode 100644 index 0000000..2e6e69d --- /dev/null +++ b/tests/api_resources/matrix/bridges/test_users.py @@ -0,0 +1,235 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix.bridges import ( + UserSearchResponse, + UserResolveResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_resolve(self, client: BeeperDesktop) -> None: + user = client.matrix.bridges.users.resolve( + identifier="identifier", + bridge_id="bridgeID", + ) + assert_matches_type(UserResolveResponse, user, path=["response"]) + + @parametrize + def test_method_resolve_with_all_params(self, client: BeeperDesktop) -> None: + user = client.matrix.bridges.users.resolve( + identifier="identifier", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(UserResolveResponse, user, path=["response"]) + + @parametrize + def test_raw_response_resolve(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.users.with_raw_response.resolve( + identifier="identifier", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserResolveResponse, user, path=["response"]) + + @parametrize + def test_streaming_response_resolve(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.users.with_streaming_response.resolve( + identifier="identifier", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserResolveResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resolve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.users.with_raw_response.resolve( + identifier="identifier", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + client.matrix.bridges.users.with_raw_response.resolve( + identifier="", + bridge_id="bridgeID", + ) + + @parametrize + def test_method_search(self, client: BeeperDesktop) -> None: + user = client.matrix.bridges.users.search( + bridge_id="bridgeID", + ) + assert_matches_type(UserSearchResponse, user, path=["response"]) + + @parametrize + def test_method_search_with_all_params(self, client: BeeperDesktop) -> None: + user = client.matrix.bridges.users.search( + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + query="query", + ) + assert_matches_type(UserSearchResponse, user, path=["response"]) + + @parametrize + def test_raw_response_search(self, client: BeeperDesktop) -> None: + response = client.matrix.bridges.users.with_raw_response.search( + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserSearchResponse, user, path=["response"]) + + @parametrize + def test_streaming_response_search(self, client: BeeperDesktop) -> None: + with client.matrix.bridges.users.with_streaming_response.search( + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserSearchResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_search(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.matrix.bridges.users.with_raw_response.search( + bridge_id="", + ) + + +class TestAsyncUsers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_resolve(self, async_client: AsyncBeeperDesktop) -> None: + user = await async_client.matrix.bridges.users.resolve( + identifier="identifier", + bridge_id="bridgeID", + ) + assert_matches_type(UserResolveResponse, user, path=["response"]) + + @parametrize + async def test_method_resolve_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + user = await async_client.matrix.bridges.users.resolve( + identifier="identifier", + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + ) + assert_matches_type(UserResolveResponse, user, path=["response"]) + + @parametrize + async def test_raw_response_resolve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.users.with_raw_response.resolve( + identifier="identifier", + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserResolveResponse, user, path=["response"]) + + @parametrize + async def test_streaming_response_resolve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.users.with_streaming_response.resolve( + identifier="identifier", + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserResolveResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resolve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.users.with_raw_response.resolve( + identifier="identifier", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + await async_client.matrix.bridges.users.with_raw_response.resolve( + identifier="", + bridge_id="bridgeID", + ) + + @parametrize + async def test_method_search(self, async_client: AsyncBeeperDesktop) -> None: + user = await async_client.matrix.bridges.users.search( + bridge_id="bridgeID", + ) + assert_matches_type(UserSearchResponse, user, path=["response"]) + + @parametrize + async def test_method_search_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + user = await async_client.matrix.bridges.users.search( + bridge_id="bridgeID", + login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + query="query", + ) + assert_matches_type(UserSearchResponse, user, path=["response"]) + + @parametrize + async def test_raw_response_search(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.bridges.users.with_raw_response.search( + bridge_id="bridgeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserSearchResponse, user, path=["response"]) + + @parametrize + async def test_streaming_response_search(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.bridges.users.with_streaming_response.search( + bridge_id="bridgeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserSearchResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_search(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.matrix.bridges.users.with_raw_response.search( + bridge_id="", + ) diff --git a/tests/api_resources/matrix/rooms/__init__.py b/tests/api_resources/matrix/rooms/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/matrix/rooms/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/matrix/rooms/test_account_data.py b/tests/api_resources/matrix/rooms/test_account_data.py new file mode 100644 index 0000000..913996c --- /dev/null +++ b/tests/api_resources/matrix/rooms/test_account_data.py @@ -0,0 +1,275 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAccountData: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + account_data = client.matrix.rooms.account_data.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.account_data.with_raw_response.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.account_data.with_streaming_response.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + client.matrix.rooms.account_data.with_raw_response.retrieve( + type="org.example.custom.room.config", + user_id="", + room_id="!726s6s6q:example.com", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + client.matrix.rooms.account_data.with_raw_response.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + client.matrix.rooms.account_data.with_raw_response.retrieve( + type="", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) + + @parametrize + def test_method_update(self, client: BeeperDesktop) -> None: + account_data = client.matrix.rooms.account_data.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.account_data.with_raw_response.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.account_data.with_streaming_response.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + client.matrix.rooms.account_data.with_raw_response.update( + type="org.example.custom.room.config", + user_id="", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + client.matrix.rooms.account_data.with_raw_response.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + client.matrix.rooms.account_data.with_raw_response.update( + type="", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + + +class TestAsyncAccountData: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + account_data = await async_client.matrix.rooms.account_data.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.account_data.with_raw_response.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.account_data.with_streaming_response.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + await async_client.matrix.rooms.account_data.with_raw_response.retrieve( + type="org.example.custom.room.config", + user_id="", + room_id="!726s6s6q:example.com", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + await async_client.matrix.rooms.account_data.with_raw_response.retrieve( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + await async_client.matrix.rooms.account_data.with_raw_response.retrieve( + type="", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncBeeperDesktop) -> None: + account_data = await async_client.matrix.rooms.account_data.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.account_data.with_raw_response.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.account_data.with_streaming_response.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + await async_client.matrix.rooms.account_data.with_raw_response.update( + type="org.example.custom.room.config", + user_id="", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + await async_client.matrix.rooms.account_data.with_raw_response.update( + type="org.example.custom.room.config", + user_id="@alice:example.com", + room_id="", + body={"custom_account_data_key": "custom_account_data_value"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + await async_client.matrix.rooms.account_data.with_raw_response.update( + type="", + user_id="@alice:example.com", + room_id="!726s6s6q:example.com", + body={"custom_account_data_key": "custom_account_data_value"}, + ) diff --git a/tests/api_resources/matrix/rooms/test_events.py b/tests/api_resources/matrix/rooms/test_events.py new file mode 100644 index 0000000..4610a72 --- /dev/null +++ b/tests/api_resources/matrix/rooms/test_events.py @@ -0,0 +1,120 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix.rooms import EventRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEvents: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + event = client.matrix.rooms.events.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="!636q39766251:matrix.org", + ) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.events.with_raw_response.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="!636q39766251:matrix.org", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = response.parse() + assert_matches_type(EventRetrieveResponse, event, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.events.with_streaming_response.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="!636q39766251:matrix.org", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = response.parse() + assert_matches_type(EventRetrieveResponse, event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + client.matrix.rooms.events.with_raw_response.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): + client.matrix.rooms.events.with_raw_response.retrieve( + event_id="", + room_id="!636q39766251:matrix.org", + ) + + +class TestAsyncEvents: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + event = await async_client.matrix.rooms.events.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="!636q39766251:matrix.org", + ) + assert_matches_type(EventRetrieveResponse, event, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.events.with_raw_response.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="!636q39766251:matrix.org", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = await response.parse() + assert_matches_type(EventRetrieveResponse, event, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.events.with_streaming_response.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="!636q39766251:matrix.org", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = await response.parse() + assert_matches_type(EventRetrieveResponse, event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + await async_client.matrix.rooms.events.with_raw_response.retrieve( + event_id="$asfDuShaf7Gafaw:matrix.org", + room_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): + await async_client.matrix.rooms.events.with_raw_response.retrieve( + event_id="", + room_id="!636q39766251:matrix.org", + ) diff --git a/tests/api_resources/matrix/rooms/test_state.py b/tests/api_resources/matrix/rooms/test_state.py new file mode 100644 index 0000000..8749cff --- /dev/null +++ b/tests/api_resources/matrix/rooms/test_state.py @@ -0,0 +1,240 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix.rooms import StateListResponse, StateRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestState: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + state = client.matrix.rooms.state.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: BeeperDesktop) -> None: + state = client.matrix.rooms.state.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + format="content", + ) + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.state.with_raw_response.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = response.parse() + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.state.with_streaming_response.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = response.parse() + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + client.matrix.rooms.state.with_raw_response.retrieve( + state_key="state_key", + room_id="", + event_type="m.room.name", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_type` but received ''"): + client.matrix.rooms.state.with_raw_response.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_key` but received ''"): + client.matrix.rooms.state.with_raw_response.retrieve( + state_key="", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) + + @parametrize + def test_method_list(self, client: BeeperDesktop) -> None: + state = client.matrix.rooms.state.list( + "!636q39766251:example.com", + ) + assert_matches_type(StateListResponse, state, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.state.with_raw_response.list( + "!636q39766251:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = response.parse() + assert_matches_type(StateListResponse, state, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.state.with_streaming_response.list( + "!636q39766251:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = response.parse() + assert_matches_type(StateListResponse, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + client.matrix.rooms.state.with_raw_response.list( + "", + ) + + +class TestAsyncState: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + state = await async_client.matrix.rooms.state.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + state = await async_client.matrix.rooms.state.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + format="content", + ) + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.state.with_raw_response.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = await response.parse() + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.state.with_streaming_response.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = await response.parse() + assert_matches_type(StateRetrieveResponse, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + await async_client.matrix.rooms.state.with_raw_response.retrieve( + state_key="state_key", + room_id="", + event_type="m.room.name", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_type` but received ''"): + await async_client.matrix.rooms.state.with_raw_response.retrieve( + state_key="state_key", + room_id="!636q39766251:example.com", + event_type="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_key` but received ''"): + await async_client.matrix.rooms.state.with_raw_response.retrieve( + state_key="", + room_id="!636q39766251:example.com", + event_type="m.room.name", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: + state = await async_client.matrix.rooms.state.list( + "!636q39766251:example.com", + ) + assert_matches_type(StateListResponse, state, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.state.with_raw_response.list( + "!636q39766251:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + state = await response.parse() + assert_matches_type(StateListResponse, state, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.state.with_streaming_response.list( + "!636q39766251:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + state = await response.parse() + assert_matches_type(StateListResponse, state, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + await async_client.matrix.rooms.state.with_raw_response.list( + "", + ) diff --git a/tests/api_resources/matrix/test_rooms.py b/tests/api_resources/matrix/test_rooms.py new file mode 100644 index 0000000..6c9f5a1 --- /dev/null +++ b/tests/api_resources/matrix/test_rooms.py @@ -0,0 +1,337 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix import ( + RoomJoinResponse, + RoomCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRooms: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: BeeperDesktop) -> None: + room = client.matrix.rooms.create() + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: + room = client.matrix.rooms.create( + creation_content={"m.federate": False}, + initial_state=[ + { + "content": {}, + "type": "type", + "state_key": "state_key", + } + ], + invite=["string"], + invite_3pid=[ + { + "address": "cheeky@monkey.com", + "id_access_token": "abc123_OpaqueString", + "id_server": "matrix.org", + "medium": "email", + } + ], + is_direct=True, + name="The Grand Duke Pub", + power_level_content_override={}, + preset="public_chat", + room_alias_name="thepub", + room_version="1", + topic="All about happy hour", + visibility="public", + ) + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = response.parse() + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = response.parse() + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_join(self, client: BeeperDesktop) -> None: + room = client.matrix.rooms.join( + room_id_or_alias="!monkeys:matrix.org", + ) + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + @parametrize + def test_method_join_with_all_params(self, client: BeeperDesktop) -> None: + room = client.matrix.rooms.join( + room_id_or_alias="!monkeys:matrix.org", + via=["string"], + reason="Looking for support", + third_party_signed={ + "token": "random8nonce", + "mxid": "bob", + "sender": "alice", + "signatures": {"example.org": {"ed25519:0": "some9signature"}}, + }, + ) + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + @parametrize + def test_raw_response_join(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.with_raw_response.join( + room_id_or_alias="!monkeys:matrix.org", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = response.parse() + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + @parametrize + def test_streaming_response_join(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.with_streaming_response.join( + room_id_or_alias="!monkeys:matrix.org", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = response.parse() + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_join(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id_or_alias` but received ''"): + client.matrix.rooms.with_raw_response.join( + room_id_or_alias="", + ) + + @parametrize + def test_method_leave(self, client: BeeperDesktop) -> None: + room = client.matrix.rooms.leave( + room_id="!nkl290a:matrix.org", + ) + assert_matches_type(object, room, path=["response"]) + + @parametrize + def test_method_leave_with_all_params(self, client: BeeperDesktop) -> None: + room = client.matrix.rooms.leave( + room_id="!nkl290a:matrix.org", + reason="Saying farewell - thanks for the support!", + ) + assert_matches_type(object, room, path=["response"]) + + @parametrize + def test_raw_response_leave(self, client: BeeperDesktop) -> None: + response = client.matrix.rooms.with_raw_response.leave( + room_id="!nkl290a:matrix.org", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = response.parse() + assert_matches_type(object, room, path=["response"]) + + @parametrize + def test_streaming_response_leave(self, client: BeeperDesktop) -> None: + with client.matrix.rooms.with_streaming_response.leave( + room_id="!nkl290a:matrix.org", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = response.parse() + assert_matches_type(object, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_leave(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + client.matrix.rooms.with_raw_response.leave( + room_id="", + ) + + +class TestAsyncRooms: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.rooms.create() + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.rooms.create( + creation_content={"m.federate": False}, + initial_state=[ + { + "content": {}, + "type": "type", + "state_key": "state_key", + } + ], + invite=["string"], + invite_3pid=[ + { + "address": "cheeky@monkey.com", + "id_access_token": "abc123_OpaqueString", + "id_server": "matrix.org", + "medium": "email", + } + ], + is_direct=True, + name="The Grand Duke Pub", + power_level_content_override={}, + preset="public_chat", + room_alias_name="thepub", + room_version="1", + topic="All about happy hour", + visibility="public", + ) + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = await response.parse() + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = await response.parse() + assert_matches_type(RoomCreateResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_join(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.rooms.join( + room_id_or_alias="!monkeys:matrix.org", + ) + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + @parametrize + async def test_method_join_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.rooms.join( + room_id_or_alias="!monkeys:matrix.org", + via=["string"], + reason="Looking for support", + third_party_signed={ + "token": "random8nonce", + "mxid": "bob", + "sender": "alice", + "signatures": {"example.org": {"ed25519:0": "some9signature"}}, + }, + ) + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + @parametrize + async def test_raw_response_join(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.with_raw_response.join( + room_id_or_alias="!monkeys:matrix.org", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = await response.parse() + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + @parametrize + async def test_streaming_response_join(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.with_streaming_response.join( + room_id_or_alias="!monkeys:matrix.org", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = await response.parse() + assert_matches_type(RoomJoinResponse, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_join(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id_or_alias` but received ''"): + await async_client.matrix.rooms.with_raw_response.join( + room_id_or_alias="", + ) + + @parametrize + async def test_method_leave(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.rooms.leave( + room_id="!nkl290a:matrix.org", + ) + assert_matches_type(object, room, path=["response"]) + + @parametrize + async def test_method_leave_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + room = await async_client.matrix.rooms.leave( + room_id="!nkl290a:matrix.org", + reason="Saying farewell - thanks for the support!", + ) + assert_matches_type(object, room, path=["response"]) + + @parametrize + async def test_raw_response_leave(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.rooms.with_raw_response.leave( + room_id="!nkl290a:matrix.org", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + room = await response.parse() + assert_matches_type(object, room, path=["response"]) + + @parametrize + async def test_streaming_response_leave(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.rooms.with_streaming_response.leave( + room_id="!nkl290a:matrix.org", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + room = await response.parse() + assert_matches_type(object, room, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_leave(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): + await async_client.matrix.rooms.with_raw_response.leave( + room_id="", + ) diff --git a/tests/api_resources/matrix/test_users.py b/tests/api_resources/matrix/test_users.py new file mode 100644 index 0000000..5b148a2 --- /dev/null +++ b/tests/api_resources/matrix/test_users.py @@ -0,0 +1,100 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.matrix import UserRetrieveProfileResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve_profile(self, client: BeeperDesktop) -> None: + user = client.matrix.users.retrieve_profile( + "@alice:example.com", + ) + assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) + + @parametrize + def test_raw_response_retrieve_profile(self, client: BeeperDesktop) -> None: + response = client.matrix.users.with_raw_response.retrieve_profile( + "@alice:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) + + @parametrize + def test_streaming_response_retrieve_profile(self, client: BeeperDesktop) -> None: + with client.matrix.users.with_streaming_response.retrieve_profile( + "@alice:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve_profile(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + client.matrix.users.with_raw_response.retrieve_profile( + "", + ) + + +class TestAsyncUsers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: + user = await async_client.matrix.users.retrieve_profile( + "@alice:example.com", + ) + assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) + + @parametrize + async def test_raw_response_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.users.with_raw_response.retrieve_profile( + "@alice:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.users.with_streaming_response.retrieve_profile( + "@alice:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + await async_client.matrix.users.with_raw_response.retrieve_profile( + "", + ) diff --git a/tests/api_resources/matrix/users/__init__.py b/tests/api_resources/matrix/users/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/matrix/users/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/matrix/users/test_account_data.py b/tests/api_resources/matrix/users/test_account_data.py new file mode 100644 index 0000000..4e31b87 --- /dev/null +++ b/tests/api_resources/matrix/users/test_account_data.py @@ -0,0 +1,225 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAccountData: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + account_data = client.matrix.users.account_data.retrieve( + type="org.example.custom.config", + user_id="@alice:example.com", + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.matrix.users.account_data.with_raw_response.retrieve( + type="org.example.custom.config", + user_id="@alice:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.matrix.users.account_data.with_streaming_response.retrieve( + type="org.example.custom.config", + user_id="@alice:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + client.matrix.users.account_data.with_raw_response.retrieve( + type="org.example.custom.config", + user_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + client.matrix.users.account_data.with_raw_response.retrieve( + type="", + user_id="@alice:example.com", + ) + + @parametrize + def test_method_update(self, client: BeeperDesktop) -> None: + account_data = client.matrix.users.account_data.update( + type="org.example.custom.config", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: BeeperDesktop) -> None: + response = client.matrix.users.account_data.with_raw_response.update( + type="org.example.custom.config", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: BeeperDesktop) -> None: + with client.matrix.users.account_data.with_streaming_response.update( + type="org.example.custom.config", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + client.matrix.users.account_data.with_raw_response.update( + type="org.example.custom.config", + user_id="", + body={"custom_account_data_key": "custom_config_value"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + client.matrix.users.account_data.with_raw_response.update( + type="", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) + + +class TestAsyncAccountData: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + account_data = await async_client.matrix.users.account_data.retrieve( + type="org.example.custom.config", + user_id="@alice:example.com", + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.users.account_data.with_raw_response.retrieve( + type="org.example.custom.config", + user_id="@alice:example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.users.account_data.with_streaming_response.retrieve( + type="org.example.custom.config", + user_id="@alice:example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + await async_client.matrix.users.account_data.with_raw_response.retrieve( + type="org.example.custom.config", + user_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + await async_client.matrix.users.account_data.with_raw_response.retrieve( + type="", + user_id="@alice:example.com", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncBeeperDesktop) -> None: + account_data = await async_client.matrix.users.account_data.update( + type="org.example.custom.config", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.matrix.users.account_data.with_raw_response.update( + type="org.example.custom.config", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.matrix.users.account_data.with_streaming_response.update( + type="org.example.custom.config", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account_data = await response.parse() + assert_matches_type(object, account_data, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): + await async_client.matrix.users.account_data.with_raw_response.update( + type="org.example.custom.config", + user_id="", + body={"custom_account_data_key": "custom_config_value"}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): + await async_client.matrix.users.account_data.with_raw_response.update( + type="", + user_id="@alice:example.com", + body={"custom_account_data_key": "custom_config_value"}, + ) diff --git a/tests/api_resources/test_app.py b/tests/api_resources/test_app.py new file mode 100644 index 0000000..ff78bb6 --- /dev/null +++ b/tests/api_resources/test_app.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types import AppStatusResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestApp: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_status(self, client: BeeperDesktop) -> None: + app = client.app.status() + assert_matches_type(AppStatusResponse, app, path=["response"]) + + @parametrize + def test_raw_response_status(self, client: BeeperDesktop) -> None: + response = client.app.with_raw_response.status() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(AppStatusResponse, app, path=["response"]) + + @parametrize + def test_streaming_response_status(self, client: BeeperDesktop) -> None: + with client.app.with_streaming_response.status() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(AppStatusResponse, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncApp: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_status(self, async_client: AsyncBeeperDesktop) -> None: + app = await async_client.app.status() + assert_matches_type(AppStatusResponse, app, path=["response"]) + + @parametrize + async def test_raw_response_status(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.with_raw_response.status() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(AppStatusResponse, app, path=["response"]) + + @parametrize + async def test_streaming_response_status(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.with_streaming_response.status() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(AppStatusResponse, app, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_bridges.py b/tests/api_resources/test_bridges.py new file mode 100644 index 0000000..f5af604 --- /dev/null +++ b/tests/api_resources/test_bridges.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types import BridgeListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBridges: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: BeeperDesktop) -> None: + bridge = client.bridges.list() + assert_matches_type(BridgeListResponse, bridge, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: BeeperDesktop) -> None: + response = client.bridges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bridge = response.parse() + assert_matches_type(BridgeListResponse, bridge, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: BeeperDesktop) -> None: + with client.bridges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bridge = response.parse() + assert_matches_type(BridgeListResponse, bridge, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBridges: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: + bridge = await async_client.bridges.list() + assert_matches_type(BridgeListResponse, bridge, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.bridges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bridge = await response.parse() + assert_matches_type(BridgeListResponse, bridge, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.bridges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bridge = await response.parse() + assert_matches_type(BridgeListResponse, bridge, path=["response"]) + + assert cast(Any, response.is_closed) is True From 1c4730887806c2317e1c8b8bab20dd21c0c23d48 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 16 May 2026 20:21:34 +0000 Subject: [PATCH 06/11] Update Desktop API Stainless config --- .stats.yml | 4 +-- src/beeper_desktop_api/_client.py | 36 ++++++++++++++++++--------- tests/test_client.py | 41 ++++++++++++++++++++----------- 3 files changed, 54 insertions(+), 27 deletions(-) diff --git a/.stats.yml b/.stats.yml index b63d20d..62239e7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 72 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-de1370e6a3183044fa135a886d2ee8f779d5e86228cdbd503d553b4c13cc7cbe.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-8ba2755730c4180ec88f92a300948445d7917898abfc912ca3fa6adc766a7520.yml openapi_spec_hash: 30b435d7585d8b6951610e7147369779 -config_hash: 683b13ea6fb6aa9d6b1b8814cca24f1c +config_hash: a53888715ed00d433e5a5dafab9f7b9f diff --git a/src/beeper_desktop_api/_client.py b/src/beeper_desktop_api/_client.py index 63950dc..cec1b75 100644 --- a/src/beeper_desktop_api/_client.py +++ b/src/beeper_desktop_api/_client.py @@ -41,7 +41,7 @@ async_to_streamed_response_wrapper, ) from ._streaming import Stream as Stream, AsyncStream as AsyncStream -from ._exceptions import APIStatusError, BeeperDesktopError +from ._exceptions import APIStatusError from ._base_client import ( DEFAULT_MAX_RETRIES, SyncAPIClient, @@ -76,7 +76,7 @@ class BeeperDesktop(SyncAPIClient): # client options - access_token: str + access_token: str | None def __init__( self, @@ -107,10 +107,6 @@ def __init__( """ if access_token is None: access_token = os.environ.get("BEEPER_ACCESS_TOKEN") - if access_token is None: - raise BeeperDesktopError( - "The access_token client option must be set either by passing access_token to the client or by setting the BEEPER_ACCESS_TOKEN environment variable" - ) self.access_token = access_token if base_url is None: @@ -219,6 +215,8 @@ def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: @property def _bearer_auth(self) -> dict[str, str]: access_token = self.access_token + if access_token is None: + return {} return {"Authorization": f"Bearer {access_token}"} @property @@ -230,6 +228,15 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } + @override + def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: + if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit): + return + + raise TypeError( + '"Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted"' + ) + def copy( self, *, @@ -409,7 +416,7 @@ def _make_status_error( class AsyncBeeperDesktop(AsyncAPIClient): # client options - access_token: str + access_token: str | None def __init__( self, @@ -440,10 +447,6 @@ def __init__( """ if access_token is None: access_token = os.environ.get("BEEPER_ACCESS_TOKEN") - if access_token is None: - raise BeeperDesktopError( - "The access_token client option must be set either by passing access_token to the client or by setting the BEEPER_ACCESS_TOKEN environment variable" - ) self.access_token = access_token if base_url is None: @@ -552,6 +555,8 @@ def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: @property def _bearer_auth(self) -> dict[str, str]: access_token = self.access_token + if access_token is None: + return {} return {"Authorization": f"Bearer {access_token}"} @property @@ -563,6 +568,15 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } + @override + def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: + if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit): + return + + raise TypeError( + '"Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted"' + ) + def copy( self, *, diff --git a/tests/test_client.py b/tests/test_client.py index d9ab686..f5dae02 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -23,12 +23,7 @@ from beeper_desktop_api._types import Omit from beeper_desktop_api._utils import asyncify from beeper_desktop_api._models import BaseModel, FinalRequestOptions -from beeper_desktop_api._exceptions import ( - APIStatusError, - APITimeoutError, - BeeperDesktopError, - APIResponseValidationError, -) +from beeper_desktop_api._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError from beeper_desktop_api._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, @@ -415,10 +410,19 @@ def test_validate_headers(self) -> None: request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("Authorization") == f"Bearer {access_token}" - with pytest.raises(BeeperDesktopError): - with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): - client2 = BeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) - _ = client2 + with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): + client2 = BeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) + + with pytest.raises( + TypeError, + match="Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted", + ): + client2._build_request(FinalRequestOptions(method="get", url="/foo")) + + request2 = client2._build_request( + FinalRequestOptions(method="get", url="/foo", headers={"Authorization": Omit()}) + ) + assert request2.headers.get("Authorization") is None def test_default_query_option(self) -> None: client = BeeperDesktop( @@ -1362,10 +1366,19 @@ def test_validate_headers(self) -> None: request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("Authorization") == f"Bearer {access_token}" - with pytest.raises(BeeperDesktopError): - with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): - client2 = AsyncBeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) - _ = client2 + with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): + client2 = AsyncBeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) + + with pytest.raises( + TypeError, + match="Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted", + ): + client2._build_request(FinalRequestOptions(method="get", url="/foo")) + + request2 = client2._build_request( + FinalRequestOptions(method="get", url="/foo", headers={"Authorization": Omit()}) + ) + assert request2.headers.get("Authorization") is None async def test_default_query_option(self) -> None: client = AsyncBeeperDesktop( From 1e5471daa21395e7f94b737a3441b48d2cdc83a0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 16 May 2026 20:32:43 +0000 Subject: [PATCH 07/11] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 62239e7..8fcd9ea 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 72 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-8ba2755730c4180ec88f92a300948445d7917898abfc912ca3fa6adc766a7520.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-6cdaa898dcc095d108f684dd847bc19da7156b0a09ffb4cac2e613c53a0647e5.yml openapi_spec_hash: 30b435d7585d8b6951610e7147369779 -config_hash: a53888715ed00d433e5a5dafab9f7b9f +config_hash: 33cb47306fb0333ac538d5db65e8d52f From 5b8aa23997315f437c3658ae26faa757d3823010 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 16 May 2026 20:38:51 +0000 Subject: [PATCH 08/11] Update Desktop API docs and SDK config --- .stats.yml | 6 +- README.md | 13 +- api.md | 256 +++++++++---------- src/beeper_desktop_api/_client.py | 204 +++++++-------- src/beeper_desktop_api/resources/__init__.py | 24 +- tests/test_client.py | 41 +-- 6 files changed, 256 insertions(+), 288 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8fcd9ea..a6a4fc8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 72 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-6cdaa898dcc095d108f684dd847bc19da7156b0a09ffb4cac2e613c53a0647e5.yml -openapi_spec_hash: 30b435d7585d8b6951610e7147369779 -config_hash: 33cb47306fb0333ac538d5db65e8d52f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-0427b028ffd00b4f8b75084116f801658d0279117b2d0e522d1f257c998f1fd0.yml +openapi_spec_hash: af3ed0745fca6831cf2540c36050d4e6 +config_hash: fbf60dd7c0de7e17c7e2bb0ee09e9937 diff --git a/README.md b/README.md index b0b1be5..645fd65 100644 --- a/README.md +++ b/README.md @@ -221,16 +221,11 @@ from beeper_desktop_api import BeeperDesktop client = BeeperDesktop() -response = client.matrix.rooms.join( - room_id_or_alias="!monkeys:matrix.org", - third_party_signed={ - "token": "random8nonce", - "mxid": "bob", - "sender": "alice", - "signatures": {"example.org": {"ed25519:0": "some9signature"}}, - }, +chat = client.chats.update( + chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com", + draft={"text": "text"}, ) -print(response.third_party_signed) +print(chat.draft) ``` ## File uploads diff --git a/api.md b/api.md index d78a0a2..7ba1634 100644 --- a/api.md +++ b/api.md @@ -17,6 +17,134 @@ Methods: - client.focus(\*\*params) -> FocusResponse - client.search(\*\*params) -> SearchResponse +# Accounts + +Types: + +```python +from beeper_desktop_api.types import Account, AccountListResponse +``` + +Methods: + +- client.accounts.list() -> AccountListResponse + +## Contacts + +Types: + +```python +from beeper_desktop_api.types.accounts import ContactSearchResponse +``` + +Methods: + +- client.accounts.contacts.list(account_id, \*\*params) -> SyncCursorSearch[User] +- client.accounts.contacts.search(account_id, \*\*params) -> ContactSearchResponse + +# Bridges + +Types: + +```python +from beeper_desktop_api.types import BridgeAvailability, BridgeListResponse +``` + +Methods: + +- client.bridges.list() -> BridgeListResponse + +# Chats + +Types: + +```python +from beeper_desktop_api.types import Chat, ChatCreateResponse, ChatListResponse, ChatStartResponse +``` + +Methods: + +- client.chats.create(\*\*params) -> ChatCreateResponse +- client.chats.retrieve(chat_id, \*\*params) -> Chat +- client.chats.update(chat_id, \*\*params) -> Chat +- client.chats.list(\*\*params) -> SyncCursorNoLimit[ChatListResponse] +- client.chats.archive(chat_id, \*\*params) -> None +- client.chats.mark_read(chat_id, \*\*params) -> Chat +- client.chats.mark_unread(chat_id, \*\*params) -> Chat +- client.chats.notify_anyway(chat_id) -> Chat +- client.chats.search(\*\*params) -> SyncCursorSearch[Chat] +- client.chats.start(\*\*params) -> ChatStartResponse + +## Reminders + +Methods: + +- client.chats.reminders.create(chat_id, \*\*params) -> None +- client.chats.reminders.delete(chat_id) -> None + +## Messages + +### Reactions + +Types: + +```python +from beeper_desktop_api.types.chats.messages import ReactionDeleteResponse, ReactionAddResponse +``` + +Methods: + +- client.chats.messages.reactions.delete(reaction_key, \*, chat_id, message_id) -> ReactionDeleteResponse +- client.chats.messages.reactions.add(message_id, \*, chat_id, \*\*params) -> ReactionAddResponse + +# Messages + +Types: + +```python +from beeper_desktop_api.types import MessageUpdateResponse, MessageSendResponse +``` + +Methods: + +- client.messages.retrieve(message_id, \*, chat_id) -> Message +- client.messages.update(message_id, \*, chat_id, \*\*params) -> MessageUpdateResponse +- client.messages.list(chat_id, \*\*params) -> SyncCursorNoLimit[Message] +- client.messages.delete(message_id, \*, chat_id, \*\*params) -> None +- client.messages.search(\*\*params) -> SyncCursorSearch[Message] +- client.messages.send(chat_id, \*\*params) -> MessageSendResponse + +# Assets + +Types: + +```python +from beeper_desktop_api.types import ( + AssetDownloadResponse, + AssetUploadResponse, + AssetUploadBase64Response, +) +``` + +Methods: + +- client.assets.download(\*\*params) -> AssetDownloadResponse +- client.assets.serve(\*\*params) -> BinaryAPIResponse +- client.assets.upload(\*\*params) -> AssetUploadResponse +- client.assets.upload_base64(\*\*params) -> AssetUploadBase64Response + +# Info + +Types: + +```python +from beeper_desktop_api.types import InfoRetrieveResponse +``` + +Methods: + +- client.info.retrieve() -> InfoRetrieveResponse + # App Types: @@ -134,43 +262,6 @@ Methods: - client.app.e2ee.verification.sas.confirm(verification_id) -> SaConfirmResponse - client.app.e2ee.verification.sas.start(verification_id) -> SaStartResponse -# Accounts - -Types: - -```python -from beeper_desktop_api.types import Account, AccountListResponse -``` - -Methods: - -- client.accounts.list() -> AccountListResponse - -## Contacts - -Types: - -```python -from beeper_desktop_api.types.accounts import ContactSearchResponse -``` - -Methods: - -- client.accounts.contacts.list(account_id, \*\*params) -> SyncCursorSearch[User] -- client.accounts.contacts.search(account_id, \*\*params) -> ContactSearchResponse - -# Bridges - -Types: - -```python -from beeper_desktop_api.types import BridgeAvailability, BridgeListResponse -``` - -Methods: - -- client.bridges.list() -> BridgeListResponse - # Matrix ## Users @@ -316,94 +407,3 @@ from beeper_desktop_api.types.matrix.bridges import CapabilityRetrieveResponse Methods: - client.matrix.bridges.capabilities.retrieve(bridge_id) -> CapabilityRetrieveResponse - -# Chats - -Types: - -```python -from beeper_desktop_api.types import Chat, ChatCreateResponse, ChatListResponse, ChatStartResponse -``` - -Methods: - -- client.chats.create(\*\*params) -> ChatCreateResponse -- client.chats.retrieve(chat_id, \*\*params) -> Chat -- client.chats.update(chat_id, \*\*params) -> Chat -- client.chats.list(\*\*params) -> SyncCursorNoLimit[ChatListResponse] -- client.chats.archive(chat_id, \*\*params) -> None -- client.chats.mark_read(chat_id, \*\*params) -> Chat -- client.chats.mark_unread(chat_id, \*\*params) -> Chat -- client.chats.notify_anyway(chat_id) -> Chat -- client.chats.search(\*\*params) -> SyncCursorSearch[Chat] -- client.chats.start(\*\*params) -> ChatStartResponse - -## Reminders - -Methods: - -- client.chats.reminders.create(chat_id, \*\*params) -> None -- client.chats.reminders.delete(chat_id) -> None - -## Messages - -### Reactions - -Types: - -```python -from beeper_desktop_api.types.chats.messages import ReactionDeleteResponse, ReactionAddResponse -``` - -Methods: - -- client.chats.messages.reactions.delete(reaction_key, \*, chat_id, message_id) -> ReactionDeleteResponse -- client.chats.messages.reactions.add(message_id, \*, chat_id, \*\*params) -> ReactionAddResponse - -# Messages - -Types: - -```python -from beeper_desktop_api.types import MessageUpdateResponse, MessageSendResponse -``` - -Methods: - -- client.messages.retrieve(message_id, \*, chat_id) -> Message -- client.messages.update(message_id, \*, chat_id, \*\*params) -> MessageUpdateResponse -- client.messages.list(chat_id, \*\*params) -> SyncCursorNoLimit[Message] -- client.messages.delete(message_id, \*, chat_id, \*\*params) -> None -- client.messages.search(\*\*params) -> SyncCursorSearch[Message] -- client.messages.send(chat_id, \*\*params) -> MessageSendResponse - -# Assets - -Types: - -```python -from beeper_desktop_api.types import ( - AssetDownloadResponse, - AssetUploadResponse, - AssetUploadBase64Response, -) -``` - -Methods: - -- client.assets.download(\*\*params) -> AssetDownloadResponse -- client.assets.serve(\*\*params) -> BinaryAPIResponse -- client.assets.upload(\*\*params) -> AssetUploadResponse -- client.assets.upload_base64(\*\*params) -> AssetUploadBase64Response - -# Info - -Types: - -```python -from beeper_desktop_api.types import InfoRetrieveResponse -``` - -Methods: - -- client.info.retrieve() -> InfoRetrieveResponse diff --git a/src/beeper_desktop_api/_client.py b/src/beeper_desktop_api/_client.py index cec1b75..9327a44 100644 --- a/src/beeper_desktop_api/_client.py +++ b/src/beeper_desktop_api/_client.py @@ -41,7 +41,7 @@ async_to_streamed_response_wrapper, ) from ._streaming import Stream as Stream, AsyncStream as AsyncStream -from ._exceptions import APIStatusError +from ._exceptions import APIStatusError, BeeperDesktopError from ._base_client import ( DEFAULT_MAX_RETRIES, SyncAPIClient, @@ -76,7 +76,7 @@ class BeeperDesktop(SyncAPIClient): # client options - access_token: str | None + access_token: str def __init__( self, @@ -107,6 +107,10 @@ def __init__( """ if access_token is None: access_token = os.environ.get("BEEPER_ACCESS_TOKEN") + if access_token is None: + raise BeeperDesktopError( + "The access_token client option must be set either by passing access_token to the client or by setting the BEEPER_ACCESS_TOKEN environment variable" + ) self.access_token = access_token if base_url is None: @@ -134,13 +138,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - @cached_property - def app(self) -> AppResource: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AppResource - - return AppResource(self) - @cached_property def accounts(self) -> AccountsResource: """Manage connected chat accounts""" @@ -155,13 +152,6 @@ def bridges(self) -> BridgesResource: return BridgesResource(self) - @cached_property - def matrix(self) -> MatrixResource: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import MatrixResource - - return MatrixResource(self) - @cached_property def chats(self) -> ChatsResource: """Manage chats""" @@ -193,6 +183,20 @@ def info(self) -> InfoResource: return InfoResource(self) + @cached_property + def app(self) -> AppResource: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResource + + return AppResource(self) + + @cached_property + def matrix(self) -> MatrixResource: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import MatrixResource + + return MatrixResource(self) + @cached_property def with_raw_response(self) -> BeeperDesktopWithRawResponse: return BeeperDesktopWithRawResponse(self) @@ -215,8 +219,6 @@ def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: @property def _bearer_auth(self) -> dict[str, str]: access_token = self.access_token - if access_token is None: - return {} return {"Authorization": f"Bearer {access_token}"} @property @@ -228,15 +230,6 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } - @override - def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: - if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit): - return - - raise TypeError( - '"Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted"' - ) - def copy( self, *, @@ -416,7 +409,7 @@ def _make_status_error( class AsyncBeeperDesktop(AsyncAPIClient): # client options - access_token: str | None + access_token: str def __init__( self, @@ -447,6 +440,10 @@ def __init__( """ if access_token is None: access_token = os.environ.get("BEEPER_ACCESS_TOKEN") + if access_token is None: + raise BeeperDesktopError( + "The access_token client option must be set either by passing access_token to the client or by setting the BEEPER_ACCESS_TOKEN environment variable" + ) self.access_token = access_token if base_url is None: @@ -474,13 +471,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - @cached_property - def app(self) -> AsyncAppResource: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AsyncAppResource - - return AsyncAppResource(self) - @cached_property def accounts(self) -> AsyncAccountsResource: """Manage connected chat accounts""" @@ -495,13 +485,6 @@ def bridges(self) -> AsyncBridgesResource: return AsyncBridgesResource(self) - @cached_property - def matrix(self) -> AsyncMatrixResource: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import AsyncMatrixResource - - return AsyncMatrixResource(self) - @cached_property def chats(self) -> AsyncChatsResource: """Manage chats""" @@ -533,6 +516,20 @@ def info(self) -> AsyncInfoResource: return AsyncInfoResource(self) + @cached_property + def app(self) -> AsyncAppResource: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResource + + return AsyncAppResource(self) + + @cached_property + def matrix(self) -> AsyncMatrixResource: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import AsyncMatrixResource + + return AsyncMatrixResource(self) + @cached_property def with_raw_response(self) -> AsyncBeeperDesktopWithRawResponse: return AsyncBeeperDesktopWithRawResponse(self) @@ -555,8 +552,6 @@ def _auth_headers(self, security: SecurityOptions) -> dict[str, str]: @property def _bearer_auth(self) -> dict[str, str]: access_token = self.access_token - if access_token is None: - return {} return {"Authorization": f"Bearer {access_token}"} @property @@ -568,15 +563,6 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } - @override - def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: - if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit): - return - - raise TypeError( - '"Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted"' - ) - def copy( self, *, @@ -767,13 +753,6 @@ def __init__(self, client: BeeperDesktop) -> None: client.search, ) - @cached_property - def app(self) -> app.AppResourceWithRawResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AppResourceWithRawResponse - - return AppResourceWithRawResponse(self._client.app) - @cached_property def accounts(self) -> accounts.AccountsResourceWithRawResponse: """Manage connected chat accounts""" @@ -788,13 +767,6 @@ def bridges(self) -> bridges.BridgesResourceWithRawResponse: return BridgesResourceWithRawResponse(self._client.bridges) - @cached_property - def matrix(self) -> matrix.MatrixResourceWithRawResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import MatrixResourceWithRawResponse - - return MatrixResourceWithRawResponse(self._client.matrix) - @cached_property def chats(self) -> chats.ChatsResourceWithRawResponse: """Manage chats""" @@ -826,6 +798,20 @@ def info(self) -> info.InfoResourceWithRawResponse: return InfoResourceWithRawResponse(self._client.info) + @cached_property + def app(self) -> app.AppResourceWithRawResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResourceWithRawResponse + + return AppResourceWithRawResponse(self._client.app) + + @cached_property + def matrix(self) -> matrix.MatrixResourceWithRawResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import MatrixResourceWithRawResponse + + return MatrixResourceWithRawResponse(self._client.matrix) + class AsyncBeeperDesktopWithRawResponse: _client: AsyncBeeperDesktop @@ -840,13 +826,6 @@ def __init__(self, client: AsyncBeeperDesktop) -> None: client.search, ) - @cached_property - def app(self) -> app.AsyncAppResourceWithRawResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AsyncAppResourceWithRawResponse - - return AsyncAppResourceWithRawResponse(self._client.app) - @cached_property def accounts(self) -> accounts.AsyncAccountsResourceWithRawResponse: """Manage connected chat accounts""" @@ -861,13 +840,6 @@ def bridges(self) -> bridges.AsyncBridgesResourceWithRawResponse: return AsyncBridgesResourceWithRawResponse(self._client.bridges) - @cached_property - def matrix(self) -> matrix.AsyncMatrixResourceWithRawResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import AsyncMatrixResourceWithRawResponse - - return AsyncMatrixResourceWithRawResponse(self._client.matrix) - @cached_property def chats(self) -> chats.AsyncChatsResourceWithRawResponse: """Manage chats""" @@ -899,6 +871,20 @@ def info(self) -> info.AsyncInfoResourceWithRawResponse: return AsyncInfoResourceWithRawResponse(self._client.info) + @cached_property + def app(self) -> app.AsyncAppResourceWithRawResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResourceWithRawResponse + + return AsyncAppResourceWithRawResponse(self._client.app) + + @cached_property + def matrix(self) -> matrix.AsyncMatrixResourceWithRawResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import AsyncMatrixResourceWithRawResponse + + return AsyncMatrixResourceWithRawResponse(self._client.matrix) + class BeeperDesktopWithStreamedResponse: _client: BeeperDesktop @@ -913,13 +899,6 @@ def __init__(self, client: BeeperDesktop) -> None: client.search, ) - @cached_property - def app(self) -> app.AppResourceWithStreamingResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AppResourceWithStreamingResponse - - return AppResourceWithStreamingResponse(self._client.app) - @cached_property def accounts(self) -> accounts.AccountsResourceWithStreamingResponse: """Manage connected chat accounts""" @@ -934,13 +913,6 @@ def bridges(self) -> bridges.BridgesResourceWithStreamingResponse: return BridgesResourceWithStreamingResponse(self._client.bridges) - @cached_property - def matrix(self) -> matrix.MatrixResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import MatrixResourceWithStreamingResponse - - return MatrixResourceWithStreamingResponse(self._client.matrix) - @cached_property def chats(self) -> chats.ChatsResourceWithStreamingResponse: """Manage chats""" @@ -972,6 +944,20 @@ def info(self) -> info.InfoResourceWithStreamingResponse: return InfoResourceWithStreamingResponse(self._client.info) + @cached_property + def app(self) -> app.AppResourceWithStreamingResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResourceWithStreamingResponse + + return AppResourceWithStreamingResponse(self._client.app) + + @cached_property + def matrix(self) -> matrix.MatrixResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import MatrixResourceWithStreamingResponse + + return MatrixResourceWithStreamingResponse(self._client.matrix) + class AsyncBeeperDesktopWithStreamedResponse: _client: AsyncBeeperDesktop @@ -986,13 +972,6 @@ def __init__(self, client: AsyncBeeperDesktop) -> None: client.search, ) - @cached_property - def app(self) -> app.AsyncAppResourceWithStreamingResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AsyncAppResourceWithStreamingResponse - - return AsyncAppResourceWithStreamingResponse(self._client.app) - @cached_property def accounts(self) -> accounts.AsyncAccountsResourceWithStreamingResponse: """Manage connected chat accounts""" @@ -1007,13 +986,6 @@ def bridges(self) -> bridges.AsyncBridgesResourceWithStreamingResponse: return AsyncBridgesResourceWithStreamingResponse(self._client.bridges) - @cached_property - def matrix(self) -> matrix.AsyncMatrixResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import AsyncMatrixResourceWithStreamingResponse - - return AsyncMatrixResourceWithStreamingResponse(self._client.matrix) - @cached_property def chats(self) -> chats.AsyncChatsResourceWithStreamingResponse: """Manage chats""" @@ -1045,6 +1017,20 @@ def info(self) -> info.AsyncInfoResourceWithStreamingResponse: return AsyncInfoResourceWithStreamingResponse(self._client.info) + @cached_property + def app(self) -> app.AsyncAppResourceWithStreamingResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResourceWithStreamingResponse + + return AsyncAppResourceWithStreamingResponse(self._client.app) + + @cached_property + def matrix(self) -> matrix.AsyncMatrixResourceWithStreamingResponse: + """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" + from .resources.matrix import AsyncMatrixResourceWithStreamingResponse + + return AsyncMatrixResourceWithStreamingResponse(self._client.matrix) + Client = BeeperDesktop diff --git a/src/beeper_desktop_api/resources/__init__.py b/src/beeper_desktop_api/resources/__init__.py index 165308b..26dee5c 100644 --- a/src/beeper_desktop_api/resources/__init__.py +++ b/src/beeper_desktop_api/resources/__init__.py @@ -66,12 +66,6 @@ ) __all__ = [ - "AppResource", - "AsyncAppResource", - "AppResourceWithRawResponse", - "AsyncAppResourceWithRawResponse", - "AppResourceWithStreamingResponse", - "AsyncAppResourceWithStreamingResponse", "AccountsResource", "AsyncAccountsResource", "AccountsResourceWithRawResponse", @@ -84,12 +78,6 @@ "AsyncBridgesResourceWithRawResponse", "BridgesResourceWithStreamingResponse", "AsyncBridgesResourceWithStreamingResponse", - "MatrixResource", - "AsyncMatrixResource", - "MatrixResourceWithRawResponse", - "AsyncMatrixResourceWithRawResponse", - "MatrixResourceWithStreamingResponse", - "AsyncMatrixResourceWithStreamingResponse", "ChatsResource", "AsyncChatsResource", "ChatsResourceWithRawResponse", @@ -114,4 +102,16 @@ "AsyncInfoResourceWithRawResponse", "InfoResourceWithStreamingResponse", "AsyncInfoResourceWithStreamingResponse", + "AppResource", + "AsyncAppResource", + "AppResourceWithRawResponse", + "AsyncAppResourceWithRawResponse", + "AppResourceWithStreamingResponse", + "AsyncAppResourceWithStreamingResponse", + "MatrixResource", + "AsyncMatrixResource", + "MatrixResourceWithRawResponse", + "AsyncMatrixResourceWithRawResponse", + "MatrixResourceWithStreamingResponse", + "AsyncMatrixResourceWithStreamingResponse", ] diff --git a/tests/test_client.py b/tests/test_client.py index f5dae02..d9ab686 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -23,7 +23,12 @@ from beeper_desktop_api._types import Omit from beeper_desktop_api._utils import asyncify from beeper_desktop_api._models import BaseModel, FinalRequestOptions -from beeper_desktop_api._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError +from beeper_desktop_api._exceptions import ( + APIStatusError, + APITimeoutError, + BeeperDesktopError, + APIResponseValidationError, +) from beeper_desktop_api._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, @@ -410,19 +415,10 @@ def test_validate_headers(self) -> None: request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("Authorization") == f"Bearer {access_token}" - with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): - client2 = BeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) - - with pytest.raises( - TypeError, - match="Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted", - ): - client2._build_request(FinalRequestOptions(method="get", url="/foo")) - - request2 = client2._build_request( - FinalRequestOptions(method="get", url="/foo", headers={"Authorization": Omit()}) - ) - assert request2.headers.get("Authorization") is None + with pytest.raises(BeeperDesktopError): + with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): + client2 = BeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) + _ = client2 def test_default_query_option(self) -> None: client = BeeperDesktop( @@ -1366,19 +1362,10 @@ def test_validate_headers(self) -> None: request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("Authorization") == f"Bearer {access_token}" - with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): - client2 = AsyncBeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) - - with pytest.raises( - TypeError, - match="Could not resolve authentication method. Expected the access_token to be set. Or for the `Authorization` headers to be explicitly omitted", - ): - client2._build_request(FinalRequestOptions(method="get", url="/foo")) - - request2 = client2._build_request( - FinalRequestOptions(method="get", url="/foo", headers={"Authorization": Omit()}) - ) - assert request2.headers.get("Authorization") is None + with pytest.raises(BeeperDesktopError): + with update_env(**{"BEEPER_ACCESS_TOKEN": Omit()}): + client2 = AsyncBeeperDesktop(base_url=base_url, access_token=None, _strict_response_validation=True) + _ = client2 async def test_default_query_option(self) -> None: client = AsyncBeeperDesktop( From 9c92ab490194b4640b4c152e197df698b87d465b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 17 May 2026 16:31:35 +0000 Subject: [PATCH 09/11] feat(api): api update --- .stats.yml | 8 +- api.md | 326 ++---- src/beeper_desktop_api/_client.py | 130 +-- src/beeper_desktop_api/resources/__init__.py | 28 - .../resources/accounts/accounts.py | 92 +- .../resources/accounts/contacts.py | 8 +- .../resources/app/__init__.py | 47 - src/beeper_desktop_api/resources/app/app.py | 223 ---- .../resources/app/e2ee/__init__.py | 47 - .../resources/app/e2ee/e2ee.py | 150 --- .../app/e2ee/recovery_code/__init__.py | 33 - .../app/e2ee/recovery_code/recovery_code.py | 264 ----- .../resources/app/e2ee/recovery_code/reset.py | 252 ----- .../app/e2ee/verification/__init__.py | 47 - .../resources/app/e2ee/verification/qr.py | 258 ----- .../resources/app/e2ee/verification/sas.py | 255 ----- .../app/e2ee/verification/verification.py | 439 -------- src/beeper_desktop_api/resources/app/login.py | 508 ---------- src/beeper_desktop_api/resources/assets.py | 24 +- src/beeper_desktop_api/resources/bridges.py | 145 --- .../resources/bridges/__init__.py | 47 + .../resources/bridges/bridges.py | 420 ++++++++ .../login_flows.py} | 122 +-- .../bridges/login_sessions/__init__.py | 33 + .../bridges/login_sessions/login_sessions.py | 468 +++++++++ .../resources/bridges/login_sessions/steps.py | 250 +++++ .../resources/chats/chats.py | 110 +- .../resources/chats/messages/reactions.py | 16 +- .../resources/chats/reminders.py | 24 +- src/beeper_desktop_api/resources/info.py | 4 +- .../resources/matrix/__init__.py | 61 -- .../resources/matrix/bridges/__init__.py | 89 -- .../resources/matrix/bridges/auth.py | 951 ------------------ .../resources/matrix/bridges/bridges.py | 264 ----- .../resources/matrix/bridges/contacts.py | 189 ---- .../resources/matrix/bridges/rooms.py | 386 ------- .../resources/matrix/bridges/users.py | 304 ------ .../resources/matrix/matrix.py | 176 ---- .../resources/matrix/rooms/__init__.py | 61 -- .../resources/matrix/rooms/account_data.py | 302 ------ .../resources/matrix/rooms/events.py | 174 ---- .../resources/matrix/rooms/rooms.py | 845 ---------------- .../resources/matrix/rooms/state.py | 294 ------ .../resources/matrix/users/__init__.py | 33 - .../resources/matrix/users/account_data.py | 270 ----- .../resources/matrix/users/users.py | 196 ---- src/beeper_desktop_api/resources/messages.py | 68 +- src/beeper_desktop_api/types/__init__.py | 16 +- src/beeper_desktop_api/types/account.py | 52 +- .../types/account_bridge.py | 31 + .../types/account_retrieve_response.py | 60 ++ .../types/accounts/contact_list_params.py | 2 +- .../types/accounts/contact_search_params.py | 2 +- src/beeper_desktop_api/types/app/__init__.py | 7 - .../types/app/e2ee/__init__.py | 12 - .../types/app/e2ee/recovery_code/__init__.py | 8 - .../recovery_code/reset_confirm_params.py | 14 - .../recovery_code/reset_confirm_response.py | 170 ---- .../e2ee/recovery_code/reset_create_params.py | 14 - .../recovery_code/reset_create_response.py | 173 ---- .../recovery_code_mark_backed_up_response.py | 170 ---- .../app/e2ee/recovery_code_verify_params.py | 14 - .../app/e2ee/recovery_code_verify_response.py | 170 ---- .../types/app/e2ee/verification/__init__.py | 9 - .../qr_confirm_scanned_response.py | 170 ---- .../app/e2ee/verification/qr_scan_params.py | 12 - .../app/e2ee/verification/qr_scan_response.py | 170 ---- .../e2ee/verification/sa_confirm_response.py | 170 ---- .../e2ee/verification/sa_start_response.py | 170 ---- .../app/e2ee/verification_accept_response.py | 170 ---- .../app/e2ee/verification_cancel_params.py | 15 - .../app/e2ee/verification_cancel_response.py | 170 ---- .../app/e2ee/verification_create_params.py | 14 - .../app/e2ee/verification_create_response.py | 173 ---- .../types/app/login}/__init__.py | 2 + .../types/app/login}/verification/__init__.py | 2 + .../verification/recovery_key}/__init__.py | 2 + .../types/app/login_email_params.py | 15 - .../types/app/login_register_params.py | 26 - .../types/app/login_register_response.py | 207 ---- .../types/app/login_response_params.py | 15 - .../types/app/login_response_response.py | 246 ----- .../types/app/login_start_response.py | 15 - .../types/app/verifications}/__init__.py | 2 + .../types/app_status_response.py | 154 --- .../types/asset_download_params.py | 2 +- src/beeper_desktop_api/types/bridge.py | 51 + .../types/bridge_availability.py | 63 -- .../types/bridge_list_response.py | 6 +- .../types/bridge_retrieve_response.py | 51 + .../types/bridges/__init__.py | 7 + .../types/bridges/login_flow_list_response.py | 12 + .../bridges/login_session_cancel_response.py | 17 + .../bridges/login_session_create_params.py | 23 + .../login_sessions}/__init__.py | 2 +- .../login_sessions/step_submit_params.py | 33 + src/beeper_desktop_api/types/chat.py | 6 +- .../types/chat_search_params.py | 21 +- .../types/chat_start_params.py | 4 +- .../types/chat_update_params.py | 4 +- .../chats/messages/reaction_add_params.py | 4 +- .../chats/messages/reaction_add_response.py | 4 +- .../messages/reaction_delete_response.py | 4 +- .../types/client_focus_params.py | 2 +- .../types/client_search_params.py | 2 +- src/beeper_desktop_api/types/cookie_field.py | 19 + .../types/disappearing_timer_capability.py | 18 + .../types/group_field_capability.py | 23 + .../types/group_type_capabilities.py | 35 + .../types/info_retrieve_response.py | 2 +- src/beeper_desktop_api/types/login_flow.py | 20 + .../types/login_input_field.py | 29 + src/beeper_desktop_api/types/login_session.py | 207 ++++ .../types/matrix/__init__.py | 10 - .../types/matrix/bridges/__init__.py | 25 - .../bridges/auth_list_flows_response.py | 27 - .../bridges/auth_list_logins_response.py | 11 - .../matrix/bridges/auth_start_login_params.py | 20 - .../bridges/auth_start_login_response.py | 278 ----- .../bridges/auth_submit_cookies_params.py | 18 - .../bridges/auth_submit_cookies_response.py | 278 ----- .../bridges/auth_submit_user_input_params.py | 18 - .../auth_submit_user_input_response.py | 278 ----- .../bridges/auth_wait_for_step_response.py | 278 ----- .../matrix/bridges/auth_whoami_response.py | 128 --- .../bridges/capability_retrieve_response.py | 8 - .../matrix/bridges/contact_list_params.py | 12 - .../matrix/bridges/contact_list_response.py | 33 - .../matrix/bridges/room_create_dm_params.py | 16 - .../matrix/bridges/room_create_dm_response.py | 29 - .../bridges/room_create_group_params.py | 72 -- .../bridges/room_create_group_response.py | 15 - .../matrix/bridges/user_resolve_params.py | 16 - .../matrix/bridges/user_resolve_response.py | 29 - .../matrix/bridges/user_search_params.py | 15 - .../matrix/bridges/user_search_response.py | 33 - .../types/matrix/room_create_params.py | 157 --- .../types/matrix/room_create_response.py | 12 - .../types/matrix/room_join_params.py | 49 - .../types/matrix/room_join_response.py | 10 - .../types/matrix/room_leave_params.py | 15 - .../types/matrix/rooms/__init__.py | 9 - .../rooms/account_data_update_params.py | 17 - .../matrix/rooms/event_retrieve_response.py | 94 -- .../types/matrix/rooms/state_list_response.py | 98 -- .../matrix/rooms/state_retrieve_params.py | 23 - .../matrix/rooms/state_retrieve_response.py | 8 - .../matrix/user_retrieve_profile_response.py | 32 - .../users/account_data_update_params.py | 15 - .../types/message_delete_params.py | 4 +- .../types/message_search_params.py | 9 +- .../types/message_send_params.py | 4 +- .../types/message_send_response.py | 4 +- .../types/message_update_params.py | 4 +- .../types/provisioning_capabilities.py | 20 + .../types/resolve_identifier_capabilities.py | 23 + .../types/shared/__init__.py | 1 + .../types/shared/api_error.py | 15 + .../types/shared/app_state_snapshot.py | 112 ++- .../types/shared/attachment.py | 6 +- .../types/shared/message.py | 25 +- .../types/shared/reaction.py | 2 +- src/beeper_desktop_api/types/shared/user.py | 6 +- .../app/e2ee/recovery_code/test_reset.py | 153 --- .../app/e2ee/test_recovery_code.py | 139 --- .../app/e2ee/test_verification.py | 262 ----- .../app/e2ee/verification/test_qr.py | 162 --- .../app/e2ee/verification/test_sas.py | 176 ---- tests/api_resources/app/test_login.py | 294 ------ .../{app => bridges}/__init__.py | 0 .../login_sessions}/__init__.py | 0 .../bridges/login_sessions/test_steps.py | 182 ++++ .../test_login_flows.py} | 74 +- .../bridges/test_login_sessions.py | 313 ++++++ .../api_resources/matrix/bridges/test_auth.py | 854 ---------------- .../matrix/bridges/test_capabilities.py | 100 -- .../matrix/bridges/test_rooms.py | 279 ----- .../matrix/bridges/test_users.py | 235 ----- tests/api_resources/matrix/rooms/__init__.py | 1 - .../matrix/rooms/test_account_data.py | 275 ----- .../api_resources/matrix/rooms/test_events.py | 120 --- .../api_resources/matrix/rooms/test_state.py | 240 ----- tests/api_resources/matrix/test_rooms.py | 337 ------- tests/api_resources/matrix/test_users.py | 100 -- tests/api_resources/matrix/users/__init__.py | 1 - .../matrix/users/test_account_data.py | 225 ----- tests/api_resources/test_accounts.py | 78 +- tests/api_resources/test_app.py | 74 -- tests/api_resources/test_bridges.py | 154 ++- 189 files changed, 3219 insertions(+), 16986 deletions(-) delete mode 100644 src/beeper_desktop_api/resources/app/__init__.py delete mode 100644 src/beeper_desktop_api/resources/app/app.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/__init__.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/e2ee.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/qr.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/sas.py delete mode 100644 src/beeper_desktop_api/resources/app/e2ee/verification/verification.py delete mode 100644 src/beeper_desktop_api/resources/app/login.py delete mode 100644 src/beeper_desktop_api/resources/bridges.py create mode 100644 src/beeper_desktop_api/resources/bridges/__init__.py create mode 100644 src/beeper_desktop_api/resources/bridges/bridges.py rename src/beeper_desktop_api/resources/{matrix/bridges/capabilities.py => bridges/login_flows.py} (55%) create mode 100644 src/beeper_desktop_api/resources/bridges/login_sessions/__init__.py create mode 100644 src/beeper_desktop_api/resources/bridges/login_sessions/login_sessions.py create mode 100644 src/beeper_desktop_api/resources/bridges/login_sessions/steps.py delete mode 100644 src/beeper_desktop_api/resources/matrix/__init__.py delete mode 100644 src/beeper_desktop_api/resources/matrix/bridges/__init__.py delete mode 100644 src/beeper_desktop_api/resources/matrix/bridges/auth.py delete mode 100644 src/beeper_desktop_api/resources/matrix/bridges/bridges.py delete mode 100644 src/beeper_desktop_api/resources/matrix/bridges/contacts.py delete mode 100644 src/beeper_desktop_api/resources/matrix/bridges/rooms.py delete mode 100644 src/beeper_desktop_api/resources/matrix/bridges/users.py delete mode 100644 src/beeper_desktop_api/resources/matrix/matrix.py delete mode 100644 src/beeper_desktop_api/resources/matrix/rooms/__init__.py delete mode 100644 src/beeper_desktop_api/resources/matrix/rooms/account_data.py delete mode 100644 src/beeper_desktop_api/resources/matrix/rooms/events.py delete mode 100644 src/beeper_desktop_api/resources/matrix/rooms/rooms.py delete mode 100644 src/beeper_desktop_api/resources/matrix/rooms/state.py delete mode 100644 src/beeper_desktop_api/resources/matrix/users/__init__.py delete mode 100644 src/beeper_desktop_api/resources/matrix/users/account_data.py delete mode 100644 src/beeper_desktop_api/resources/matrix/users/users.py create mode 100644 src/beeper_desktop_api/types/account_bridge.py create mode 100644 src/beeper_desktop_api/types/account_retrieve_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/__init__.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/__init__.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_create_params.py delete mode 100644 src/beeper_desktop_api/types/app/e2ee/verification_create_response.py rename {tests/api_resources/matrix => src/beeper_desktop_api/types/app/login}/__init__.py (70%) rename {tests/api_resources/app/e2ee => src/beeper_desktop_api/types/app/login}/verification/__init__.py (70%) rename {tests/api_resources/matrix/bridges => src/beeper_desktop_api/types/app/login/verification/recovery_key}/__init__.py (70%) delete mode 100644 src/beeper_desktop_api/types/app/login_email_params.py delete mode 100644 src/beeper_desktop_api/types/app/login_register_params.py delete mode 100644 src/beeper_desktop_api/types/app/login_register_response.py delete mode 100644 src/beeper_desktop_api/types/app/login_response_params.py delete mode 100644 src/beeper_desktop_api/types/app/login_response_response.py delete mode 100644 src/beeper_desktop_api/types/app/login_start_response.py rename {tests/api_resources/app/e2ee/recovery_code => src/beeper_desktop_api/types/app/verifications}/__init__.py (70%) delete mode 100644 src/beeper_desktop_api/types/app_status_response.py create mode 100644 src/beeper_desktop_api/types/bridge.py delete mode 100644 src/beeper_desktop_api/types/bridge_availability.py create mode 100644 src/beeper_desktop_api/types/bridge_retrieve_response.py create mode 100644 src/beeper_desktop_api/types/bridges/__init__.py create mode 100644 src/beeper_desktop_api/types/bridges/login_flow_list_response.py create mode 100644 src/beeper_desktop_api/types/bridges/login_session_cancel_response.py create mode 100644 src/beeper_desktop_api/types/bridges/login_session_create_params.py rename src/beeper_desktop_api/types/{matrix/users => bridges/login_sessions}/__init__.py (57%) create mode 100644 src/beeper_desktop_api/types/bridges/login_sessions/step_submit_params.py create mode 100644 src/beeper_desktop_api/types/cookie_field.py create mode 100644 src/beeper_desktop_api/types/disappearing_timer_capability.py create mode 100644 src/beeper_desktop_api/types/group_field_capability.py create mode 100644 src/beeper_desktop_api/types/group_type_capabilities.py create mode 100644 src/beeper_desktop_api/types/login_flow.py create mode 100644 src/beeper_desktop_api/types/login_input_field.py create mode 100644 src/beeper_desktop_api/types/login_session.py delete mode 100644 src/beeper_desktop_api/types/matrix/__init__.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/__init__.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_search_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/bridges/user_search_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/room_create_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/room_create_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/room_join_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/room_join_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/room_leave_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/rooms/__init__.py delete mode 100644 src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/rooms/state_list_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py delete mode 100644 src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py delete mode 100644 src/beeper_desktop_api/types/matrix/users/account_data_update_params.py create mode 100644 src/beeper_desktop_api/types/provisioning_capabilities.py create mode 100644 src/beeper_desktop_api/types/resolve_identifier_capabilities.py create mode 100644 src/beeper_desktop_api/types/shared/api_error.py delete mode 100644 tests/api_resources/app/e2ee/recovery_code/test_reset.py delete mode 100644 tests/api_resources/app/e2ee/test_recovery_code.py delete mode 100644 tests/api_resources/app/e2ee/test_verification.py delete mode 100644 tests/api_resources/app/e2ee/verification/test_qr.py delete mode 100644 tests/api_resources/app/e2ee/verification/test_sas.py delete mode 100644 tests/api_resources/app/test_login.py rename tests/api_resources/{app => bridges}/__init__.py (100%) rename tests/api_resources/{app/e2ee => bridges/login_sessions}/__init__.py (100%) create mode 100644 tests/api_resources/bridges/login_sessions/test_steps.py rename tests/api_resources/{matrix/bridges/test_contacts.py => bridges/test_login_flows.py} (50%) create mode 100644 tests/api_resources/bridges/test_login_sessions.py delete mode 100644 tests/api_resources/matrix/bridges/test_auth.py delete mode 100644 tests/api_resources/matrix/bridges/test_capabilities.py delete mode 100644 tests/api_resources/matrix/bridges/test_rooms.py delete mode 100644 tests/api_resources/matrix/bridges/test_users.py delete mode 100644 tests/api_resources/matrix/rooms/__init__.py delete mode 100644 tests/api_resources/matrix/rooms/test_account_data.py delete mode 100644 tests/api_resources/matrix/rooms/test_events.py delete mode 100644 tests/api_resources/matrix/rooms/test_state.py delete mode 100644 tests/api_resources/matrix/test_rooms.py delete mode 100644 tests/api_resources/matrix/test_users.py delete mode 100644 tests/api_resources/matrix/users/__init__.py delete mode 100644 tests/api_resources/matrix/users/test_account_data.py delete mode 100644 tests/api_resources/test_app.py diff --git a/.stats.yml b/.stats.yml index a6a4fc8..f8d6237 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 72 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-0427b028ffd00b4f8b75084116f801658d0279117b2d0e522d1f257c998f1fd0.yml -openapi_spec_hash: af3ed0745fca6831cf2540c36050d4e6 -config_hash: fbf60dd7c0de7e17c7e2bb0ee09e9937 +configured_endpoints: 39 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-87df69f641d994f09669f77093988df0b13da380d36076964d4a2563e9ce202e.yml +openapi_spec_hash: 9de80d05f7562b7ecd07c466f0fdf58b +config_hash: 2ebcc80e2cbd2342e132f4474ec24212 diff --git a/api.md b/api.md index 7ba1634..0828697 100644 --- a/api.md +++ b/api.md @@ -1,7 +1,15 @@ # Shared Types ```python -from beeper_desktop_api.types import AppStateSnapshot, Attachment, Error, Message, Reaction, User +from beeper_desktop_api.types import ( + APIError, + AppStateSnapshot, + Attachment, + Error, + Message, + Reaction, + User, +) ``` # BeeperDesktop @@ -22,11 +30,17 @@ Methods: Types: ```python -from beeper_desktop_api.types import Account, AccountListResponse +from beeper_desktop_api.types import ( + Account, + AccountBridge, + AccountRetrieveResponse, + AccountListResponse, +) ``` Methods: +- client.accounts.retrieve(account_id) -> AccountRetrieveResponse - client.accounts.list() -> AccountListResponse ## Contacts @@ -47,12 +61,59 @@ Methods: Types: ```python -from beeper_desktop_api.types import BridgeAvailability, BridgeListResponse +from beeper_desktop_api.types import ( + Bridge, + CookieField, + DisappearingTimerCapability, + GroupFieldCapability, + GroupTypeCapabilities, + LoginFlow, + LoginInputField, + LoginSession, + ProvisioningCapabilities, + ResolveIdentifierCapabilities, + BridgeRetrieveResponse, + BridgeListResponse, +) +``` + +Methods: + +- client.bridges.retrieve(bridge_id) -> BridgeRetrieveResponse +- client.bridges.list() -> BridgeListResponse +- client.bridges.retrieve_capabilities(bridge_id) -> ProvisioningCapabilities + +## LoginFlows + +Types: + +```python +from beeper_desktop_api.types.bridges import LoginFlowListResponse +``` + +Methods: + +- client.bridges.login_flows.list(bridge_id) -> LoginFlowListResponse + +## LoginSessions + +Types: + +```python +from beeper_desktop_api.types.bridges import LoginSessionCancelResponse ``` Methods: -- client.bridges.list() -> BridgeListResponse +- client.bridges.login_sessions.create(bridge_id, \*\*params) -> LoginSession +- client.bridges.login_sessions.retrieve(login_session_id, \*, bridge_id) -> LoginSession +- client.bridges.login_sessions.cancel(login_session_id, \*, bridge_id) -> LoginSessionCancelResponse + +### Steps + +Methods: + +- client.bridges.login_sessions.steps.submit(step_id, \*, bridge_id, login_session_id, \*\*params) -> LoginSession # Chats @@ -150,260 +211,5 @@ Methods: Types: ```python -from beeper_desktop_api.types import ( - LoginRegistrationRequiredResponse, - LoginResponse, - LoginResponseOutput, - RecoveryCodeResetResponse, - StartVerificationResponse, - StateMutationResponse, - AppStatusResponse, -) -``` - -Methods: - -- client.app.status() -> AppStatusResponse - -## Login - -Types: - -```python -from beeper_desktop_api.types.app import ( - LoginRegisterResponse, - LoginResponseResponse, - LoginStartResponse, -) -``` - -Methods: - -- client.app.login.email(\*\*params) -> object -- client.app.login.register(\*\*params) -> LoginRegisterResponse -- client.app.login.response(\*\*params) -> LoginResponseResponse -- client.app.login.start() -> LoginStartResponse - -## E2ee - -### RecoveryCode - -Types: - -```python -from beeper_desktop_api.types.app.e2ee import ( - RecoveryCodeMarkBackedUpResponse, - RecoveryCodeVerifyResponse, -) -``` - -Methods: - -- client.app.e2ee.recovery_code.mark_backed_up() -> RecoveryCodeMarkBackedUpResponse -- client.app.e2ee.recovery_code.verify(\*\*params) -> RecoveryCodeVerifyResponse - -#### Reset - -Types: - -```python -from beeper_desktop_api.types.app.e2ee.recovery_code import ( - ResetCreateResponse, - ResetConfirmResponse, -) -``` - -Methods: - -- client.app.e2ee.recovery_code.reset.create(\*\*params) -> ResetCreateResponse -- client.app.e2ee.recovery_code.reset.confirm(\*\*params) -> ResetConfirmResponse - -### Verification - -Types: - -```python -from beeper_desktop_api.types.app.e2ee import ( - VerificationCreateResponse, - VerificationAcceptResponse, - VerificationCancelResponse, -) -``` - -Methods: - -- client.app.e2ee.verification.create(\*\*params) -> VerificationCreateResponse -- client.app.e2ee.verification.accept(verification_id) -> VerificationAcceptResponse -- client.app.e2ee.verification.cancel(verification_id, \*\*params) -> VerificationCancelResponse - -#### Qr - -Types: - -```python -from beeper_desktop_api.types.app.e2ee.verification import QrConfirmScannedResponse, QrScanResponse -``` - -Methods: - -- client.app.e2ee.verification.qr.confirm_scanned(verification_id) -> QrConfirmScannedResponse -- client.app.e2ee.verification.qr.scan(\*\*params) -> QrScanResponse - -#### Sas - -Types: - -```python -from beeper_desktop_api.types.app.e2ee.verification import SaConfirmResponse, SaStartResponse -``` - -Methods: - -- client.app.e2ee.verification.sas.confirm(verification_id) -> SaConfirmResponse -- client.app.e2ee.verification.sas.start(verification_id) -> SaStartResponse - -# Matrix - -## Users - -Types: - -```python -from beeper_desktop_api.types.matrix import UserRetrieveProfileResponse -``` - -Methods: - -- client.matrix.users.retrieve_profile(user_id) -> UserRetrieveProfileResponse - -### AccountData - -Methods: - -- client.matrix.users.account_data.retrieve(type, \*, user_id) -> object -- client.matrix.users.account_data.update(type, \*, user_id, \*\*params) -> object - -## Rooms - -Types: - -```python -from beeper_desktop_api.types.matrix import RoomCreateResponse, RoomJoinResponse -``` - -Methods: - -- client.matrix.rooms.create(\*\*params) -> RoomCreateResponse -- client.matrix.rooms.join(room_id_or_alias, \*\*params) -> RoomJoinResponse -- client.matrix.rooms.leave(room_id, \*\*params) -> object - -### AccountData - -Methods: - -- client.matrix.rooms.account_data.retrieve(type, \*, user_id, room_id) -> object -- client.matrix.rooms.account_data.update(type, \*, user_id, room_id, \*\*params) -> object - -### State - -Types: - -```python -from beeper_desktop_api.types.matrix.rooms import StateRetrieveResponse, StateListResponse -``` - -Methods: - -- client.matrix.rooms.state.retrieve(state_key, \*, room_id, event_type, \*\*params) -> StateRetrieveResponse -- client.matrix.rooms.state.list(room_id) -> StateListResponse - -### Events - -Types: - -```python -from beeper_desktop_api.types.matrix.rooms import EventRetrieveResponse -``` - -Methods: - -- client.matrix.rooms.events.retrieve(event_id, \*, room_id) -> EventRetrieveResponse - -## Bridges - -### Auth - -Types: - -```python -from beeper_desktop_api.types.matrix.bridges import ( - AuthListFlowsResponse, - AuthListLoginsResponse, - AuthStartLoginResponse, - AuthSubmitCookiesResponse, - AuthSubmitUserInputResponse, - AuthWaitForStepResponse, - AuthWhoamiResponse, -) -``` - -Methods: - -- client.matrix.bridges.auth.list_flows(bridge_id) -> AuthListFlowsResponse -- client.matrix.bridges.auth.list_logins(bridge_id) -> AuthListLoginsResponse -- client.matrix.bridges.auth.logout(login_id, \*, bridge_id) -> object -- client.matrix.bridges.auth.start_login(flow_id, \*, bridge_id, \*\*params) -> AuthStartLoginResponse -- client.matrix.bridges.auth.submit_cookies(step_id, \*, bridge_id, login_process_id, \*\*params) -> AuthSubmitCookiesResponse -- client.matrix.bridges.auth.submit_user_input(step_id, \*, bridge_id, login_process_id, \*\*params) -> AuthSubmitUserInputResponse -- client.matrix.bridges.auth.wait_for_step(step_id, \*, bridge_id, login_process_id) -> AuthWaitForStepResponse -- client.matrix.bridges.auth.whoami(bridge_id) -> AuthWhoamiResponse - -### Contacts - -Types: - -```python -from beeper_desktop_api.types.matrix.bridges import ContactListResponse -``` - -Methods: - -- client.matrix.bridges.contacts.list(bridge_id, \*\*params) -> ContactListResponse - -### Users - -Types: - -```python -from beeper_desktop_api.types.matrix.bridges import UserResolveResponse, UserSearchResponse -``` - -Methods: - -- client.matrix.bridges.users.resolve(identifier, \*, bridge_id, \*\*params) -> UserResolveResponse -- client.matrix.bridges.users.search(bridge_id, \*\*params) -> UserSearchResponse - -### Rooms - -Types: - -```python -from beeper_desktop_api.types.matrix.bridges import RoomCreateDmResponse, RoomCreateGroupResponse +from beeper_desktop_api.types import Verification ``` - -Methods: - -- client.matrix.bridges.rooms.create_dm(identifier, \*, bridge_id, \*\*params) -> RoomCreateDmResponse -- client.matrix.bridges.rooms.create_group(group_type, \*, bridge_id, \*\*params) -> RoomCreateGroupResponse - -### Capabilities - -Types: - -```python -from beeper_desktop_api.types.matrix.bridges import CapabilityRetrieveResponse -``` - -Methods: - -- client.matrix.bridges.capabilities.retrieve(bridge_id) -> CapabilityRetrieveResponse diff --git a/src/beeper_desktop_api/_client.py b/src/beeper_desktop_api/_client.py index 9327a44..11ba7a6 100644 --- a/src/beeper_desktop_api/_client.py +++ b/src/beeper_desktop_api/_client.py @@ -52,14 +52,12 @@ from .types.search_response import SearchResponse if TYPE_CHECKING: - from .resources import app, info, chats, assets, matrix, bridges, accounts, messages + from .resources import info, chats, assets, bridges, accounts, messages from .resources.info import InfoResource, AsyncInfoResource from .resources.assets import AssetsResource, AsyncAssetsResource - from .resources.app.app import AppResource, AsyncAppResource - from .resources.bridges import BridgesResource, AsyncBridgesResource from .resources.messages import MessagesResource, AsyncMessagesResource from .resources.chats.chats import ChatsResource, AsyncChatsResource - from .resources.matrix.matrix import MatrixResource, AsyncMatrixResource + from .resources.bridges.bridges import BridgesResource, AsyncBridgesResource from .resources.accounts.accounts import AccountsResource, AsyncAccountsResource __all__ = [ @@ -147,7 +145,7 @@ def accounts(self) -> AccountsResource: @cached_property def bridges(self) -> BridgesResource: - """Manage bridge-backed account types and account availability""" + """Manage bridge-backed account types, connections, and login sessions""" from .resources.bridges import BridgesResource return BridgesResource(self) @@ -183,20 +181,6 @@ def info(self) -> InfoResource: return InfoResource(self) - @cached_property - def app(self) -> AppResource: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AppResource - - return AppResource(self) - - @cached_property - def matrix(self) -> MatrixResource: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import MatrixResource - - return MatrixResource(self) - @cached_property def with_raw_response(self) -> BeeperDesktopWithRawResponse: return BeeperDesktopWithRawResponse(self) @@ -296,14 +280,14 @@ def focus( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FocusResponse: """ - Focus Beeper Desktop and optionally navigate to a specific chat, message, or - pre-fill plain text and an image path. + Focus Beeper Desktop and optionally open a specific chat, jump to a message, or + pre-fill text and an image. Args: chat_id: Optional Beeper chat ID (or local chat ID) to focus after opening the app. If omitted, only opens/focuses the app. - draft_attachment_path: Optional image path to populate in the message input field. + draft_attachment_path: Optional local image path to populate in the message input field. draft_text: Optional plain text to populate in the message input field. @@ -346,12 +330,12 @@ def search( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchResponse: """ - Returns matching chats, participant name matches in groups, and the first page - of messages in one call. Paginate messages via search-messages. Paginate chats - via search-chats. + Return matching chats, participant matches in group chats, and the first page of + message results in one call. Use the dedicated chat and message search endpoints + for pagination. Args: - query: User-typed search text. Literal word matching (non-semantic). + query: User-typed search text. Uses literal word matching. extra_headers: Send extra headers @@ -480,7 +464,7 @@ def accounts(self) -> AsyncAccountsResource: @cached_property def bridges(self) -> AsyncBridgesResource: - """Manage bridge-backed account types and account availability""" + """Manage bridge-backed account types, connections, and login sessions""" from .resources.bridges import AsyncBridgesResource return AsyncBridgesResource(self) @@ -516,20 +500,6 @@ def info(self) -> AsyncInfoResource: return AsyncInfoResource(self) - @cached_property - def app(self) -> AsyncAppResource: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AsyncAppResource - - return AsyncAppResource(self) - - @cached_property - def matrix(self) -> AsyncMatrixResource: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import AsyncMatrixResource - - return AsyncMatrixResource(self) - @cached_property def with_raw_response(self) -> AsyncBeeperDesktopWithRawResponse: return AsyncBeeperDesktopWithRawResponse(self) @@ -629,14 +599,14 @@ async def focus( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FocusResponse: """ - Focus Beeper Desktop and optionally navigate to a specific chat, message, or - pre-fill plain text and an image path. + Focus Beeper Desktop and optionally open a specific chat, jump to a message, or + pre-fill text and an image. Args: chat_id: Optional Beeper chat ID (or local chat ID) to focus after opening the app. If omitted, only opens/focuses the app. - draft_attachment_path: Optional image path to populate in the message input field. + draft_attachment_path: Optional local image path to populate in the message input field. draft_text: Optional plain text to populate in the message input field. @@ -679,12 +649,12 @@ async def search( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchResponse: """ - Returns matching chats, participant name matches in groups, and the first page - of messages in one call. Paginate messages via search-messages. Paginate chats - via search-chats. + Return matching chats, participant matches in group chats, and the first page of + message results in one call. Use the dedicated chat and message search endpoints + for pagination. Args: - query: User-typed search text. Literal word matching (non-semantic). + query: User-typed search text. Uses literal word matching. extra_headers: Send extra headers @@ -762,7 +732,7 @@ def accounts(self) -> accounts.AccountsResourceWithRawResponse: @cached_property def bridges(self) -> bridges.BridgesResourceWithRawResponse: - """Manage bridge-backed account types and account availability""" + """Manage bridge-backed account types, connections, and login sessions""" from .resources.bridges import BridgesResourceWithRawResponse return BridgesResourceWithRawResponse(self._client.bridges) @@ -798,20 +768,6 @@ def info(self) -> info.InfoResourceWithRawResponse: return InfoResourceWithRawResponse(self._client.info) - @cached_property - def app(self) -> app.AppResourceWithRawResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AppResourceWithRawResponse - - return AppResourceWithRawResponse(self._client.app) - - @cached_property - def matrix(self) -> matrix.MatrixResourceWithRawResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import MatrixResourceWithRawResponse - - return MatrixResourceWithRawResponse(self._client.matrix) - class AsyncBeeperDesktopWithRawResponse: _client: AsyncBeeperDesktop @@ -835,7 +791,7 @@ def accounts(self) -> accounts.AsyncAccountsResourceWithRawResponse: @cached_property def bridges(self) -> bridges.AsyncBridgesResourceWithRawResponse: - """Manage bridge-backed account types and account availability""" + """Manage bridge-backed account types, connections, and login sessions""" from .resources.bridges import AsyncBridgesResourceWithRawResponse return AsyncBridgesResourceWithRawResponse(self._client.bridges) @@ -871,20 +827,6 @@ def info(self) -> info.AsyncInfoResourceWithRawResponse: return AsyncInfoResourceWithRawResponse(self._client.info) - @cached_property - def app(self) -> app.AsyncAppResourceWithRawResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AsyncAppResourceWithRawResponse - - return AsyncAppResourceWithRawResponse(self._client.app) - - @cached_property - def matrix(self) -> matrix.AsyncMatrixResourceWithRawResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import AsyncMatrixResourceWithRawResponse - - return AsyncMatrixResourceWithRawResponse(self._client.matrix) - class BeeperDesktopWithStreamedResponse: _client: BeeperDesktop @@ -908,7 +850,7 @@ def accounts(self) -> accounts.AccountsResourceWithStreamingResponse: @cached_property def bridges(self) -> bridges.BridgesResourceWithStreamingResponse: - """Manage bridge-backed account types and account availability""" + """Manage bridge-backed account types, connections, and login sessions""" from .resources.bridges import BridgesResourceWithStreamingResponse return BridgesResourceWithStreamingResponse(self._client.bridges) @@ -944,20 +886,6 @@ def info(self) -> info.InfoResourceWithStreamingResponse: return InfoResourceWithStreamingResponse(self._client.info) - @cached_property - def app(self) -> app.AppResourceWithStreamingResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AppResourceWithStreamingResponse - - return AppResourceWithStreamingResponse(self._client.app) - - @cached_property - def matrix(self) -> matrix.MatrixResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import MatrixResourceWithStreamingResponse - - return MatrixResourceWithStreamingResponse(self._client.matrix) - class AsyncBeeperDesktopWithStreamedResponse: _client: AsyncBeeperDesktop @@ -981,7 +909,7 @@ def accounts(self) -> accounts.AsyncAccountsResourceWithStreamingResponse: @cached_property def bridges(self) -> bridges.AsyncBridgesResourceWithStreamingResponse: - """Manage bridge-backed account types and account availability""" + """Manage bridge-backed account types, connections, and login sessions""" from .resources.bridges import AsyncBridgesResourceWithStreamingResponse return AsyncBridgesResourceWithStreamingResponse(self._client.bridges) @@ -1017,20 +945,6 @@ def info(self) -> info.AsyncInfoResourceWithStreamingResponse: return AsyncInfoResourceWithStreamingResponse(self._client.info) - @cached_property - def app(self) -> app.AsyncAppResourceWithStreamingResponse: - """Manage Beeper app login and encrypted messaging setup""" - from .resources.app import AsyncAppResourceWithStreamingResponse - - return AsyncAppResourceWithStreamingResponse(self._client.app) - - @cached_property - def matrix(self) -> matrix.AsyncMatrixResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - from .resources.matrix import AsyncMatrixResourceWithStreamingResponse - - return AsyncMatrixResourceWithStreamingResponse(self._client.matrix) - Client = BeeperDesktop diff --git a/src/beeper_desktop_api/resources/__init__.py b/src/beeper_desktop_api/resources/__init__.py index 26dee5c..7297cb8 100644 --- a/src/beeper_desktop_api/resources/__init__.py +++ b/src/beeper_desktop_api/resources/__init__.py @@ -1,13 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .app import ( - AppResource, - AsyncAppResource, - AppResourceWithRawResponse, - AsyncAppResourceWithRawResponse, - AppResourceWithStreamingResponse, - AsyncAppResourceWithStreamingResponse, -) from .info import ( InfoResource, AsyncInfoResource, @@ -32,14 +24,6 @@ AssetsResourceWithStreamingResponse, AsyncAssetsResourceWithStreamingResponse, ) -from .matrix import ( - MatrixResource, - AsyncMatrixResource, - MatrixResourceWithRawResponse, - AsyncMatrixResourceWithRawResponse, - MatrixResourceWithStreamingResponse, - AsyncMatrixResourceWithStreamingResponse, -) from .bridges import ( BridgesResource, AsyncBridgesResource, @@ -102,16 +86,4 @@ "AsyncInfoResourceWithRawResponse", "InfoResourceWithStreamingResponse", "AsyncInfoResourceWithStreamingResponse", - "AppResource", - "AsyncAppResource", - "AppResourceWithRawResponse", - "AsyncAppResourceWithRawResponse", - "AppResourceWithStreamingResponse", - "AsyncAppResourceWithStreamingResponse", - "MatrixResource", - "AsyncMatrixResource", - "MatrixResourceWithRawResponse", - "AsyncMatrixResourceWithRawResponse", - "MatrixResourceWithStreamingResponse", - "AsyncMatrixResourceWithStreamingResponse", ] diff --git a/src/beeper_desktop_api/resources/accounts/accounts.py b/src/beeper_desktop_api/resources/accounts/accounts.py index 15cfd33..8c247e4 100644 --- a/src/beeper_desktop_api/resources/accounts/accounts.py +++ b/src/beeper_desktop_api/resources/accounts/accounts.py @@ -5,6 +5,7 @@ import httpx from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template from .contacts import ( ContactsResource, AsyncContactsResource, @@ -23,6 +24,7 @@ ) from ..._base_client import make_request_options from ...types.account_list_response import AccountListResponse +from ...types.account_retrieve_response import AccountRetrieveResponse __all__ = ["AccountsResource", "AsyncAccountsResource"] @@ -54,6 +56,41 @@ def with_streaming_response(self) -> AccountsResourceWithStreamingResponse: """ return AccountsResourceWithStreamingResponse(self) + def retrieve( + self, + account_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, + ) -> AccountRetrieveResponse: + """ + Get one chat account connected to this Beeper Client API server. + + Args: + account_id: Account ID this resource belongs to. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get( + path_template("/v1/accounts/{account_id}", account_id=account_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountRetrieveResponse, + ) + def list( self, *, @@ -65,8 +102,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountListResponse: """ - List Chat Accounts connected to this Beeper Desktop instance, including bridge - metadata and network identity. + List chat accounts connected to this Beeper Client API server, including bridge, + network, user identity, and connection status. """ return self._get( "/v1/accounts", @@ -104,6 +141,41 @@ def with_streaming_response(self) -> AsyncAccountsResourceWithStreamingResponse: """ return AsyncAccountsResourceWithStreamingResponse(self) + async def retrieve( + self, + account_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, + ) -> AccountRetrieveResponse: + """ + Get one chat account connected to this Beeper Client API server. + + Args: + account_id: Account ID this resource belongs to. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._get( + path_template("/v1/accounts/{account_id}", account_id=account_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountRetrieveResponse, + ) + async def list( self, *, @@ -115,8 +187,8 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountListResponse: """ - List Chat Accounts connected to this Beeper Desktop instance, including bridge - metadata and network identity. + List chat accounts connected to this Beeper Client API server, including bridge, + network, user identity, and connection status. """ return await self._get( "/v1/accounts", @@ -131,6 +203,9 @@ class AccountsResourceWithRawResponse: def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts + self.retrieve = to_raw_response_wrapper( + accounts.retrieve, + ) self.list = to_raw_response_wrapper( accounts.list, ) @@ -145,6 +220,9 @@ class AsyncAccountsResourceWithRawResponse: def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts + self.retrieve = async_to_raw_response_wrapper( + accounts.retrieve, + ) self.list = async_to_raw_response_wrapper( accounts.list, ) @@ -159,6 +237,9 @@ class AccountsResourceWithStreamingResponse: def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts + self.retrieve = to_streamed_response_wrapper( + accounts.retrieve, + ) self.list = to_streamed_response_wrapper( accounts.list, ) @@ -173,6 +254,9 @@ class AsyncAccountsResourceWithStreamingResponse: def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts + self.retrieve = async_to_streamed_response_wrapper( + accounts.retrieve, + ) self.list = async_to_streamed_response_wrapper( accounts.list, ) diff --git a/src/beeper_desktop_api/resources/accounts/contacts.py b/src/beeper_desktop_api/resources/accounts/contacts.py index ba704bb..7c6469d 100644 --- a/src/beeper_desktop_api/resources/accounts/contacts.py +++ b/src/beeper_desktop_api/resources/accounts/contacts.py @@ -75,7 +75,7 @@ def list( limit: Maximum contacts to return per page. - query: Optional search query for blended contact lookup. + query: Optional search query for contact lookup. extra_headers: Send extra headers @@ -127,7 +127,7 @@ def search( Args: account_id: Account ID this resource belongs to. - query: Text to search users by. Network-specific behavior. + query: Text to search contacts by. Matching behavior depends on the network. extra_headers: Send extra headers @@ -202,7 +202,7 @@ def list( limit: Maximum contacts to return per page. - query: Optional search query for blended contact lookup. + query: Optional search query for contact lookup. extra_headers: Send extra headers @@ -254,7 +254,7 @@ async def search( Args: account_id: Account ID this resource belongs to. - query: Text to search users by. Network-specific behavior. + query: Text to search contacts by. Matching behavior depends on the network. extra_headers: Send extra headers diff --git a/src/beeper_desktop_api/resources/app/__init__.py b/src/beeper_desktop_api/resources/app/__init__.py deleted file mode 100644 index a21f690..0000000 --- a/src/beeper_desktop_api/resources/app/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .app import ( - AppResource, - AsyncAppResource, - AppResourceWithRawResponse, - AsyncAppResourceWithRawResponse, - AppResourceWithStreamingResponse, - AsyncAppResourceWithStreamingResponse, -) -from .e2ee import ( - E2eeResource, - AsyncE2eeResource, - E2eeResourceWithRawResponse, - AsyncE2eeResourceWithRawResponse, - E2eeResourceWithStreamingResponse, - AsyncE2eeResourceWithStreamingResponse, -) -from .login import ( - LoginResource, - AsyncLoginResource, - LoginResourceWithRawResponse, - AsyncLoginResourceWithRawResponse, - LoginResourceWithStreamingResponse, - AsyncLoginResourceWithStreamingResponse, -) - -__all__ = [ - "LoginResource", - "AsyncLoginResource", - "LoginResourceWithRawResponse", - "AsyncLoginResourceWithRawResponse", - "LoginResourceWithStreamingResponse", - "AsyncLoginResourceWithStreamingResponse", - "E2eeResource", - "AsyncE2eeResource", - "E2eeResourceWithRawResponse", - "AsyncE2eeResourceWithRawResponse", - "E2eeResourceWithStreamingResponse", - "AsyncE2eeResourceWithStreamingResponse", - "AppResource", - "AsyncAppResource", - "AppResourceWithRawResponse", - "AsyncAppResourceWithRawResponse", - "AppResourceWithStreamingResponse", - "AsyncAppResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/app/app.py b/src/beeper_desktop_api/resources/app/app.py deleted file mode 100644 index 73858b9..0000000 --- a/src/beeper_desktop_api/resources/app/app.py +++ /dev/null @@ -1,223 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .login import ( - LoginResource, - AsyncLoginResource, - LoginResourceWithRawResponse, - AsyncLoginResourceWithRawResponse, - LoginResourceWithStreamingResponse, - AsyncLoginResourceWithStreamingResponse, -) -from ..._types import Body, Query, Headers, NotGiven, not_given -from ..._compat import cached_property -from .e2ee.e2ee import ( - E2eeResource, - AsyncE2eeResource, - E2eeResourceWithRawResponse, - AsyncE2eeResourceWithRawResponse, - E2eeResourceWithStreamingResponse, - AsyncE2eeResourceWithStreamingResponse, -) -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.app_status_response import AppStatusResponse - -__all__ = ["AppResource", "AsyncAppResource"] - - -class AppResource(SyncAPIResource): - """Manage Beeper app login and encrypted messaging setup""" - - @cached_property - def login(self) -> LoginResource: - """Complete first-party Beeper app login""" - return LoginResource(self._client) - - @cached_property - def e2ee(self) -> E2eeResource: - """Manage encrypted messaging setup""" - return E2eeResource(self._client) - - @cached_property - def with_raw_response(self) -> AppResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AppResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AppResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AppResourceWithStreamingResponse(self) - - def status( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AppStatusResponse: - """ - Return the current Beeper Desktop sign-in and encrypted messaging setup state. - This endpoint is public before sign-in so apps can discover that login is - needed; after sign-in, pass a read token. - """ - return self._get( - "/v1/app/status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AppStatusResponse, - ) - - -class AsyncAppResource(AsyncAPIResource): - """Manage Beeper app login and encrypted messaging setup""" - - @cached_property - def login(self) -> AsyncLoginResource: - """Complete first-party Beeper app login""" - return AsyncLoginResource(self._client) - - @cached_property - def e2ee(self) -> AsyncE2eeResource: - """Manage encrypted messaging setup""" - return AsyncE2eeResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncAppResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncAppResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAppResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncAppResourceWithStreamingResponse(self) - - async def status( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AppStatusResponse: - """ - Return the current Beeper Desktop sign-in and encrypted messaging setup state. - This endpoint is public before sign-in so apps can discover that login is - needed; after sign-in, pass a read token. - """ - return await self._get( - "/v1/app/status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AppStatusResponse, - ) - - -class AppResourceWithRawResponse: - def __init__(self, app: AppResource) -> None: - self._app = app - - self.status = to_raw_response_wrapper( - app.status, - ) - - @cached_property - def login(self) -> LoginResourceWithRawResponse: - """Complete first-party Beeper app login""" - return LoginResourceWithRawResponse(self._app.login) - - @cached_property - def e2ee(self) -> E2eeResourceWithRawResponse: - """Manage encrypted messaging setup""" - return E2eeResourceWithRawResponse(self._app.e2ee) - - -class AsyncAppResourceWithRawResponse: - def __init__(self, app: AsyncAppResource) -> None: - self._app = app - - self.status = async_to_raw_response_wrapper( - app.status, - ) - - @cached_property - def login(self) -> AsyncLoginResourceWithRawResponse: - """Complete first-party Beeper app login""" - return AsyncLoginResourceWithRawResponse(self._app.login) - - @cached_property - def e2ee(self) -> AsyncE2eeResourceWithRawResponse: - """Manage encrypted messaging setup""" - return AsyncE2eeResourceWithRawResponse(self._app.e2ee) - - -class AppResourceWithStreamingResponse: - def __init__(self, app: AppResource) -> None: - self._app = app - - self.status = to_streamed_response_wrapper( - app.status, - ) - - @cached_property - def login(self) -> LoginResourceWithStreamingResponse: - """Complete first-party Beeper app login""" - return LoginResourceWithStreamingResponse(self._app.login) - - @cached_property - def e2ee(self) -> E2eeResourceWithStreamingResponse: - """Manage encrypted messaging setup""" - return E2eeResourceWithStreamingResponse(self._app.e2ee) - - -class AsyncAppResourceWithStreamingResponse: - def __init__(self, app: AsyncAppResource) -> None: - self._app = app - - self.status = async_to_streamed_response_wrapper( - app.status, - ) - - @cached_property - def login(self) -> AsyncLoginResourceWithStreamingResponse: - """Complete first-party Beeper app login""" - return AsyncLoginResourceWithStreamingResponse(self._app.login) - - @cached_property - def e2ee(self) -> AsyncE2eeResourceWithStreamingResponse: - """Manage encrypted messaging setup""" - return AsyncE2eeResourceWithStreamingResponse(self._app.e2ee) diff --git a/src/beeper_desktop_api/resources/app/e2ee/__init__.py b/src/beeper_desktop_api/resources/app/e2ee/__init__.py deleted file mode 100644 index f7fa574..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .e2ee import ( - E2eeResource, - AsyncE2eeResource, - E2eeResourceWithRawResponse, - AsyncE2eeResourceWithRawResponse, - E2eeResourceWithStreamingResponse, - AsyncE2eeResourceWithStreamingResponse, -) -from .verification import ( - VerificationResource, - AsyncVerificationResource, - VerificationResourceWithRawResponse, - AsyncVerificationResourceWithRawResponse, - VerificationResourceWithStreamingResponse, - AsyncVerificationResourceWithStreamingResponse, -) -from .recovery_code import ( - RecoveryCodeResource, - AsyncRecoveryCodeResource, - RecoveryCodeResourceWithRawResponse, - AsyncRecoveryCodeResourceWithRawResponse, - RecoveryCodeResourceWithStreamingResponse, - AsyncRecoveryCodeResourceWithStreamingResponse, -) - -__all__ = [ - "RecoveryCodeResource", - "AsyncRecoveryCodeResource", - "RecoveryCodeResourceWithRawResponse", - "AsyncRecoveryCodeResourceWithRawResponse", - "RecoveryCodeResourceWithStreamingResponse", - "AsyncRecoveryCodeResourceWithStreamingResponse", - "VerificationResource", - "AsyncVerificationResource", - "VerificationResourceWithRawResponse", - "AsyncVerificationResourceWithRawResponse", - "VerificationResourceWithStreamingResponse", - "AsyncVerificationResourceWithStreamingResponse", - "E2eeResource", - "AsyncE2eeResource", - "E2eeResourceWithRawResponse", - "AsyncE2eeResourceWithRawResponse", - "E2eeResourceWithStreamingResponse", - "AsyncE2eeResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/app/e2ee/e2ee.py b/src/beeper_desktop_api/resources/app/e2ee/e2ee.py deleted file mode 100644 index 285e853..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/e2ee.py +++ /dev/null @@ -1,150 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .verification.verification import ( - VerificationResource, - AsyncVerificationResource, - VerificationResourceWithRawResponse, - AsyncVerificationResourceWithRawResponse, - VerificationResourceWithStreamingResponse, - AsyncVerificationResourceWithStreamingResponse, -) -from .recovery_code.recovery_code import ( - RecoveryCodeResource, - AsyncRecoveryCodeResource, - RecoveryCodeResourceWithRawResponse, - AsyncRecoveryCodeResourceWithRawResponse, - RecoveryCodeResourceWithStreamingResponse, - AsyncRecoveryCodeResourceWithStreamingResponse, -) - -__all__ = ["E2eeResource", "AsyncE2eeResource"] - - -class E2eeResource(SyncAPIResource): - """Manage encrypted messaging setup""" - - @cached_property - def recovery_code(self) -> RecoveryCodeResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return RecoveryCodeResource(self._client) - - @cached_property - def verification(self) -> VerificationResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return VerificationResource(self._client) - - @cached_property - def with_raw_response(self) -> E2eeResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return E2eeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> E2eeResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return E2eeResourceWithStreamingResponse(self) - - -class AsyncE2eeResource(AsyncAPIResource): - """Manage encrypted messaging setup""" - - @cached_property - def recovery_code(self) -> AsyncRecoveryCodeResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncRecoveryCodeResource(self._client) - - @cached_property - def verification(self) -> AsyncVerificationResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncVerificationResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncE2eeResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncE2eeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncE2eeResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncE2eeResourceWithStreamingResponse(self) - - -class E2eeResourceWithRawResponse: - def __init__(self, e2ee: E2eeResource) -> None: - self._e2ee = e2ee - - @cached_property - def recovery_code(self) -> RecoveryCodeResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return RecoveryCodeResourceWithRawResponse(self._e2ee.recovery_code) - - @cached_property - def verification(self) -> VerificationResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return VerificationResourceWithRawResponse(self._e2ee.verification) - - -class AsyncE2eeResourceWithRawResponse: - def __init__(self, e2ee: AsyncE2eeResource) -> None: - self._e2ee = e2ee - - @cached_property - def recovery_code(self) -> AsyncRecoveryCodeResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncRecoveryCodeResourceWithRawResponse(self._e2ee.recovery_code) - - @cached_property - def verification(self) -> AsyncVerificationResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncVerificationResourceWithRawResponse(self._e2ee.verification) - - -class E2eeResourceWithStreamingResponse: - def __init__(self, e2ee: E2eeResource) -> None: - self._e2ee = e2ee - - @cached_property - def recovery_code(self) -> RecoveryCodeResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return RecoveryCodeResourceWithStreamingResponse(self._e2ee.recovery_code) - - @cached_property - def verification(self) -> VerificationResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return VerificationResourceWithStreamingResponse(self._e2ee.verification) - - -class AsyncE2eeResourceWithStreamingResponse: - def __init__(self, e2ee: AsyncE2eeResource) -> None: - self._e2ee = e2ee - - @cached_property - def recovery_code(self) -> AsyncRecoveryCodeResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncRecoveryCodeResourceWithStreamingResponse(self._e2ee.recovery_code) - - @cached_property - def verification(self) -> AsyncVerificationResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncVerificationResourceWithStreamingResponse(self._e2ee.verification) diff --git a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py deleted file mode 100644 index f60d377..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .reset import ( - ResetResource, - AsyncResetResource, - ResetResourceWithRawResponse, - AsyncResetResourceWithRawResponse, - ResetResourceWithStreamingResponse, - AsyncResetResourceWithStreamingResponse, -) -from .recovery_code import ( - RecoveryCodeResource, - AsyncRecoveryCodeResource, - RecoveryCodeResourceWithRawResponse, - AsyncRecoveryCodeResourceWithRawResponse, - RecoveryCodeResourceWithStreamingResponse, - AsyncRecoveryCodeResourceWithStreamingResponse, -) - -__all__ = [ - "ResetResource", - "AsyncResetResource", - "ResetResourceWithRawResponse", - "AsyncResetResourceWithRawResponse", - "ResetResourceWithStreamingResponse", - "AsyncResetResourceWithStreamingResponse", - "RecoveryCodeResource", - "AsyncRecoveryCodeResource", - "RecoveryCodeResourceWithRawResponse", - "AsyncRecoveryCodeResourceWithRawResponse", - "RecoveryCodeResourceWithStreamingResponse", - "AsyncRecoveryCodeResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py deleted file mode 100644 index 47a7804..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/recovery_code.py +++ /dev/null @@ -1,264 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .reset import ( - ResetResource, - AsyncResetResource, - ResetResourceWithRawResponse, - AsyncResetResourceWithRawResponse, - ResetResourceWithStreamingResponse, - AsyncResetResourceWithStreamingResponse, -) -from ....._types import Body, Query, Headers, NotGiven, 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.app.e2ee import recovery_code_verify_params -from .....types.app.e2ee.recovery_code_verify_response import RecoveryCodeVerifyResponse -from .....types.app.e2ee.recovery_code_mark_backed_up_response import RecoveryCodeMarkBackedUpResponse - -__all__ = ["RecoveryCodeResource", "AsyncRecoveryCodeResource"] - - -class RecoveryCodeResource(SyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def reset(self) -> ResetResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return ResetResource(self._client) - - @cached_property - def with_raw_response(self) -> RecoveryCodeResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return RecoveryCodeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RecoveryCodeResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return RecoveryCodeResourceWithStreamingResponse(self) - - def mark_backed_up( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RecoveryCodeMarkBackedUpResponse: - """Record that the user saved their recovery key.""" - return self._post( - "/v1/app/e2ee/recovery-code/mark-backed-up", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RecoveryCodeMarkBackedUpResponse, - ) - - def verify( - self, - *, - recovery_code: 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, - ) -> RecoveryCodeVerifyResponse: - """ - Unlock encrypted messages with the user recovery key. - - Args: - recovery_code: Recovery key saved by the user. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/recovery-code/verify", - body=maybe_transform( - {"recovery_code": recovery_code}, recovery_code_verify_params.RecoveryCodeVerifyParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RecoveryCodeVerifyResponse, - ) - - -class AsyncRecoveryCodeResource(AsyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def reset(self) -> AsyncResetResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncResetResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncRecoveryCodeResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncRecoveryCodeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRecoveryCodeResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncRecoveryCodeResourceWithStreamingResponse(self) - - async def mark_backed_up( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RecoveryCodeMarkBackedUpResponse: - """Record that the user saved their recovery key.""" - return await self._post( - "/v1/app/e2ee/recovery-code/mark-backed-up", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RecoveryCodeMarkBackedUpResponse, - ) - - async def verify( - self, - *, - recovery_code: 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, - ) -> RecoveryCodeVerifyResponse: - """ - Unlock encrypted messages with the user recovery key. - - Args: - recovery_code: Recovery key saved by the user. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/recovery-code/verify", - body=await async_maybe_transform( - {"recovery_code": recovery_code}, recovery_code_verify_params.RecoveryCodeVerifyParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RecoveryCodeVerifyResponse, - ) - - -class RecoveryCodeResourceWithRawResponse: - def __init__(self, recovery_code: RecoveryCodeResource) -> None: - self._recovery_code = recovery_code - - self.mark_backed_up = to_raw_response_wrapper( - recovery_code.mark_backed_up, - ) - self.verify = to_raw_response_wrapper( - recovery_code.verify, - ) - - @cached_property - def reset(self) -> ResetResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return ResetResourceWithRawResponse(self._recovery_code.reset) - - -class AsyncRecoveryCodeResourceWithRawResponse: - def __init__(self, recovery_code: AsyncRecoveryCodeResource) -> None: - self._recovery_code = recovery_code - - self.mark_backed_up = async_to_raw_response_wrapper( - recovery_code.mark_backed_up, - ) - self.verify = async_to_raw_response_wrapper( - recovery_code.verify, - ) - - @cached_property - def reset(self) -> AsyncResetResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncResetResourceWithRawResponse(self._recovery_code.reset) - - -class RecoveryCodeResourceWithStreamingResponse: - def __init__(self, recovery_code: RecoveryCodeResource) -> None: - self._recovery_code = recovery_code - - self.mark_backed_up = to_streamed_response_wrapper( - recovery_code.mark_backed_up, - ) - self.verify = to_streamed_response_wrapper( - recovery_code.verify, - ) - - @cached_property - def reset(self) -> ResetResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return ResetResourceWithStreamingResponse(self._recovery_code.reset) - - -class AsyncRecoveryCodeResourceWithStreamingResponse: - def __init__(self, recovery_code: AsyncRecoveryCodeResource) -> None: - self._recovery_code = recovery_code - - self.mark_backed_up = async_to_streamed_response_wrapper( - recovery_code.mark_backed_up, - ) - self.verify = async_to_streamed_response_wrapper( - recovery_code.verify, - ) - - @cached_property - def reset(self) -> AsyncResetResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncResetResourceWithStreamingResponse(self._recovery_code.reset) diff --git a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py b/src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py deleted file mode 100644 index 63a7fa0..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/recovery_code/reset.py +++ /dev/null @@ -1,252 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ....._utils import 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.app.e2ee.recovery_code import reset_create_params, reset_confirm_params -from .....types.app.e2ee.recovery_code.reset_create_response import ResetCreateResponse -from .....types.app.e2ee.recovery_code.reset_confirm_response import ResetConfirmResponse - -__all__ = ["ResetResource", "AsyncResetResource"] - - -class ResetResource(SyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def with_raw_response(self) -> ResetResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return ResetResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ResetResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return ResetResourceWithStreamingResponse(self) - - def create( - self, - *, - recovery_code: 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, - ) -> ResetCreateResponse: - """ - Create a new recovery key when the user cannot use the existing one. - - Args: - recovery_code: Existing recovery key, if the user has it. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/recovery-code/reset", - body=maybe_transform({"recovery_code": recovery_code}, reset_create_params.ResetCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ResetCreateResponse, - ) - - def confirm( - self, - *, - recovery_code: 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, - ) -> ResetConfirmResponse: - """ - Confirm that the new recovery key should be used for this account. - - Args: - recovery_code: New recovery key returned by the reset step. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/recovery-code/reset/confirm", - body=maybe_transform({"recovery_code": recovery_code}, reset_confirm_params.ResetConfirmParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ResetConfirmResponse, - ) - - -class AsyncResetResource(AsyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def with_raw_response(self) -> AsyncResetResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncResetResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncResetResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncResetResourceWithStreamingResponse(self) - - async def create( - self, - *, - recovery_code: 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, - ) -> ResetCreateResponse: - """ - Create a new recovery key when the user cannot use the existing one. - - Args: - recovery_code: Existing recovery key, if the user has it. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/recovery-code/reset", - body=await async_maybe_transform({"recovery_code": recovery_code}, reset_create_params.ResetCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ResetCreateResponse, - ) - - async def confirm( - self, - *, - recovery_code: 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, - ) -> ResetConfirmResponse: - """ - Confirm that the new recovery key should be used for this account. - - Args: - recovery_code: New recovery key returned by the reset step. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/recovery-code/reset/confirm", - body=await async_maybe_transform({"recovery_code": recovery_code}, reset_confirm_params.ResetConfirmParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ResetConfirmResponse, - ) - - -class ResetResourceWithRawResponse: - def __init__(self, reset: ResetResource) -> None: - self._reset = reset - - self.create = to_raw_response_wrapper( - reset.create, - ) - self.confirm = to_raw_response_wrapper( - reset.confirm, - ) - - -class AsyncResetResourceWithRawResponse: - def __init__(self, reset: AsyncResetResource) -> None: - self._reset = reset - - self.create = async_to_raw_response_wrapper( - reset.create, - ) - self.confirm = async_to_raw_response_wrapper( - reset.confirm, - ) - - -class ResetResourceWithStreamingResponse: - def __init__(self, reset: ResetResource) -> None: - self._reset = reset - - self.create = to_streamed_response_wrapper( - reset.create, - ) - self.confirm = to_streamed_response_wrapper( - reset.confirm, - ) - - -class AsyncResetResourceWithStreamingResponse: - def __init__(self, reset: AsyncResetResource) -> None: - self._reset = reset - - self.create = async_to_streamed_response_wrapper( - reset.create, - ) - self.confirm = async_to_streamed_response_wrapper( - reset.confirm, - ) diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py b/src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py deleted file mode 100644 index 920dcd8..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/verification/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .qr import ( - QrResource, - AsyncQrResource, - QrResourceWithRawResponse, - AsyncQrResourceWithRawResponse, - QrResourceWithStreamingResponse, - AsyncQrResourceWithStreamingResponse, -) -from .sas import ( - SasResource, - AsyncSasResource, - SasResourceWithRawResponse, - AsyncSasResourceWithRawResponse, - SasResourceWithStreamingResponse, - AsyncSasResourceWithStreamingResponse, -) -from .verification import ( - VerificationResource, - AsyncVerificationResource, - VerificationResourceWithRawResponse, - AsyncVerificationResourceWithRawResponse, - VerificationResourceWithStreamingResponse, - AsyncVerificationResourceWithStreamingResponse, -) - -__all__ = [ - "QrResource", - "AsyncQrResource", - "QrResourceWithRawResponse", - "AsyncQrResourceWithRawResponse", - "QrResourceWithStreamingResponse", - "AsyncQrResourceWithStreamingResponse", - "SasResource", - "AsyncSasResource", - "SasResourceWithRawResponse", - "AsyncSasResourceWithRawResponse", - "SasResourceWithStreamingResponse", - "AsyncSasResourceWithStreamingResponse", - "VerificationResource", - "AsyncVerificationResource", - "VerificationResourceWithRawResponse", - "AsyncVerificationResourceWithRawResponse", - "VerificationResourceWithStreamingResponse", - "AsyncVerificationResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/qr.py b/src/beeper_desktop_api/resources/app/e2ee/verification/qr.py deleted file mode 100644 index a501c23..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/verification/qr.py +++ /dev/null @@ -1,258 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ....._types import Body, Query, Headers, NotGiven, not_given -from ....._utils import path_template, 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.app.e2ee.verification import qr_scan_params -from .....types.app.e2ee.verification.qr_scan_response import QrScanResponse -from .....types.app.e2ee.verification.qr_confirm_scanned_response import QrConfirmScannedResponse - -__all__ = ["QrResource", "AsyncQrResource"] - - -class QrResource(SyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def with_raw_response(self) -> QrResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return QrResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> QrResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return QrResourceWithStreamingResponse(self) - - def confirm_scanned( - self, - verification_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, - ) -> QrConfirmScannedResponse: - """ - Confirm that another device scanned this device QR code. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return self._post( - path_template( - "/v1/app/e2ee/verification/{verification_id}/qr/confirm-scanned", verification_id=verification_id - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=QrConfirmScannedResponse, - ) - - def scan( - self, - *, - data: 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, - ) -> QrScanResponse: - """ - Submit the QR code scanned from another signed-in device. - - Args: - data: QR code payload scanned from the other device. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/verification/qr/scan", - body=maybe_transform({"data": data}, qr_scan_params.QrScanParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=QrScanResponse, - ) - - -class AsyncQrResource(AsyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def with_raw_response(self) -> AsyncQrResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncQrResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncQrResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncQrResourceWithStreamingResponse(self) - - async def confirm_scanned( - self, - verification_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, - ) -> QrConfirmScannedResponse: - """ - Confirm that another device scanned this device QR code. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return await self._post( - path_template( - "/v1/app/e2ee/verification/{verification_id}/qr/confirm-scanned", verification_id=verification_id - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=QrConfirmScannedResponse, - ) - - async def scan( - self, - *, - data: 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, - ) -> QrScanResponse: - """ - Submit the QR code scanned from another signed-in device. - - Args: - data: QR code payload scanned from the other device. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/verification/qr/scan", - body=await async_maybe_transform({"data": data}, qr_scan_params.QrScanParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=QrScanResponse, - ) - - -class QrResourceWithRawResponse: - def __init__(self, qr: QrResource) -> None: - self._qr = qr - - self.confirm_scanned = to_raw_response_wrapper( - qr.confirm_scanned, - ) - self.scan = to_raw_response_wrapper( - qr.scan, - ) - - -class AsyncQrResourceWithRawResponse: - def __init__(self, qr: AsyncQrResource) -> None: - self._qr = qr - - self.confirm_scanned = async_to_raw_response_wrapper( - qr.confirm_scanned, - ) - self.scan = async_to_raw_response_wrapper( - qr.scan, - ) - - -class QrResourceWithStreamingResponse: - def __init__(self, qr: QrResource) -> None: - self._qr = qr - - self.confirm_scanned = to_streamed_response_wrapper( - qr.confirm_scanned, - ) - self.scan = to_streamed_response_wrapper( - qr.scan, - ) - - -class AsyncQrResourceWithStreamingResponse: - def __init__(self, qr: AsyncQrResource) -> None: - self._qr = qr - - self.confirm_scanned = async_to_streamed_response_wrapper( - qr.confirm_scanned, - ) - self.scan = async_to_streamed_response_wrapper( - qr.scan, - ) diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/sas.py b/src/beeper_desktop_api/resources/app/e2ee/verification/sas.py deleted file mode 100644 index f72cd16..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/verification/sas.py +++ /dev/null @@ -1,255 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ....._types import Body, Query, Headers, NotGiven, not_given -from ....._utils import path_template -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._base_client import make_request_options -from .....types.app.e2ee.verification.sa_start_response import SaStartResponse -from .....types.app.e2ee.verification.sa_confirm_response import SaConfirmResponse - -__all__ = ["SasResource", "AsyncSasResource"] - - -class SasResource(SyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def with_raw_response(self) -> SasResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return SasResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SasResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return SasResourceWithStreamingResponse(self) - - def confirm( - self, - verification_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, - ) -> SaConfirmResponse: - """ - Confirm that the emoji or number sequence matches on both devices. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/sas/confirm", verification_id=verification_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SaConfirmResponse, - ) - - def start( - self, - verification_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, - ) -> SaStartResponse: - """ - Start emoji comparison for device verification. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/sas/start", verification_id=verification_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SaStartResponse, - ) - - -class AsyncSasResource(AsyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def with_raw_response(self) -> AsyncSasResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncSasResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSasResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncSasResourceWithStreamingResponse(self) - - async def confirm( - self, - verification_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, - ) -> SaConfirmResponse: - """ - Confirm that the emoji or number sequence matches on both devices. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return await self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/sas/confirm", verification_id=verification_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SaConfirmResponse, - ) - - async def start( - self, - verification_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, - ) -> SaStartResponse: - """ - Start emoji comparison for device verification. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return await self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/sas/start", verification_id=verification_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SaStartResponse, - ) - - -class SasResourceWithRawResponse: - def __init__(self, sas: SasResource) -> None: - self._sas = sas - - self.confirm = to_raw_response_wrapper( - sas.confirm, - ) - self.start = to_raw_response_wrapper( - sas.start, - ) - - -class AsyncSasResourceWithRawResponse: - def __init__(self, sas: AsyncSasResource) -> None: - self._sas = sas - - self.confirm = async_to_raw_response_wrapper( - sas.confirm, - ) - self.start = async_to_raw_response_wrapper( - sas.start, - ) - - -class SasResourceWithStreamingResponse: - def __init__(self, sas: SasResource) -> None: - self._sas = sas - - self.confirm = to_streamed_response_wrapper( - sas.confirm, - ) - self.start = to_streamed_response_wrapper( - sas.start, - ) - - -class AsyncSasResourceWithStreamingResponse: - def __init__(self, sas: AsyncSasResource) -> None: - self._sas = sas - - self.confirm = async_to_streamed_response_wrapper( - sas.confirm, - ) - self.start = async_to_streamed_response_wrapper( - sas.start, - ) diff --git a/src/beeper_desktop_api/resources/app/e2ee/verification/verification.py b/src/beeper_desktop_api/resources/app/e2ee/verification/verification.py deleted file mode 100644 index 589e07f..0000000 --- a/src/beeper_desktop_api/resources/app/e2ee/verification/verification.py +++ /dev/null @@ -1,439 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .qr import ( - QrResource, - AsyncQrResource, - QrResourceWithRawResponse, - AsyncQrResourceWithRawResponse, - QrResourceWithStreamingResponse, - AsyncQrResourceWithStreamingResponse, -) -from .sas import ( - SasResource, - AsyncSasResource, - SasResourceWithRawResponse, - AsyncSasResourceWithRawResponse, - SasResourceWithStreamingResponse, - AsyncSasResourceWithStreamingResponse, -) -from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ....._utils import path_template, maybe_transform, async_maybe_transform -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._base_client import make_request_options -from .....types.app.e2ee import verification_cancel_params, verification_create_params -from .....types.app.e2ee.verification_accept_response import VerificationAcceptResponse -from .....types.app.e2ee.verification_cancel_response import VerificationCancelResponse -from .....types.app.e2ee.verification_create_response import VerificationCreateResponse - -__all__ = ["VerificationResource", "AsyncVerificationResource"] - - -class VerificationResource(SyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def qr(self) -> QrResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return QrResource(self._client) - - @cached_property - def sas(self) -> SasResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return SasResource(self._client) - - @cached_property - def with_raw_response(self) -> VerificationResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return VerificationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> VerificationResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return VerificationResourceWithStreamingResponse(self) - - def create( - self, - *, - user_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VerificationCreateResponse: - """ - Start verifying this device from another signed-in device. - - Args: - user_id: User ID to verify. Defaults to the signed-in user. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/verification", - body=maybe_transform({"user_id": user_id}, verification_create_params.VerificationCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VerificationCreateResponse, - ) - - def accept( - self, - verification_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, - ) -> VerificationAcceptResponse: - """ - Accept an incoming device verification request. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/accept", verification_id=verification_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VerificationAcceptResponse, - ) - - def cancel( - self, - verification_id: str, - *, - code: str | Omit = omit, - reason: 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, - ) -> VerificationCancelResponse: - """ - Cancel an active device verification request. - - Args: - verification_id: Verification ID. - - code: Optional cancellation code. - - reason: Optional user-facing cancellation reason. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/cancel", verification_id=verification_id), - body=maybe_transform( - { - "code": code, - "reason": reason, - }, - verification_cancel_params.VerificationCancelParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VerificationCancelResponse, - ) - - -class AsyncVerificationResource(AsyncAPIResource): - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - - @cached_property - def qr(self) -> AsyncQrResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncQrResource(self._client) - - @cached_property - def sas(self) -> AsyncSasResource: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncSasResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncVerificationResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncVerificationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncVerificationResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncVerificationResourceWithStreamingResponse(self) - - async def create( - self, - *, - user_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VerificationCreateResponse: - """ - Start verifying this device from another signed-in device. - - Args: - user_id: User ID to verify. Defaults to the signed-in user. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/e2ee/verification", - body=await async_maybe_transform({"user_id": user_id}, verification_create_params.VerificationCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VerificationCreateResponse, - ) - - async def accept( - self, - verification_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, - ) -> VerificationAcceptResponse: - """ - Accept an incoming device verification request. - - Args: - verification_id: Verification ID. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return await self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/accept", verification_id=verification_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VerificationAcceptResponse, - ) - - async def cancel( - self, - verification_id: str, - *, - code: str | Omit = omit, - reason: 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, - ) -> VerificationCancelResponse: - """ - Cancel an active device verification request. - - Args: - verification_id: Verification ID. - - code: Optional cancellation code. - - reason: Optional user-facing cancellation reason. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not verification_id: - raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") - return await self._post( - path_template("/v1/app/e2ee/verification/{verification_id}/cancel", verification_id=verification_id), - body=await async_maybe_transform( - { - "code": code, - "reason": reason, - }, - verification_cancel_params.VerificationCancelParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VerificationCancelResponse, - ) - - -class VerificationResourceWithRawResponse: - def __init__(self, verification: VerificationResource) -> None: - self._verification = verification - - self.create = to_raw_response_wrapper( - verification.create, - ) - self.accept = to_raw_response_wrapper( - verification.accept, - ) - self.cancel = to_raw_response_wrapper( - verification.cancel, - ) - - @cached_property - def qr(self) -> QrResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return QrResourceWithRawResponse(self._verification.qr) - - @cached_property - def sas(self) -> SasResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return SasResourceWithRawResponse(self._verification.sas) - - -class AsyncVerificationResourceWithRawResponse: - def __init__(self, verification: AsyncVerificationResource) -> None: - self._verification = verification - - self.create = async_to_raw_response_wrapper( - verification.create, - ) - self.accept = async_to_raw_response_wrapper( - verification.accept, - ) - self.cancel = async_to_raw_response_wrapper( - verification.cancel, - ) - - @cached_property - def qr(self) -> AsyncQrResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncQrResourceWithRawResponse(self._verification.qr) - - @cached_property - def sas(self) -> AsyncSasResourceWithRawResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncSasResourceWithRawResponse(self._verification.sas) - - -class VerificationResourceWithStreamingResponse: - def __init__(self, verification: VerificationResource) -> None: - self._verification = verification - - self.create = to_streamed_response_wrapper( - verification.create, - ) - self.accept = to_streamed_response_wrapper( - verification.accept, - ) - self.cancel = to_streamed_response_wrapper( - verification.cancel, - ) - - @cached_property - def qr(self) -> QrResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return QrResourceWithStreamingResponse(self._verification.qr) - - @cached_property - def sas(self) -> SasResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return SasResourceWithStreamingResponse(self._verification.sas) - - -class AsyncVerificationResourceWithStreamingResponse: - def __init__(self, verification: AsyncVerificationResource) -> None: - self._verification = verification - - self.create = async_to_streamed_response_wrapper( - verification.create, - ) - self.accept = async_to_streamed_response_wrapper( - verification.accept, - ) - self.cancel = async_to_streamed_response_wrapper( - verification.cancel, - ) - - @cached_property - def qr(self) -> AsyncQrResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncQrResourceWithStreamingResponse(self._verification.qr) - - @cached_property - def sas(self) -> AsyncSasResourceWithStreamingResponse: - """First-party sign-in and encrypted messaging setup for Beeper Desktop.""" - return AsyncSasResourceWithStreamingResponse(self._verification.sas) diff --git a/src/beeper_desktop_api/resources/app/login.py b/src/beeper_desktop_api/resources/app/login.py deleted file mode 100644 index e67ff28..0000000 --- a/src/beeper_desktop_api/resources/app/login.py +++ /dev/null @@ -1,508 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, cast -from typing_extensions import Literal - -import httpx - -from ..._types import Body, Query, Headers, NotGiven, 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 ...types.app import login_email_params, login_register_params, login_response_params -from ..._base_client import make_request_options -from ...types.app.login_start_response import LoginStartResponse -from ...types.app.login_register_response import LoginRegisterResponse -from ...types.app.login_response_response import LoginResponseResponse - -__all__ = ["LoginResource", "AsyncLoginResource"] - - -class LoginResource(SyncAPIResource): - """Complete first-party Beeper app login""" - - @cached_property - def with_raw_response(self) -> LoginResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return LoginResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LoginResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return LoginResourceWithStreamingResponse(self) - - def email( - self, - *, - email: str, - request: 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, - ) -> object: - """ - Send a sign-in code to the user email address. - - Args: - email: Email address to send the sign-in code to. - - request: Login request ID returned by the start step. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/login/email", - body=maybe_transform( - { - "email": email, - "request": request, - }, - login_email_params.LoginEmailParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=object, - ) - - def register( - self, - *, - accept_terms: Literal[True], - lead_token: str, - request: str, - username: 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, - ) -> LoginRegisterResponse: - """ - Create a Beeper account after the user chooses a username and accepts the Terms - of Use. - - Args: - accept_terms: Confirms that the user accepted the Terms of Use and acknowledged the Privacy - Policy. - - lead_token: Registration token returned by Beeper. - - request: Login request ID returned by the start step. - - username: Username selected by the user. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/login/register", - body=maybe_transform( - { - "accept_terms": accept_terms, - "lead_token": lead_token, - "request": request, - "username": username, - }, - login_register_params.LoginRegisterParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=LoginRegisterResponse, - ) - - def response( - self, - *, - request: str, - response: 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, - ) -> LoginResponseResponse: - """Finish sign-in with the code sent to the user email address. - - If the user needs a - new account, the response includes account creation copy and username - suggestions. - - Args: - request: Login request ID returned by the start step. - - response: Sign-in code from the user email. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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 cast( - LoginResponseResponse, - self._post( - "/v1/app/login/response", - body=maybe_transform( - { - "request": request, - "response": response, - }, - login_response_params.LoginResponseParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=cast( - Any, LoginResponseResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def start( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoginStartResponse: - """Start a first-party Beeper Desktop sign-in session.""" - return self._post( - "/v1/app/login/start", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=LoginStartResponse, - ) - - -class AsyncLoginResource(AsyncAPIResource): - """Complete first-party Beeper app login""" - - @cached_property - def with_raw_response(self) -> AsyncLoginResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncLoginResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLoginResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncLoginResourceWithStreamingResponse(self) - - async def email( - self, - *, - email: str, - request: 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, - ) -> object: - """ - Send a sign-in code to the user email address. - - Args: - email: Email address to send the sign-in code to. - - request: Login request ID returned by the start step. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/login/email", - body=await async_maybe_transform( - { - "email": email, - "request": request, - }, - login_email_params.LoginEmailParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=object, - ) - - async def register( - self, - *, - accept_terms: Literal[True], - lead_token: str, - request: str, - username: 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, - ) -> LoginRegisterResponse: - """ - Create a Beeper account after the user chooses a username and accepts the Terms - of Use. - - Args: - accept_terms: Confirms that the user accepted the Terms of Use and acknowledged the Privacy - Policy. - - lead_token: Registration token returned by Beeper. - - request: Login request ID returned by the start step. - - username: Username selected by the user. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/v1/app/login/register", - body=await async_maybe_transform( - { - "accept_terms": accept_terms, - "lead_token": lead_token, - "request": request, - "username": username, - }, - login_register_params.LoginRegisterParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=LoginRegisterResponse, - ) - - async def response( - self, - *, - request: str, - response: 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, - ) -> LoginResponseResponse: - """Finish sign-in with the code sent to the user email address. - - If the user needs a - new account, the response includes account creation copy and username - suggestions. - - Args: - request: Login request ID returned by the start step. - - response: Sign-in code from the user email. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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 cast( - LoginResponseResponse, - await self._post( - "/v1/app/login/response", - body=await async_maybe_transform( - { - "request": request, - "response": response, - }, - login_response_params.LoginResponseParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=cast( - Any, LoginResponseResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def start( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoginStartResponse: - """Start a first-party Beeper Desktop sign-in session.""" - return await self._post( - "/v1/app/login/start", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - security={}, - ), - cast_to=LoginStartResponse, - ) - - -class LoginResourceWithRawResponse: - def __init__(self, login: LoginResource) -> None: - self._login = login - - self.email = to_raw_response_wrapper( - login.email, - ) - self.register = to_raw_response_wrapper( - login.register, - ) - self.response = to_raw_response_wrapper( - login.response, - ) - self.start = to_raw_response_wrapper( - login.start, - ) - - -class AsyncLoginResourceWithRawResponse: - def __init__(self, login: AsyncLoginResource) -> None: - self._login = login - - self.email = async_to_raw_response_wrapper( - login.email, - ) - self.register = async_to_raw_response_wrapper( - login.register, - ) - self.response = async_to_raw_response_wrapper( - login.response, - ) - self.start = async_to_raw_response_wrapper( - login.start, - ) - - -class LoginResourceWithStreamingResponse: - def __init__(self, login: LoginResource) -> None: - self._login = login - - self.email = to_streamed_response_wrapper( - login.email, - ) - self.register = to_streamed_response_wrapper( - login.register, - ) - self.response = to_streamed_response_wrapper( - login.response, - ) - self.start = to_streamed_response_wrapper( - login.start, - ) - - -class AsyncLoginResourceWithStreamingResponse: - def __init__(self, login: AsyncLoginResource) -> None: - self._login = login - - self.email = async_to_streamed_response_wrapper( - login.email, - ) - self.register = async_to_streamed_response_wrapper( - login.register, - ) - self.response = async_to_streamed_response_wrapper( - login.response, - ) - self.start = async_to_streamed_response_wrapper( - login.start, - ) diff --git a/src/beeper_desktop_api/resources/assets.py b/src/beeper_desktop_api/resources/assets.py index ccfeab4..a67081f 100644 --- a/src/beeper_desktop_api/resources/assets.py +++ b/src/beeper_desktop_api/resources/assets.py @@ -68,11 +68,11 @@ def download( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AssetDownloadResponse: """ - Download a Matrix file using its mxc:// or localmxc:// URL to the device running - Beeper Desktop and return the local file URL. + Download a file from an mxc:// or localmxc:// URL to the device running the + Beeper Client API and return the local file URL. Args: - url: Matrix content URL (mxc:// or localmxc://) for the file to download. + url: Beeper media URL (mxc:// or localmxc://) for the file to download. extra_headers: Send extra headers @@ -147,7 +147,7 @@ def upload( """Upload a file to a temporary location using multipart/form-data. Returns an - uploadID that can be referenced when sending a message or materializing a draft + uploadID that can be referenced when sending a message or creating a draft attachment. Args: @@ -204,8 +204,8 @@ def upload_base64( """Upload a file using a JSON body with base64-encoded content. Returns an uploadID - that can be referenced when sending a message or materializing a draft - attachment. Alternative to the multipart upload endpoint. + that can be referenced when sending a message or creating a draft attachment. + Alternative to the multipart upload endpoint. Args: content: Base64-encoded file content (max ~500MB decoded) @@ -273,11 +273,11 @@ async def download( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AssetDownloadResponse: """ - Download a Matrix file using its mxc:// or localmxc:// URL to the device running - Beeper Desktop and return the local file URL. + Download a file from an mxc:// or localmxc:// URL to the device running the + Beeper Client API and return the local file URL. Args: - url: Matrix content URL (mxc:// or localmxc://) for the file to download. + url: Beeper media URL (mxc:// or localmxc://) for the file to download. extra_headers: Send extra headers @@ -352,7 +352,7 @@ async def upload( """Upload a file to a temporary location using multipart/form-data. Returns an - uploadID that can be referenced when sending a message or materializing a draft + uploadID that can be referenced when sending a message or creating a draft attachment. Args: @@ -409,8 +409,8 @@ async def upload_base64( """Upload a file using a JSON body with base64-encoded content. Returns an uploadID - that can be referenced when sending a message or materializing a draft - attachment. Alternative to the multipart upload endpoint. + that can be referenced when sending a message or creating a draft attachment. + Alternative to the multipart upload endpoint. Args: content: Base64-encoded file content (max ~500MB decoded) diff --git a/src/beeper_desktop_api/resources/bridges.py b/src/beeper_desktop_api/resources/bridges.py deleted file mode 100644 index 1d9e25a..0000000 --- a/src/beeper_desktop_api/resources/bridges.py +++ /dev/null @@ -1,145 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .._types import Body, Query, Headers, NotGiven, not_given -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options -from ..types.bridge_list_response import BridgeListResponse - -__all__ = ["BridgesResource", "AsyncBridgesResource"] - - -class BridgesResource(SyncAPIResource): - """Manage bridge-backed account types and account availability""" - - @cached_property - def with_raw_response(self) -> BridgesResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return BridgesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BridgesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return BridgesResourceWithStreamingResponse(self) - - def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> BridgeListResponse: - """ - List bridge-backed account types that can be shown in add-account flows, grouped - with connected accounts that use the same Account schema as GET /v1/accounts. - """ - return self._get( - "/v1/bridges", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BridgeListResponse, - ) - - -class AsyncBridgesResource(AsyncAPIResource): - """Manage bridge-backed account types and account availability""" - - @cached_property - def with_raw_response(self) -> AsyncBridgesResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncBridgesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBridgesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncBridgesResourceWithStreamingResponse(self) - - async def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> BridgeListResponse: - """ - List bridge-backed account types that can be shown in add-account flows, grouped - with connected accounts that use the same Account schema as GET /v1/accounts. - """ - return await self._get( - "/v1/bridges", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BridgeListResponse, - ) - - -class BridgesResourceWithRawResponse: - def __init__(self, bridges: BridgesResource) -> None: - self._bridges = bridges - - self.list = to_raw_response_wrapper( - bridges.list, - ) - - -class AsyncBridgesResourceWithRawResponse: - def __init__(self, bridges: AsyncBridgesResource) -> None: - self._bridges = bridges - - self.list = async_to_raw_response_wrapper( - bridges.list, - ) - - -class BridgesResourceWithStreamingResponse: - def __init__(self, bridges: BridgesResource) -> None: - self._bridges = bridges - - self.list = to_streamed_response_wrapper( - bridges.list, - ) - - -class AsyncBridgesResourceWithStreamingResponse: - def __init__(self, bridges: AsyncBridgesResource) -> None: - self._bridges = bridges - - self.list = async_to_streamed_response_wrapper( - bridges.list, - ) diff --git a/src/beeper_desktop_api/resources/bridges/__init__.py b/src/beeper_desktop_api/resources/bridges/__init__.py new file mode 100644 index 0000000..e0e3ac7 --- /dev/null +++ b/src/beeper_desktop_api/resources/bridges/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .bridges import ( + BridgesResource, + AsyncBridgesResource, + BridgesResourceWithRawResponse, + AsyncBridgesResourceWithRawResponse, + BridgesResourceWithStreamingResponse, + AsyncBridgesResourceWithStreamingResponse, +) +from .login_flows import ( + LoginFlowsResource, + AsyncLoginFlowsResource, + LoginFlowsResourceWithRawResponse, + AsyncLoginFlowsResourceWithRawResponse, + LoginFlowsResourceWithStreamingResponse, + AsyncLoginFlowsResourceWithStreamingResponse, +) +from .login_sessions import ( + LoginSessionsResource, + AsyncLoginSessionsResource, + LoginSessionsResourceWithRawResponse, + AsyncLoginSessionsResourceWithRawResponse, + LoginSessionsResourceWithStreamingResponse, + AsyncLoginSessionsResourceWithStreamingResponse, +) + +__all__ = [ + "LoginFlowsResource", + "AsyncLoginFlowsResource", + "LoginFlowsResourceWithRawResponse", + "AsyncLoginFlowsResourceWithRawResponse", + "LoginFlowsResourceWithStreamingResponse", + "AsyncLoginFlowsResourceWithStreamingResponse", + "LoginSessionsResource", + "AsyncLoginSessionsResource", + "LoginSessionsResourceWithRawResponse", + "AsyncLoginSessionsResourceWithRawResponse", + "LoginSessionsResourceWithStreamingResponse", + "AsyncLoginSessionsResourceWithStreamingResponse", + "BridgesResource", + "AsyncBridgesResource", + "BridgesResourceWithRawResponse", + "AsyncBridgesResourceWithRawResponse", + "BridgesResourceWithStreamingResponse", + "AsyncBridgesResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/bridges/bridges.py b/src/beeper_desktop_api/resources/bridges/bridges.py new file mode 100644 index 0000000..c34145c --- /dev/null +++ b/src/beeper_desktop_api/resources/bridges/bridges.py @@ -0,0 +1,420 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .login_flows import ( + LoginFlowsResource, + AsyncLoginFlowsResource, + LoginFlowsResourceWithRawResponse, + AsyncLoginFlowsResourceWithRawResponse, + LoginFlowsResourceWithStreamingResponse, + AsyncLoginFlowsResourceWithStreamingResponse, +) +from ..._base_client import make_request_options +from ...types.bridge_list_response import BridgeListResponse +from .login_sessions.login_sessions import ( + LoginSessionsResource, + AsyncLoginSessionsResource, + LoginSessionsResourceWithRawResponse, + AsyncLoginSessionsResourceWithRawResponse, + LoginSessionsResourceWithStreamingResponse, + AsyncLoginSessionsResourceWithStreamingResponse, +) +from ...types.bridge_retrieve_response import BridgeRetrieveResponse +from ...types.provisioning_capabilities import ProvisioningCapabilities + +__all__ = ["BridgesResource", "AsyncBridgesResource"] + + +class BridgesResource(SyncAPIResource): + """Manage bridge-backed account types, connections, and login sessions""" + + @cached_property + def login_flows(self) -> LoginFlowsResource: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return LoginFlowsResource(self._client) + + @cached_property + def login_sessions(self) -> LoginSessionsResource: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return LoginSessionsResource(self._client) + + @cached_property + def with_raw_response(self) -> BridgesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return BridgesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BridgesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return BridgesResourceWithStreamingResponse(self) + + def retrieve( + self, + bridge_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, + ) -> BridgeRetrieveResponse: + """ + Get one bridge, including the chat accounts connected through it. + + Args: + bridge_id: Bridge ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._get( + path_template("/v1/bridges/{bridge_id}", bridge_id=bridge_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BridgeRetrieveResponse, + ) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BridgeListResponse: + """List available bridges. + + A bridge is a chat-network connector that can connect or + reconnect chat accounts. Connected accounts use the same Account schema as GET + /v1/accounts. + """ + return self._get( + "/v1/bridges", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BridgeListResponse, + ) + + def retrieve_capabilities( + self, + bridge_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, + ) -> ProvisioningCapabilities: + """Get advanced network capabilities for a bridge. + + This endpoint is intended for + clients that build custom connect or chat-creation flows. + + Args: + bridge_id: Bridge ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._get( + path_template("/v1/bridges/{bridge_id}/capabilities", bridge_id=bridge_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProvisioningCapabilities, + ) + + +class AsyncBridgesResource(AsyncAPIResource): + """Manage bridge-backed account types, connections, and login sessions""" + + @cached_property + def login_flows(self) -> AsyncLoginFlowsResource: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncLoginFlowsResource(self._client) + + @cached_property + def login_sessions(self) -> AsyncLoginSessionsResource: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncLoginSessionsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncBridgesResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncBridgesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBridgesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncBridgesResourceWithStreamingResponse(self) + + async def retrieve( + self, + bridge_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, + ) -> BridgeRetrieveResponse: + """ + Get one bridge, including the chat accounts connected through it. + + Args: + bridge_id: Bridge ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._get( + path_template("/v1/bridges/{bridge_id}", bridge_id=bridge_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BridgeRetrieveResponse, + ) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BridgeListResponse: + """List available bridges. + + A bridge is a chat-network connector that can connect or + reconnect chat accounts. Connected accounts use the same Account schema as GET + /v1/accounts. + """ + return await self._get( + "/v1/bridges", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BridgeListResponse, + ) + + async def retrieve_capabilities( + self, + bridge_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, + ) -> ProvisioningCapabilities: + """Get advanced network capabilities for a bridge. + + This endpoint is intended for + clients that build custom connect or chat-creation flows. + + Args: + bridge_id: Bridge ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._get( + path_template("/v1/bridges/{bridge_id}/capabilities", bridge_id=bridge_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProvisioningCapabilities, + ) + + +class BridgesResourceWithRawResponse: + def __init__(self, bridges: BridgesResource) -> None: + self._bridges = bridges + + self.retrieve = to_raw_response_wrapper( + bridges.retrieve, + ) + self.list = to_raw_response_wrapper( + bridges.list, + ) + self.retrieve_capabilities = to_raw_response_wrapper( + bridges.retrieve_capabilities, + ) + + @cached_property + def login_flows(self) -> LoginFlowsResourceWithRawResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return LoginFlowsResourceWithRawResponse(self._bridges.login_flows) + + @cached_property + def login_sessions(self) -> LoginSessionsResourceWithRawResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return LoginSessionsResourceWithRawResponse(self._bridges.login_sessions) + + +class AsyncBridgesResourceWithRawResponse: + def __init__(self, bridges: AsyncBridgesResource) -> None: + self._bridges = bridges + + self.retrieve = async_to_raw_response_wrapper( + bridges.retrieve, + ) + self.list = async_to_raw_response_wrapper( + bridges.list, + ) + self.retrieve_capabilities = async_to_raw_response_wrapper( + bridges.retrieve_capabilities, + ) + + @cached_property + def login_flows(self) -> AsyncLoginFlowsResourceWithRawResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncLoginFlowsResourceWithRawResponse(self._bridges.login_flows) + + @cached_property + def login_sessions(self) -> AsyncLoginSessionsResourceWithRawResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncLoginSessionsResourceWithRawResponse(self._bridges.login_sessions) + + +class BridgesResourceWithStreamingResponse: + def __init__(self, bridges: BridgesResource) -> None: + self._bridges = bridges + + self.retrieve = to_streamed_response_wrapper( + bridges.retrieve, + ) + self.list = to_streamed_response_wrapper( + bridges.list, + ) + self.retrieve_capabilities = to_streamed_response_wrapper( + bridges.retrieve_capabilities, + ) + + @cached_property + def login_flows(self) -> LoginFlowsResourceWithStreamingResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return LoginFlowsResourceWithStreamingResponse(self._bridges.login_flows) + + @cached_property + def login_sessions(self) -> LoginSessionsResourceWithStreamingResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return LoginSessionsResourceWithStreamingResponse(self._bridges.login_sessions) + + +class AsyncBridgesResourceWithStreamingResponse: + def __init__(self, bridges: AsyncBridgesResource) -> None: + self._bridges = bridges + + self.retrieve = async_to_streamed_response_wrapper( + bridges.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + bridges.list, + ) + self.retrieve_capabilities = async_to_streamed_response_wrapper( + bridges.retrieve_capabilities, + ) + + @cached_property + def login_flows(self) -> AsyncLoginFlowsResourceWithStreamingResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncLoginFlowsResourceWithStreamingResponse(self._bridges.login_flows) + + @cached_property + def login_sessions(self) -> AsyncLoginSessionsResourceWithStreamingResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncLoginSessionsResourceWithStreamingResponse(self._bridges.login_sessions) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/capabilities.py b/src/beeper_desktop_api/resources/bridges/login_flows.py similarity index 55% rename from src/beeper_desktop_api/resources/matrix/bridges/capabilities.py rename to src/beeper_desktop_api/resources/bridges/login_flows.py index 48338bc..bc14e73 100644 --- a/src/beeper_desktop_api/resources/matrix/bridges/capabilities.py +++ b/src/beeper_desktop_api/resources/bridges/login_flows.py @@ -4,45 +4,47 @@ import httpx -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._utils import path_template -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.matrix.bridges.capability_retrieve_response import CapabilityRetrieveResponse +from ..._base_client import make_request_options +from ...types.bridges.login_flow_list_response import LoginFlowListResponse -__all__ = ["CapabilitiesResource", "AsyncCapabilitiesResource"] +__all__ = ["LoginFlowsResource", "AsyncLoginFlowsResource"] -class CapabilitiesResource(SyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" +class LoginFlowsResource(SyncAPIResource): + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ @cached_property - def with_raw_response(self) -> CapabilitiesResourceWithRawResponse: + def with_raw_response(self) -> LoginFlowsResourceWithRawResponse: """ 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers """ - return CapabilitiesResourceWithRawResponse(self) + return LoginFlowsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CapabilitiesResourceWithStreamingResponse: + def with_streaming_response(self) -> LoginFlowsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response """ - return CapabilitiesResourceWithStreamingResponse(self) + return LoginFlowsResourceWithStreamingResponse(self) - def retrieve( + def list( self, bridge_id: str, *, @@ -52,11 +54,15 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CapabilityRetrieveResponse: - """ - Get bridge capabilities + ) -> LoginFlowListResponse: + """List connect and reconnect flow options for a bridge. + + Use a flowID when creating + a bridge login session. Args: + bridge_id: Bridge ID. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -68,40 +74,39 @@ def retrieve( if not bridge_id: raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") return self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/capabilities", - bridge_id=bridge_id, - ), + path_template("/v1/bridges/{bridge_id}/login-flows", bridge_id=bridge_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CapabilityRetrieveResponse, + cast_to=LoginFlowListResponse, ) -class AsyncCapabilitiesResource(AsyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" +class AsyncLoginFlowsResource(AsyncAPIResource): + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ @cached_property - def with_raw_response(self) -> AsyncCapabilitiesResourceWithRawResponse: + def with_raw_response(self) -> AsyncLoginFlowsResourceWithRawResponse: """ 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers """ - return AsyncCapabilitiesResourceWithRawResponse(self) + return AsyncLoginFlowsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCapabilitiesResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncLoginFlowsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response """ - return AsyncCapabilitiesResourceWithStreamingResponse(self) + return AsyncLoginFlowsResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, bridge_id: str, *, @@ -111,11 +116,15 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CapabilityRetrieveResponse: - """ - Get bridge capabilities + ) -> LoginFlowListResponse: + """List connect and reconnect flow options for a bridge. + + Use a flowID when creating + a bridge login session. Args: + bridge_id: Bridge ID. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -127,48 +136,45 @@ async def retrieve( if not bridge_id: raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") return await self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/capabilities", - bridge_id=bridge_id, - ), + path_template("/v1/bridges/{bridge_id}/login-flows", bridge_id=bridge_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CapabilityRetrieveResponse, + cast_to=LoginFlowListResponse, ) -class CapabilitiesResourceWithRawResponse: - def __init__(self, capabilities: CapabilitiesResource) -> None: - self._capabilities = capabilities +class LoginFlowsResourceWithRawResponse: + def __init__(self, login_flows: LoginFlowsResource) -> None: + self._login_flows = login_flows - self.retrieve = to_raw_response_wrapper( - capabilities.retrieve, + self.list = to_raw_response_wrapper( + login_flows.list, ) -class AsyncCapabilitiesResourceWithRawResponse: - def __init__(self, capabilities: AsyncCapabilitiesResource) -> None: - self._capabilities = capabilities +class AsyncLoginFlowsResourceWithRawResponse: + def __init__(self, login_flows: AsyncLoginFlowsResource) -> None: + self._login_flows = login_flows - self.retrieve = async_to_raw_response_wrapper( - capabilities.retrieve, + self.list = async_to_raw_response_wrapper( + login_flows.list, ) -class CapabilitiesResourceWithStreamingResponse: - def __init__(self, capabilities: CapabilitiesResource) -> None: - self._capabilities = capabilities +class LoginFlowsResourceWithStreamingResponse: + def __init__(self, login_flows: LoginFlowsResource) -> None: + self._login_flows = login_flows - self.retrieve = to_streamed_response_wrapper( - capabilities.retrieve, + self.list = to_streamed_response_wrapper( + login_flows.list, ) -class AsyncCapabilitiesResourceWithStreamingResponse: - def __init__(self, capabilities: AsyncCapabilitiesResource) -> None: - self._capabilities = capabilities +class AsyncLoginFlowsResourceWithStreamingResponse: + def __init__(self, login_flows: AsyncLoginFlowsResource) -> None: + self._login_flows = login_flows - self.retrieve = async_to_streamed_response_wrapper( - capabilities.retrieve, + self.list = async_to_streamed_response_wrapper( + login_flows.list, ) diff --git a/src/beeper_desktop_api/resources/bridges/login_sessions/__init__.py b/src/beeper_desktop_api/resources/bridges/login_sessions/__init__.py new file mode 100644 index 0000000..18becaa --- /dev/null +++ b/src/beeper_desktop_api/resources/bridges/login_sessions/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .steps import ( + StepsResource, + AsyncStepsResource, + StepsResourceWithRawResponse, + AsyncStepsResourceWithRawResponse, + StepsResourceWithStreamingResponse, + AsyncStepsResourceWithStreamingResponse, +) +from .login_sessions import ( + LoginSessionsResource, + AsyncLoginSessionsResource, + LoginSessionsResourceWithRawResponse, + AsyncLoginSessionsResourceWithRawResponse, + LoginSessionsResourceWithStreamingResponse, + AsyncLoginSessionsResourceWithStreamingResponse, +) + +__all__ = [ + "StepsResource", + "AsyncStepsResource", + "StepsResourceWithRawResponse", + "AsyncStepsResourceWithRawResponse", + "StepsResourceWithStreamingResponse", + "AsyncStepsResourceWithStreamingResponse", + "LoginSessionsResource", + "AsyncLoginSessionsResource", + "LoginSessionsResourceWithRawResponse", + "AsyncLoginSessionsResourceWithRawResponse", + "LoginSessionsResourceWithStreamingResponse", + "AsyncLoginSessionsResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/bridges/login_sessions/login_sessions.py b/src/beeper_desktop_api/resources/bridges/login_sessions/login_sessions.py new file mode 100644 index 0000000..5fd6051 --- /dev/null +++ b/src/beeper_desktop_api/resources/bridges/login_sessions/login_sessions.py @@ -0,0 +1,468 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .steps import ( + StepsResource, + AsyncStepsResource, + StepsResourceWithRawResponse, + AsyncStepsResourceWithRawResponse, + StepsResourceWithStreamingResponse, + AsyncStepsResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.bridges import login_session_create_params +from ....types.login_session import LoginSession +from ....types.bridges.login_session_cancel_response import LoginSessionCancelResponse + +__all__ = ["LoginSessionsResource", "AsyncLoginSessionsResource"] + + +class LoginSessionsResource(SyncAPIResource): + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + + @cached_property + def steps(self) -> StepsResource: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return StepsResource(self._client) + + @cached_property + def with_raw_response(self) -> LoginSessionsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return LoginSessionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LoginSessionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return LoginSessionsResourceWithStreamingResponse(self) + + def create( + self, + bridge_id: str, + *, + account_id: str | Omit = omit, + flow_id: str | Omit = omit, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginSession: + """ + Start a temporary bridge login session to connect a new chat account or + reconnect an existing bridge login. Omit loginID and accountID to connect a new + account. + + Args: + bridge_id: Bridge ID. + + account_id: Existing chat account ID to reconnect. Omit to connect a new account. + + flow_id: Optional flow ID returned by the list login flows endpoint. If omitted, Beeper + chooses the default flow. + + login_id: Existing bridge login ID to reconnect. Omit to connect a new account. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return self._post( + path_template("/v1/bridges/{bridge_id}/login-sessions", bridge_id=bridge_id), + body=maybe_transform( + { + "account_id": account_id, + "flow_id": flow_id, + "login_id": login_id, + }, + login_session_create_params.LoginSessionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSession, + ) + + def retrieve( + self, + login_session_id: str, + *, + bridge_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, + ) -> LoginSession: + """ + Get the current state of a temporary bridge login session. + + Args: + bridge_id: Bridge ID. + + login_session_id: Temporary bridge login session ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_session_id: + raise ValueError(f"Expected a non-empty value for `login_session_id` but received {login_session_id!r}") + return self._get( + path_template( + "/v1/bridges/{bridge_id}/login-sessions/{login_session_id}", + bridge_id=bridge_id, + login_session_id=login_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSession, + ) + + def cancel( + self, + login_session_id: str, + *, + bridge_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, + ) -> LoginSessionCancelResponse: + """ + Cancel a temporary bridge login session. + + Args: + bridge_id: Bridge ID. + + login_session_id: Temporary bridge login session ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_session_id: + raise ValueError(f"Expected a non-empty value for `login_session_id` but received {login_session_id!r}") + return self._delete( + path_template( + "/v1/bridges/{bridge_id}/login-sessions/{login_session_id}", + bridge_id=bridge_id, + login_session_id=login_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSessionCancelResponse, + ) + + +class AsyncLoginSessionsResource(AsyncAPIResource): + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + + @cached_property + def steps(self) -> AsyncStepsResource: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncStepsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLoginSessionsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncLoginSessionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLoginSessionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncLoginSessionsResourceWithStreamingResponse(self) + + async def create( + self, + bridge_id: str, + *, + account_id: str | Omit = omit, + flow_id: str | Omit = omit, + login_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginSession: + """ + Start a temporary bridge login session to connect a new chat account or + reconnect an existing bridge login. Omit loginID and accountID to connect a new + account. + + Args: + bridge_id: Bridge ID. + + account_id: Existing chat account ID to reconnect. Omit to connect a new account. + + flow_id: Optional flow ID returned by the list login flows endpoint. If omitted, Beeper + chooses the default flow. + + login_id: Existing bridge login ID to reconnect. Omit to connect a new account. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + return await self._post( + path_template("/v1/bridges/{bridge_id}/login-sessions", bridge_id=bridge_id), + body=await async_maybe_transform( + { + "account_id": account_id, + "flow_id": flow_id, + "login_id": login_id, + }, + login_session_create_params.LoginSessionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSession, + ) + + async def retrieve( + self, + login_session_id: str, + *, + bridge_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, + ) -> LoginSession: + """ + Get the current state of a temporary bridge login session. + + Args: + bridge_id: Bridge ID. + + login_session_id: Temporary bridge login session ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_session_id: + raise ValueError(f"Expected a non-empty value for `login_session_id` but received {login_session_id!r}") + return await self._get( + path_template( + "/v1/bridges/{bridge_id}/login-sessions/{login_session_id}", + bridge_id=bridge_id, + login_session_id=login_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSession, + ) + + async def cancel( + self, + login_session_id: str, + *, + bridge_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, + ) -> LoginSessionCancelResponse: + """ + Cancel a temporary bridge login session. + + Args: + bridge_id: Bridge ID. + + login_session_id: Temporary bridge login session ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_session_id: + raise ValueError(f"Expected a non-empty value for `login_session_id` but received {login_session_id!r}") + return await self._delete( + path_template( + "/v1/bridges/{bridge_id}/login-sessions/{login_session_id}", + bridge_id=bridge_id, + login_session_id=login_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSessionCancelResponse, + ) + + +class LoginSessionsResourceWithRawResponse: + def __init__(self, login_sessions: LoginSessionsResource) -> None: + self._login_sessions = login_sessions + + self.create = to_raw_response_wrapper( + login_sessions.create, + ) + self.retrieve = to_raw_response_wrapper( + login_sessions.retrieve, + ) + self.cancel = to_raw_response_wrapper( + login_sessions.cancel, + ) + + @cached_property + def steps(self) -> StepsResourceWithRawResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return StepsResourceWithRawResponse(self._login_sessions.steps) + + +class AsyncLoginSessionsResourceWithRawResponse: + def __init__(self, login_sessions: AsyncLoginSessionsResource) -> None: + self._login_sessions = login_sessions + + self.create = async_to_raw_response_wrapper( + login_sessions.create, + ) + self.retrieve = async_to_raw_response_wrapper( + login_sessions.retrieve, + ) + self.cancel = async_to_raw_response_wrapper( + login_sessions.cancel, + ) + + @cached_property + def steps(self) -> AsyncStepsResourceWithRawResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncStepsResourceWithRawResponse(self._login_sessions.steps) + + +class LoginSessionsResourceWithStreamingResponse: + def __init__(self, login_sessions: LoginSessionsResource) -> None: + self._login_sessions = login_sessions + + self.create = to_streamed_response_wrapper( + login_sessions.create, + ) + self.retrieve = to_streamed_response_wrapper( + login_sessions.retrieve, + ) + self.cancel = to_streamed_response_wrapper( + login_sessions.cancel, + ) + + @cached_property + def steps(self) -> StepsResourceWithStreamingResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return StepsResourceWithStreamingResponse(self._login_sessions.steps) + + +class AsyncLoginSessionsResourceWithStreamingResponse: + def __init__(self, login_sessions: AsyncLoginSessionsResource) -> None: + self._login_sessions = login_sessions + + self.create = async_to_streamed_response_wrapper( + login_sessions.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + login_sessions.retrieve, + ) + self.cancel = async_to_streamed_response_wrapper( + login_sessions.cancel, + ) + + @cached_property + def steps(self) -> AsyncStepsResourceWithStreamingResponse: + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + return AsyncStepsResourceWithStreamingResponse(self._login_sessions.steps) diff --git a/src/beeper_desktop_api/resources/bridges/login_sessions/steps.py b/src/beeper_desktop_api/resources/bridges/login_sessions/steps.py new file mode 100644 index 0000000..6bc590e --- /dev/null +++ b/src/beeper_desktop_api/resources/bridges/login_sessions/steps.py @@ -0,0 +1,250 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.login_session import LoginSession +from ....types.bridges.login_sessions import step_submit_params + +__all__ = ["StepsResource", "AsyncStepsResource"] + + +class StepsResource(SyncAPIResource): + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + + @cached_property + def with_raw_response(self) -> StepsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return StepsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StepsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return StepsResourceWithStreamingResponse(self) + + def submit( + self, + step_id: str, + *, + bridge_id: str, + login_session_id: str, + type: Literal["user_input", "cookies", "display_and_wait"], + fields: Dict[str, str] | Omit = omit, + last_url: str | Omit = omit, + source: Literal["api", "webview", "browser_extension"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginSession: + """ + Submit input for the current step of a bridge login session. + + Args: + bridge_id: Bridge ID. + + login_session_id: Temporary bridge login session ID. + + step_id: Current bridge login session step ID. + + fields: Field values keyed by the field IDs from the current step. + + last_url: Last browser URL reached during a cookies step, if available. + + source: How the step was completed. Omit unless the client needs to distinguish an + embedded webview or browser extension. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_session_id: + raise ValueError(f"Expected a non-empty value for `login_session_id` but received {login_session_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return self._post( + path_template( + "/v1/bridges/{bridge_id}/login-sessions/{login_session_id}/steps/{step_id}", + bridge_id=bridge_id, + login_session_id=login_session_id, + step_id=step_id, + ), + body=maybe_transform( + { + "type": type, + "fields": fields, + "last_url": last_url, + "source": source, + }, + step_submit_params.StepSubmitParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSession, + ) + + +class AsyncStepsResource(AsyncAPIResource): + """ + Available bridges, bridge logins, login sessions for connect and reconnect flows, and advanced network capabilities. + """ + + @cached_property + def with_raw_response(self) -> AsyncStepsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncStepsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStepsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncStepsResourceWithStreamingResponse(self) + + async def submit( + self, + step_id: str, + *, + bridge_id: str, + login_session_id: str, + type: Literal["user_input", "cookies", "display_and_wait"], + fields: Dict[str, str] | Omit = omit, + last_url: str | Omit = omit, + source: Literal["api", "webview", "browser_extension"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginSession: + """ + Submit input for the current step of a bridge login session. + + Args: + bridge_id: Bridge ID. + + login_session_id: Temporary bridge login session ID. + + step_id: Current bridge login session step ID. + + fields: Field values keyed by the field IDs from the current step. + + last_url: Last browser URL reached during a cookies step, if available. + + source: How the step was completed. Omit unless the client needs to distinguish an + embedded webview or browser extension. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not bridge_id: + raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") + if not login_session_id: + raise ValueError(f"Expected a non-empty value for `login_session_id` but received {login_session_id!r}") + if not step_id: + raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") + return await self._post( + path_template( + "/v1/bridges/{bridge_id}/login-sessions/{login_session_id}/steps/{step_id}", + bridge_id=bridge_id, + login_session_id=login_session_id, + step_id=step_id, + ), + body=await async_maybe_transform( + { + "type": type, + "fields": fields, + "last_url": last_url, + "source": source, + }, + step_submit_params.StepSubmitParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoginSession, + ) + + +class StepsResourceWithRawResponse: + def __init__(self, steps: StepsResource) -> None: + self._steps = steps + + self.submit = to_raw_response_wrapper( + steps.submit, + ) + + +class AsyncStepsResourceWithRawResponse: + def __init__(self, steps: AsyncStepsResource) -> None: + self._steps = steps + + self.submit = async_to_raw_response_wrapper( + steps.submit, + ) + + +class StepsResourceWithStreamingResponse: + def __init__(self, steps: StepsResource) -> None: + self._steps = steps + + self.submit = to_streamed_response_wrapper( + steps.submit, + ) + + +class AsyncStepsResourceWithStreamingResponse: + def __init__(self, steps: AsyncStepsResource) -> None: + self._steps = steps + + self.submit = async_to_streamed_response_wrapper( + steps.submit, + ) diff --git a/src/beeper_desktop_api/resources/chats/chats.py b/src/beeper_desktop_api/resources/chats/chats.py index 38775e0..66dd5e7 100644 --- a/src/beeper_desktop_api/resources/chats/chats.py +++ b/src/beeper_desktop_api/resources/chats/chats.py @@ -157,11 +157,11 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chat: """ - Retrieve chat details including metadata, participants, and latest message + Retrieve chat details, including metadata, participants, and the latest message. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. max_participant_count: Maximum number of participants to return. Use -1 for all; otherwise 0-500. Defaults to 100. List and search endpoints return up to 20 participants per @@ -213,13 +213,13 @@ def update( ) -> Chat: """Update supported chat fields. - Non-empty draft objects are accepted only when the + Non-empty drafts are accepted only when the current draft is empty. Send draft=null to clear the draft before setting new draft text or attachments. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. description: Group chat description/topic. Support depends on the chat account and chat permissions. @@ -343,12 +343,12 @@ def archive( ) -> None: """Archive or unarchive a chat. - Set archived=true to move to archive, - archived=false to move back to inbox + Set archived=true to move it to Archive, or + archived=false to move it back to the inbox. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. archived: True to archive, false to unarchive @@ -388,8 +388,8 @@ def mark_read( Mark a chat as read, optionally through a specific message ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Optional message ID to mark read through. @@ -428,8 +428,8 @@ def mark_unread( Mark a chat as unread, optionally from a specific message ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Optional message ID to mark unread from. @@ -464,12 +464,13 @@ def notify_anyway( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chat: """ - Force a delivery notification when supported by the underlying network. - Currently intended for iMessage on macOS; unsupported networks return an error. + Send a notification despite the recipient focus state when the network supports + it. Currently intended for iMessage on macOS; unsupported networks return an + error. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. extra_headers: Send extra headers @@ -483,6 +484,7 @@ def notify_anyway( raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") return self._post( path_template("/v1/chats/{chat_id}/notify-anyway", chat_id=chat_id), + body={}, options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -515,8 +517,7 @@ def search( Search chats by title, network, or participant names. Args: - account_ids: Provide an array of account IDs to filter chats from specific messaging accounts - only + account_ids: Limit results to specific chat accounts. cursor: Opaque pagination cursor; do not inspect. Use together with 'direction'. @@ -529,16 +530,14 @@ def search( include_muted: Include chats marked as Muted by the user, which are usually less important. Default: true. Set to false if the user wants a more refined search. - last_activity_after: Provide an ISO datetime string to only retrieve chats with last activity after - this time + last_activity_after: Only include chats with last activity after this ISO 8601 datetime. - last_activity_before: Provide an ISO datetime string to only retrieve chats with last activity before - this time + last_activity_before: Only include chats with last activity before this ISO 8601 datetime. limit: Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50 - query: Literal token search (non-semantic). Use single words users type (e.g., - "dinner"). When multiple words provided, ALL must match. Case-insensitive. + query: Literal chat search. Use words the user typed, such as "dinner". When multiple + words are provided, all must match. Case-insensitive. scope: Search scope: 'titles' matches title + network; 'participants' matches participant names. @@ -602,12 +601,12 @@ def start( """Resolve a user/contact and open a direct chat. Reuses and returns an existing - direct chat when one is found. Available in Beeper Desktop v4.2.808+. + direct chat when one is found. Available in Beeper v4.2.808+. Args: account_id: Account to create or start the chat on. - user: Merged user-like contact payload used to resolve the best identifier. + user: Contact-like user payload used to resolve the best identifier. allow_invite: Whether invite-based DM creation is allowed when required by the platform. @@ -741,11 +740,11 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chat: """ - Retrieve chat details including metadata, participants, and latest message + Retrieve chat details, including metadata, participants, and the latest message. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. max_participant_count: Maximum number of participants to return. Use -1 for all; otherwise 0-500. Defaults to 100. List and search endpoints return up to 20 participants per @@ -797,13 +796,13 @@ async def update( ) -> Chat: """Update supported chat fields. - Non-empty draft objects are accepted only when the + Non-empty drafts are accepted only when the current draft is empty. Send draft=null to clear the draft before setting new draft text or attachments. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. description: Group chat description/topic. Support depends on the chat account and chat permissions. @@ -927,12 +926,12 @@ async def archive( ) -> None: """Archive or unarchive a chat. - Set archived=true to move to archive, - archived=false to move back to inbox + Set archived=true to move it to Archive, or + archived=false to move it back to the inbox. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. archived: True to archive, false to unarchive @@ -972,8 +971,8 @@ async def mark_read( Mark a chat as read, optionally through a specific message ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Optional message ID to mark read through. @@ -1012,8 +1011,8 @@ async def mark_unread( Mark a chat as unread, optionally from a specific message ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Optional message ID to mark unread from. @@ -1048,12 +1047,13 @@ async def notify_anyway( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chat: """ - Force a delivery notification when supported by the underlying network. - Currently intended for iMessage on macOS; unsupported networks return an error. + Send a notification despite the recipient focus state when the network supports + it. Currently intended for iMessage on macOS; unsupported networks return an + error. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. extra_headers: Send extra headers @@ -1067,6 +1067,7 @@ async def notify_anyway( raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") return await self._post( path_template("/v1/chats/{chat_id}/notify-anyway", chat_id=chat_id), + body={}, options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1099,8 +1100,7 @@ def search( Search chats by title, network, or participant names. Args: - account_ids: Provide an array of account IDs to filter chats from specific messaging accounts - only + account_ids: Limit results to specific chat accounts. cursor: Opaque pagination cursor; do not inspect. Use together with 'direction'. @@ -1113,16 +1113,14 @@ def search( include_muted: Include chats marked as Muted by the user, which are usually less important. Default: true. Set to false if the user wants a more refined search. - last_activity_after: Provide an ISO datetime string to only retrieve chats with last activity after - this time + last_activity_after: Only include chats with last activity after this ISO 8601 datetime. - last_activity_before: Provide an ISO datetime string to only retrieve chats with last activity before - this time + last_activity_before: Only include chats with last activity before this ISO 8601 datetime. limit: Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50 - query: Literal token search (non-semantic). Use single words users type (e.g., - "dinner"). When multiple words provided, ALL must match. Case-insensitive. + query: Literal chat search. Use words the user typed, such as "dinner". When multiple + words are provided, all must match. Case-insensitive. scope: Search scope: 'titles' matches title + network; 'participants' matches participant names. @@ -1186,12 +1184,12 @@ async def start( """Resolve a user/contact and open a direct chat. Reuses and returns an existing - direct chat when one is found. Available in Beeper Desktop v4.2.808+. + direct chat when one is found. Available in Beeper v4.2.808+. Args: account_id: Account to create or start the chat on. - user: Merged user-like contact payload used to resolve the best identifier. + user: Contact-like user payload used to resolve the best identifier. allow_invite: Whether invite-based DM creation is allowed when required by the platform. diff --git a/src/beeper_desktop_api/resources/chats/messages/reactions.py b/src/beeper_desktop_api/resources/chats/messages/reactions.py index 974d9f6..c9199da 100644 --- a/src/beeper_desktop_api/resources/chats/messages/reactions.py +++ b/src/beeper_desktop_api/resources/chats/messages/reactions.py @@ -61,8 +61,8 @@ def delete( Remove the reaction added by the authenticated user from an existing message. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -114,8 +114,8 @@ def add( Args: chat_id: Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -192,8 +192,8 @@ async def delete( Remove the reaction added by the authenticated user from an existing message. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -245,8 +245,8 @@ async def add( Args: chat_id: Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. diff --git a/src/beeper_desktop_api/resources/chats/reminders.py b/src/beeper_desktop_api/resources/chats/reminders.py index ef502a6..fb02508 100644 --- a/src/beeper_desktop_api/resources/chats/reminders.py +++ b/src/beeper_desktop_api/resources/chats/reminders.py @@ -54,13 +54,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Set a reminder for a chat at a specific time + """Set a reminder for a chat at a specific time. Args: chat_id: Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + Input routes also accept the local chat ID from this installation when + available. reminder: Reminder configuration @@ -95,13 +95,13 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Clear an existing reminder from a chat + """Clear an existing reminder from a chat. Args: chat_id: Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + Input routes also accept the local chat ID from this installation when + available. extra_headers: Send extra headers @@ -157,13 +157,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Set a reminder for a chat at a specific time + """Set a reminder for a chat at a specific time. Args: chat_id: Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + Input routes also accept the local chat ID from this installation when + available. reminder: Reminder configuration @@ -198,13 +198,13 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Clear an existing reminder from a chat + """Clear an existing reminder from a chat. Args: chat_id: Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + Input routes also accept the local chat ID from this installation when + available. extra_headers: Send extra headers diff --git a/src/beeper_desktop_api/resources/info.py b/src/beeper_desktop_api/resources/info.py index d7eaf8d..c642841 100644 --- a/src/beeper_desktop_api/resources/info.py +++ b/src/beeper_desktop_api/resources/info.py @@ -56,7 +56,7 @@ def retrieve( ) -> InfoRetrieveResponse: """ Returns app, platform, server, endpoint discovery, OAuth, and WebSocket metadata - for this Beeper Desktop instance. + for this Beeper Client API server. """ return self._get( "/v1/info", @@ -108,7 +108,7 @@ async def retrieve( ) -> InfoRetrieveResponse: """ Returns app, platform, server, endpoint discovery, OAuth, and WebSocket metadata - for this Beeper Desktop instance. + for this Beeper Client API server. """ return await self._get( "/v1/info", diff --git a/src/beeper_desktop_api/resources/matrix/__init__.py b/src/beeper_desktop_api/resources/matrix/__init__.py deleted file mode 100644 index 7d5901f..0000000 --- a/src/beeper_desktop_api/resources/matrix/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .rooms import ( - RoomsResource, - AsyncRoomsResource, - RoomsResourceWithRawResponse, - AsyncRoomsResourceWithRawResponse, - RoomsResourceWithStreamingResponse, - AsyncRoomsResourceWithStreamingResponse, -) -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .matrix import ( - MatrixResource, - AsyncMatrixResource, - MatrixResourceWithRawResponse, - AsyncMatrixResourceWithRawResponse, - MatrixResourceWithStreamingResponse, - AsyncMatrixResourceWithStreamingResponse, -) -from .bridges import ( - BridgesResource, - AsyncBridgesResource, - BridgesResourceWithRawResponse, - AsyncBridgesResourceWithRawResponse, - BridgesResourceWithStreamingResponse, - AsyncBridgesResourceWithStreamingResponse, -) - -__all__ = [ - "UsersResource", - "AsyncUsersResource", - "UsersResourceWithRawResponse", - "AsyncUsersResourceWithRawResponse", - "UsersResourceWithStreamingResponse", - "AsyncUsersResourceWithStreamingResponse", - "RoomsResource", - "AsyncRoomsResource", - "RoomsResourceWithRawResponse", - "AsyncRoomsResourceWithRawResponse", - "RoomsResourceWithStreamingResponse", - "AsyncRoomsResourceWithStreamingResponse", - "BridgesResource", - "AsyncBridgesResource", - "BridgesResourceWithRawResponse", - "AsyncBridgesResourceWithRawResponse", - "BridgesResourceWithStreamingResponse", - "AsyncBridgesResourceWithStreamingResponse", - "MatrixResource", - "AsyncMatrixResource", - "MatrixResourceWithRawResponse", - "AsyncMatrixResourceWithRawResponse", - "MatrixResourceWithStreamingResponse", - "AsyncMatrixResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/matrix/bridges/__init__.py b/src/beeper_desktop_api/resources/matrix/bridges/__init__.py deleted file mode 100644 index e25079a..0000000 --- a/src/beeper_desktop_api/resources/matrix/bridges/__init__.py +++ /dev/null @@ -1,89 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .auth import ( - AuthResource, - AsyncAuthResource, - AuthResourceWithRawResponse, - AsyncAuthResourceWithRawResponse, - AuthResourceWithStreamingResponse, - AsyncAuthResourceWithStreamingResponse, -) -from .rooms import ( - RoomsResource, - AsyncRoomsResource, - RoomsResourceWithRawResponse, - AsyncRoomsResourceWithRawResponse, - RoomsResourceWithStreamingResponse, - AsyncRoomsResourceWithStreamingResponse, -) -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .bridges import ( - BridgesResource, - AsyncBridgesResource, - BridgesResourceWithRawResponse, - AsyncBridgesResourceWithRawResponse, - BridgesResourceWithStreamingResponse, - AsyncBridgesResourceWithStreamingResponse, -) -from .contacts import ( - ContactsResource, - AsyncContactsResource, - ContactsResourceWithRawResponse, - AsyncContactsResourceWithRawResponse, - ContactsResourceWithStreamingResponse, - AsyncContactsResourceWithStreamingResponse, -) -from .capabilities import ( - CapabilitiesResource, - AsyncCapabilitiesResource, - CapabilitiesResourceWithRawResponse, - AsyncCapabilitiesResourceWithRawResponse, - CapabilitiesResourceWithStreamingResponse, - AsyncCapabilitiesResourceWithStreamingResponse, -) - -__all__ = [ - "AuthResource", - "AsyncAuthResource", - "AuthResourceWithRawResponse", - "AsyncAuthResourceWithRawResponse", - "AuthResourceWithStreamingResponse", - "AsyncAuthResourceWithStreamingResponse", - "ContactsResource", - "AsyncContactsResource", - "ContactsResourceWithRawResponse", - "AsyncContactsResourceWithRawResponse", - "ContactsResourceWithStreamingResponse", - "AsyncContactsResourceWithStreamingResponse", - "UsersResource", - "AsyncUsersResource", - "UsersResourceWithRawResponse", - "AsyncUsersResourceWithRawResponse", - "UsersResourceWithStreamingResponse", - "AsyncUsersResourceWithStreamingResponse", - "RoomsResource", - "AsyncRoomsResource", - "RoomsResourceWithRawResponse", - "AsyncRoomsResourceWithRawResponse", - "RoomsResourceWithStreamingResponse", - "AsyncRoomsResourceWithStreamingResponse", - "CapabilitiesResource", - "AsyncCapabilitiesResource", - "CapabilitiesResourceWithRawResponse", - "AsyncCapabilitiesResourceWithRawResponse", - "CapabilitiesResourceWithStreamingResponse", - "AsyncCapabilitiesResourceWithStreamingResponse", - "BridgesResource", - "AsyncBridgesResource", - "BridgesResourceWithRawResponse", - "AsyncBridgesResourceWithRawResponse", - "BridgesResourceWithStreamingResponse", - "AsyncBridgesResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/matrix/bridges/auth.py b/src/beeper_desktop_api/resources/matrix/bridges/auth.py deleted file mode 100644 index b05ee19..0000000 --- a/src/beeper_desktop_api/resources/matrix/bridges/auth.py +++ /dev/null @@ -1,951 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, Dict, cast - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import path_template, maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.matrix.bridges import auth_start_login_params, auth_submit_cookies_params, auth_submit_user_input_params -from ....types.matrix.bridges.auth_whoami_response import AuthWhoamiResponse -from ....types.matrix.bridges.auth_list_flows_response import AuthListFlowsResponse -from ....types.matrix.bridges.auth_list_logins_response import AuthListLoginsResponse -from ....types.matrix.bridges.auth_start_login_response import AuthStartLoginResponse -from ....types.matrix.bridges.auth_wait_for_step_response import AuthWaitForStepResponse -from ....types.matrix.bridges.auth_submit_cookies_response import AuthSubmitCookiesResponse -from ....types.matrix.bridges.auth_submit_user_input_response import AuthSubmitUserInputResponse - -__all__ = ["AuthResource", "AsyncAuthResource"] - - -class AuthResource(SyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> AuthResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AuthResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AuthResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AuthResourceWithStreamingResponse(self) - - def list_flows( - self, - bridge_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, - ) -> AuthListFlowsResponse: - """ - Get the available login flows. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/flows", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AuthListFlowsResponse, - ) - - def list_logins( - self, - bridge_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, - ) -> AuthListLoginsResponse: - """ - Get the login IDs of the current user. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logins", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AuthListLoginsResponse, - ) - - def logout( - self, - login_id: str, - *, - bridge_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, - ) -> object: - """Log out of an existing login. - - Args: - login_id: The unique ID of a login. - - Defined by the network connector. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_id: - raise ValueError(f"Expected a non-empty value for `login_id` but received {login_id!r}") - return self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logout/{login_id}", - bridge_id=bridge_id, - login_id=login_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - def start_login( - self, - flow_id: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AuthStartLoginResponse: - """ - This endpoint starts a new login process, which is used to log into the bridge. - - The basic flow of the entire login, including calling this endpoint, is: - - 1. Call `GET /v3/login/flows` to get the list of available flows. If there's - more than one flow, ask the user to pick which one they want to use. - 2. Call this endpoint with the chosen flow ID to start the login. The first - login step will be returned. - 3. Render the information provided in the step. - 4. Call the `/login/step/...` endpoint corresponding to the step type: - - For `user_input` and `cookies`, acquire the requested fields before calling - the endpoint. - - For `display_and_wait`, call the endpoint immediately (as there's nothing - to acquire on the client side). - 5. Handle the data returned by the login step endpoint: - - If an error is returned, the login has failed and must be restarted (from - either step 1 or step 2) if the user wants to try again. - - If step type `complete` is returned, the login finished successfully. - - Otherwise, go to step 3 with the new data. - - Args: - login_id: An existing login ID to re-login as. If this is specified and the user logs into - a different account, the provided ID will be logged out. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return cast( - AuthStartLoginResponse, - self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/start/{flow_id}", - bridge_id=bridge_id, - flow_id=flow_id, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"login_id": login_id}, auth_start_login_params.AuthStartLoginParams), - ), - cast_to=cast( - Any, AuthStartLoginResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def submit_cookies( - self, - step_id: str, - *, - bridge_id: str, - login_process_id: str, - body: Dict[str, 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, - ) -> AuthSubmitCookiesResponse: - """ - Submit extracted cookies in a login process. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_process_id: - raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return cast( - AuthSubmitCookiesResponse, - self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/cookies", - bridge_id=bridge_id, - login_process_id=login_process_id, - step_id=step_id, - ), - body=maybe_transform(body, auth_submit_cookies_params.AuthSubmitCookiesParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, AuthSubmitCookiesResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def submit_user_input( - self, - step_id: str, - *, - bridge_id: str, - login_process_id: str, - body: Dict[str, 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, - ) -> AuthSubmitUserInputResponse: - """ - Submit user input in a login process. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_process_id: - raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return cast( - AuthSubmitUserInputResponse, - self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/user_input", - bridge_id=bridge_id, - login_process_id=login_process_id, - step_id=step_id, - ), - body=maybe_transform(body, auth_submit_user_input_params.AuthSubmitUserInputParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, AuthSubmitUserInputResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def wait_for_step( - self, - step_id: str, - *, - bridge_id: str, - login_process_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, - ) -> AuthWaitForStepResponse: - """ - Wait for the next step after displaying data to the user. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_process_id: - raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return cast( - AuthWaitForStepResponse, - self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/display_and_wait", - bridge_id=bridge_id, - login_process_id=login_process_id, - step_id=step_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, AuthWaitForStepResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def whoami( - self, - bridge_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, - ) -> AuthWhoamiResponse: - """ - Get all info that is useful for presenting this bridge in a manager interface. - - - Server details: remote network details, available login flows, homeserver - name, bridge bot user ID, command prefix - - User details: management room ID, list of logins with current state and info - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/whoami", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AuthWhoamiResponse, - ) - - -class AsyncAuthResource(AsyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> AsyncAuthResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncAuthResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAuthResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncAuthResourceWithStreamingResponse(self) - - async def list_flows( - self, - bridge_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, - ) -> AuthListFlowsResponse: - """ - Get the available login flows. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return await self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/flows", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AuthListFlowsResponse, - ) - - async def list_logins( - self, - bridge_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, - ) -> AuthListLoginsResponse: - """ - Get the login IDs of the current user. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return await self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logins", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AuthListLoginsResponse, - ) - - async def logout( - self, - login_id: str, - *, - bridge_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, - ) -> object: - """Log out of an existing login. - - Args: - login_id: The unique ID of a login. - - Defined by the network connector. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_id: - raise ValueError(f"Expected a non-empty value for `login_id` but received {login_id!r}") - return await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/logout/{login_id}", - bridge_id=bridge_id, - login_id=login_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - async def start_login( - self, - flow_id: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AuthStartLoginResponse: - """ - This endpoint starts a new login process, which is used to log into the bridge. - - The basic flow of the entire login, including calling this endpoint, is: - - 1. Call `GET /v3/login/flows` to get the list of available flows. If there's - more than one flow, ask the user to pick which one they want to use. - 2. Call this endpoint with the chosen flow ID to start the login. The first - login step will be returned. - 3. Render the information provided in the step. - 4. Call the `/login/step/...` endpoint corresponding to the step type: - - For `user_input` and `cookies`, acquire the requested fields before calling - the endpoint. - - For `display_and_wait`, call the endpoint immediately (as there's nothing - to acquire on the client side). - 5. Handle the data returned by the login step endpoint: - - If an error is returned, the login has failed and must be restarted (from - either step 1 or step 2) if the user wants to try again. - - If step type `complete` is returned, the login finished successfully. - - Otherwise, go to step 3 with the new data. - - Args: - login_id: An existing login ID to re-login as. If this is specified and the user logs into - a different account, the provided ID will be logged out. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not flow_id: - raise ValueError(f"Expected a non-empty value for `flow_id` but received {flow_id!r}") - return cast( - AuthStartLoginResponse, - await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/start/{flow_id}", - bridge_id=bridge_id, - flow_id=flow_id, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"login_id": login_id}, auth_start_login_params.AuthStartLoginParams - ), - ), - cast_to=cast( - Any, AuthStartLoginResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def submit_cookies( - self, - step_id: str, - *, - bridge_id: str, - login_process_id: str, - body: Dict[str, 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, - ) -> AuthSubmitCookiesResponse: - """ - Submit extracted cookies in a login process. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_process_id: - raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return cast( - AuthSubmitCookiesResponse, - await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/cookies", - bridge_id=bridge_id, - login_process_id=login_process_id, - step_id=step_id, - ), - body=await async_maybe_transform(body, auth_submit_cookies_params.AuthSubmitCookiesParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, AuthSubmitCookiesResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def submit_user_input( - self, - step_id: str, - *, - bridge_id: str, - login_process_id: str, - body: Dict[str, 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, - ) -> AuthSubmitUserInputResponse: - """ - Submit user input in a login process. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_process_id: - raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return cast( - AuthSubmitUserInputResponse, - await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/user_input", - bridge_id=bridge_id, - login_process_id=login_process_id, - step_id=step_id, - ), - body=await async_maybe_transform(body, auth_submit_user_input_params.AuthSubmitUserInputParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, AuthSubmitUserInputResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def wait_for_step( - self, - step_id: str, - *, - bridge_id: str, - login_process_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, - ) -> AuthWaitForStepResponse: - """ - Wait for the next step after displaying data to the user. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not login_process_id: - raise ValueError(f"Expected a non-empty value for `login_process_id` but received {login_process_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return cast( - AuthWaitForStepResponse, - await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/login/step/{login_process_id}/{step_id}/display_and_wait", - bridge_id=bridge_id, - login_process_id=login_process_id, - step_id=step_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, AuthWaitForStepResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def whoami( - self, - bridge_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, - ) -> AuthWhoamiResponse: - """ - Get all info that is useful for presenting this bridge in a manager interface. - - - Server details: remote network details, available login flows, homeserver - name, bridge bot user ID, command prefix - - User details: management room ID, list of logins with current state and info - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return await self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/whoami", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AuthWhoamiResponse, - ) - - -class AuthResourceWithRawResponse: - def __init__(self, auth: AuthResource) -> None: - self._auth = auth - - self.list_flows = to_raw_response_wrapper( - auth.list_flows, - ) - self.list_logins = to_raw_response_wrapper( - auth.list_logins, - ) - self.logout = to_raw_response_wrapper( - auth.logout, - ) - self.start_login = to_raw_response_wrapper( - auth.start_login, - ) - self.submit_cookies = to_raw_response_wrapper( - auth.submit_cookies, - ) - self.submit_user_input = to_raw_response_wrapper( - auth.submit_user_input, - ) - self.wait_for_step = to_raw_response_wrapper( - auth.wait_for_step, - ) - self.whoami = to_raw_response_wrapper( - auth.whoami, - ) - - -class AsyncAuthResourceWithRawResponse: - def __init__(self, auth: AsyncAuthResource) -> None: - self._auth = auth - - self.list_flows = async_to_raw_response_wrapper( - auth.list_flows, - ) - self.list_logins = async_to_raw_response_wrapper( - auth.list_logins, - ) - self.logout = async_to_raw_response_wrapper( - auth.logout, - ) - self.start_login = async_to_raw_response_wrapper( - auth.start_login, - ) - self.submit_cookies = async_to_raw_response_wrapper( - auth.submit_cookies, - ) - self.submit_user_input = async_to_raw_response_wrapper( - auth.submit_user_input, - ) - self.wait_for_step = async_to_raw_response_wrapper( - auth.wait_for_step, - ) - self.whoami = async_to_raw_response_wrapper( - auth.whoami, - ) - - -class AuthResourceWithStreamingResponse: - def __init__(self, auth: AuthResource) -> None: - self._auth = auth - - self.list_flows = to_streamed_response_wrapper( - auth.list_flows, - ) - self.list_logins = to_streamed_response_wrapper( - auth.list_logins, - ) - self.logout = to_streamed_response_wrapper( - auth.logout, - ) - self.start_login = to_streamed_response_wrapper( - auth.start_login, - ) - self.submit_cookies = to_streamed_response_wrapper( - auth.submit_cookies, - ) - self.submit_user_input = to_streamed_response_wrapper( - auth.submit_user_input, - ) - self.wait_for_step = to_streamed_response_wrapper( - auth.wait_for_step, - ) - self.whoami = to_streamed_response_wrapper( - auth.whoami, - ) - - -class AsyncAuthResourceWithStreamingResponse: - def __init__(self, auth: AsyncAuthResource) -> None: - self._auth = auth - - self.list_flows = async_to_streamed_response_wrapper( - auth.list_flows, - ) - self.list_logins = async_to_streamed_response_wrapper( - auth.list_logins, - ) - self.logout = async_to_streamed_response_wrapper( - auth.logout, - ) - self.start_login = async_to_streamed_response_wrapper( - auth.start_login, - ) - self.submit_cookies = async_to_streamed_response_wrapper( - auth.submit_cookies, - ) - self.submit_user_input = async_to_streamed_response_wrapper( - auth.submit_user_input, - ) - self.wait_for_step = async_to_streamed_response_wrapper( - auth.wait_for_step, - ) - self.whoami = async_to_streamed_response_wrapper( - auth.whoami, - ) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/bridges.py b/src/beeper_desktop_api/resources/matrix/bridges/bridges.py deleted file mode 100644 index f2922c9..0000000 --- a/src/beeper_desktop_api/resources/matrix/bridges/bridges.py +++ /dev/null @@ -1,264 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .auth import ( - AuthResource, - AsyncAuthResource, - AuthResourceWithRawResponse, - AsyncAuthResourceWithRawResponse, - AuthResourceWithStreamingResponse, - AsyncAuthResourceWithStreamingResponse, -) -from .rooms import ( - RoomsResource, - AsyncRoomsResource, - RoomsResourceWithRawResponse, - AsyncRoomsResourceWithRawResponse, - RoomsResourceWithStreamingResponse, - AsyncRoomsResourceWithStreamingResponse, -) -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .contacts import ( - ContactsResource, - AsyncContactsResource, - ContactsResourceWithRawResponse, - AsyncContactsResourceWithRawResponse, - ContactsResourceWithStreamingResponse, - AsyncContactsResourceWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .capabilities import ( - CapabilitiesResource, - AsyncCapabilitiesResource, - CapabilitiesResourceWithRawResponse, - AsyncCapabilitiesResourceWithRawResponse, - CapabilitiesResourceWithStreamingResponse, - AsyncCapabilitiesResourceWithStreamingResponse, -) - -__all__ = ["BridgesResource", "AsyncBridgesResource"] - - -class BridgesResource(SyncAPIResource): - """Matrix-compatible APIs for connected network bridges.""" - - @cached_property - def auth(self) -> AuthResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AuthResource(self._client) - - @cached_property - def contacts(self) -> ContactsResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return ContactsResource(self._client) - - @cached_property - def users(self) -> UsersResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return UsersResource(self._client) - - @cached_property - def rooms(self) -> RoomsResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return RoomsResource(self._client) - - @cached_property - def capabilities(self) -> CapabilitiesResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return CapabilitiesResource(self._client) - - @cached_property - def with_raw_response(self) -> BridgesResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return BridgesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BridgesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return BridgesResourceWithStreamingResponse(self) - - -class AsyncBridgesResource(AsyncAPIResource): - """Matrix-compatible APIs for connected network bridges.""" - - @cached_property - def auth(self) -> AsyncAuthResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncAuthResource(self._client) - - @cached_property - def contacts(self) -> AsyncContactsResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncContactsResource(self._client) - - @cached_property - def users(self) -> AsyncUsersResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncUsersResource(self._client) - - @cached_property - def rooms(self) -> AsyncRoomsResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncRoomsResource(self._client) - - @cached_property - def capabilities(self) -> AsyncCapabilitiesResource: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncCapabilitiesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncBridgesResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncBridgesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBridgesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncBridgesResourceWithStreamingResponse(self) - - -class BridgesResourceWithRawResponse: - def __init__(self, bridges: BridgesResource) -> None: - self._bridges = bridges - - @cached_property - def auth(self) -> AuthResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AuthResourceWithRawResponse(self._bridges.auth) - - @cached_property - def contacts(self) -> ContactsResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return ContactsResourceWithRawResponse(self._bridges.contacts) - - @cached_property - def users(self) -> UsersResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return UsersResourceWithRawResponse(self._bridges.users) - - @cached_property - def rooms(self) -> RoomsResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return RoomsResourceWithRawResponse(self._bridges.rooms) - - @cached_property - def capabilities(self) -> CapabilitiesResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return CapabilitiesResourceWithRawResponse(self._bridges.capabilities) - - -class AsyncBridgesResourceWithRawResponse: - def __init__(self, bridges: AsyncBridgesResource) -> None: - self._bridges = bridges - - @cached_property - def auth(self) -> AsyncAuthResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncAuthResourceWithRawResponse(self._bridges.auth) - - @cached_property - def contacts(self) -> AsyncContactsResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncContactsResourceWithRawResponse(self._bridges.contacts) - - @cached_property - def users(self) -> AsyncUsersResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncUsersResourceWithRawResponse(self._bridges.users) - - @cached_property - def rooms(self) -> AsyncRoomsResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncRoomsResourceWithRawResponse(self._bridges.rooms) - - @cached_property - def capabilities(self) -> AsyncCapabilitiesResourceWithRawResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncCapabilitiesResourceWithRawResponse(self._bridges.capabilities) - - -class BridgesResourceWithStreamingResponse: - def __init__(self, bridges: BridgesResource) -> None: - self._bridges = bridges - - @cached_property - def auth(self) -> AuthResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AuthResourceWithStreamingResponse(self._bridges.auth) - - @cached_property - def contacts(self) -> ContactsResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return ContactsResourceWithStreamingResponse(self._bridges.contacts) - - @cached_property - def users(self) -> UsersResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return UsersResourceWithStreamingResponse(self._bridges.users) - - @cached_property - def rooms(self) -> RoomsResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return RoomsResourceWithStreamingResponse(self._bridges.rooms) - - @cached_property - def capabilities(self) -> CapabilitiesResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return CapabilitiesResourceWithStreamingResponse(self._bridges.capabilities) - - -class AsyncBridgesResourceWithStreamingResponse: - def __init__(self, bridges: AsyncBridgesResource) -> None: - self._bridges = bridges - - @cached_property - def auth(self) -> AsyncAuthResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncAuthResourceWithStreamingResponse(self._bridges.auth) - - @cached_property - def contacts(self) -> AsyncContactsResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncContactsResourceWithStreamingResponse(self._bridges.contacts) - - @cached_property - def users(self) -> AsyncUsersResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncUsersResourceWithStreamingResponse(self._bridges.users) - - @cached_property - def rooms(self) -> AsyncRoomsResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncRoomsResourceWithStreamingResponse(self._bridges.rooms) - - @cached_property - def capabilities(self) -> AsyncCapabilitiesResourceWithStreamingResponse: - """Matrix-compatible APIs for accounts and connected network bridges.""" - return AsyncCapabilitiesResourceWithStreamingResponse(self._bridges.capabilities) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/contacts.py b/src/beeper_desktop_api/resources/matrix/bridges/contacts.py deleted file mode 100644 index 1b7c10b..0000000 --- a/src/beeper_desktop_api/resources/matrix/bridges/contacts.py +++ /dev/null @@ -1,189 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import path_template, maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.matrix.bridges import contact_list_params -from ....types.matrix.bridges.contact_list_response import ContactListResponse - -__all__ = ["ContactsResource", "AsyncContactsResource"] - - -class ContactsResource(SyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> ContactsResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return ContactsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ContactsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return ContactsResourceWithStreamingResponse(self) - - def list( - self, - bridge_id: str, - *, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ContactListResponse: - """ - Get a list of contacts. - - Args: - login_id: An optional explicit login ID to do the action through. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/contacts", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"login_id": login_id}, contact_list_params.ContactListParams), - ), - cast_to=ContactListResponse, - ) - - -class AsyncContactsResource(AsyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> AsyncContactsResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncContactsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncContactsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncContactsResourceWithStreamingResponse(self) - - async def list( - self, - bridge_id: str, - *, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ContactListResponse: - """ - Get a list of contacts. - - Args: - login_id: An optional explicit login ID to do the action through. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return await self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/contacts", - bridge_id=bridge_id, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"login_id": login_id}, contact_list_params.ContactListParams), - ), - cast_to=ContactListResponse, - ) - - -class ContactsResourceWithRawResponse: - def __init__(self, contacts: ContactsResource) -> None: - self._contacts = contacts - - self.list = to_raw_response_wrapper( - contacts.list, - ) - - -class AsyncContactsResourceWithRawResponse: - def __init__(self, contacts: AsyncContactsResource) -> None: - self._contacts = contacts - - self.list = async_to_raw_response_wrapper( - contacts.list, - ) - - -class ContactsResourceWithStreamingResponse: - def __init__(self, contacts: ContactsResource) -> None: - self._contacts = contacts - - self.list = to_streamed_response_wrapper( - contacts.list, - ) - - -class AsyncContactsResourceWithStreamingResponse: - def __init__(self, contacts: AsyncContactsResource) -> None: - self._contacts = contacts - - self.list = async_to_streamed_response_wrapper( - contacts.list, - ) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/rooms.py b/src/beeper_desktop_api/resources/matrix/bridges/rooms.py deleted file mode 100644 index fcd9d9b..0000000 --- a/src/beeper_desktop_api/resources/matrix/bridges/rooms.py +++ /dev/null @@ -1,386 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import path_template, maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.matrix.bridges import room_create_dm_params, room_create_group_params -from ....types.matrix.bridges.room_create_dm_response import RoomCreateDmResponse -from ....types.matrix.bridges.room_create_group_response import RoomCreateGroupResponse - -__all__ = ["RoomsResource", "AsyncRoomsResource"] - - -class RoomsResource(SyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> RoomsResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return RoomsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RoomsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return RoomsResourceWithStreamingResponse(self) - - def create_dm( - self, - identifier: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoomCreateDmResponse: - """ - Create a direct chat with a user on the remote network. - - Args: - login_id: An optional explicit login ID to do the action through. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_dm/{identifier}", - bridge_id=bridge_id, - identifier=identifier, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"login_id": login_id}, room_create_dm_params.RoomCreateDmParams), - ), - cast_to=RoomCreateDmResponse, - ) - - def create_group( - self, - group_type: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - avatar: room_create_group_params.Avatar | Omit = omit, - disappear: room_create_group_params.Disappear | Omit = omit, - name: room_create_group_params.Name | Omit = omit, - parent: object | Omit = omit, - participants: SequenceNotStr[str] | Omit = omit, - room_id: str | Omit = omit, - topic: room_create_group_params.Topic | Omit = omit, - type: str | Omit = omit, - username: 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, - ) -> RoomCreateGroupResponse: - """ - Create a group chat on the remote network. - - Args: - login_id: An optional explicit login ID to do the action through. - - avatar: The `m.room.avatar` event content for the room. - - disappear: The `com.beeper.disappearing_timer` event content for the room. - - name: The `m.room.name` event content for the room. - - participants: The users to add to the group initially. - - room_id: An existing Matrix room ID to bridge to. The other parameters must be already in - sync with the room state when using this parameter. - - topic: The `m.room.topic` event content for the room. - - type: The type of group to create. - - username: The public username for the created group. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not group_type: - raise ValueError(f"Expected a non-empty value for `group_type` but received {group_type!r}") - return self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_group/{group_type}", - bridge_id=bridge_id, - group_type=group_type, - ), - body=maybe_transform( - { - "avatar": avatar, - "disappear": disappear, - "name": name, - "parent": parent, - "participants": participants, - "room_id": room_id, - "topic": topic, - "type": type, - "username": username, - }, - room_create_group_params.RoomCreateGroupParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"login_id": login_id}, room_create_group_params.RoomCreateGroupParams), - ), - cast_to=RoomCreateGroupResponse, - ) - - -class AsyncRoomsResource(AsyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> AsyncRoomsResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncRoomsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRoomsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncRoomsResourceWithStreamingResponse(self) - - async def create_dm( - self, - identifier: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoomCreateDmResponse: - """ - Create a direct chat with a user on the remote network. - - Args: - login_id: An optional explicit login ID to do the action through. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_dm/{identifier}", - bridge_id=bridge_id, - identifier=identifier, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"login_id": login_id}, room_create_dm_params.RoomCreateDmParams), - ), - cast_to=RoomCreateDmResponse, - ) - - async def create_group( - self, - group_type: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - avatar: room_create_group_params.Avatar | Omit = omit, - disappear: room_create_group_params.Disappear | Omit = omit, - name: room_create_group_params.Name | Omit = omit, - parent: object | Omit = omit, - participants: SequenceNotStr[str] | Omit = omit, - room_id: str | Omit = omit, - topic: room_create_group_params.Topic | Omit = omit, - type: str | Omit = omit, - username: 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, - ) -> RoomCreateGroupResponse: - """ - Create a group chat on the remote network. - - Args: - login_id: An optional explicit login ID to do the action through. - - avatar: The `m.room.avatar` event content for the room. - - disappear: The `com.beeper.disappearing_timer` event content for the room. - - name: The `m.room.name` event content for the room. - - participants: The users to add to the group initially. - - room_id: An existing Matrix room ID to bridge to. The other parameters must be already in - sync with the room state when using this parameter. - - topic: The `m.room.topic` event content for the room. - - type: The type of group to create. - - username: The public username for the created group. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not group_type: - raise ValueError(f"Expected a non-empty value for `group_type` but received {group_type!r}") - return await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/create_group/{group_type}", - bridge_id=bridge_id, - group_type=group_type, - ), - body=await async_maybe_transform( - { - "avatar": avatar, - "disappear": disappear, - "name": name, - "parent": parent, - "participants": participants, - "room_id": room_id, - "topic": topic, - "type": type, - "username": username, - }, - room_create_group_params.RoomCreateGroupParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"login_id": login_id}, room_create_group_params.RoomCreateGroupParams - ), - ), - cast_to=RoomCreateGroupResponse, - ) - - -class RoomsResourceWithRawResponse: - def __init__(self, rooms: RoomsResource) -> None: - self._rooms = rooms - - self.create_dm = to_raw_response_wrapper( - rooms.create_dm, - ) - self.create_group = to_raw_response_wrapper( - rooms.create_group, - ) - - -class AsyncRoomsResourceWithRawResponse: - def __init__(self, rooms: AsyncRoomsResource) -> None: - self._rooms = rooms - - self.create_dm = async_to_raw_response_wrapper( - rooms.create_dm, - ) - self.create_group = async_to_raw_response_wrapper( - rooms.create_group, - ) - - -class RoomsResourceWithStreamingResponse: - def __init__(self, rooms: RoomsResource) -> None: - self._rooms = rooms - - self.create_dm = to_streamed_response_wrapper( - rooms.create_dm, - ) - self.create_group = to_streamed_response_wrapper( - rooms.create_group, - ) - - -class AsyncRoomsResourceWithStreamingResponse: - def __init__(self, rooms: AsyncRoomsResource) -> None: - self._rooms = rooms - - self.create_dm = async_to_streamed_response_wrapper( - rooms.create_dm, - ) - self.create_group = async_to_streamed_response_wrapper( - rooms.create_group, - ) diff --git a/src/beeper_desktop_api/resources/matrix/bridges/users.py b/src/beeper_desktop_api/resources/matrix/bridges/users.py deleted file mode 100644 index 541fc05..0000000 --- a/src/beeper_desktop_api/resources/matrix/bridges/users.py +++ /dev/null @@ -1,304 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import path_template, maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.matrix.bridges import user_search_params, user_resolve_params -from ....types.matrix.bridges.user_search_response import UserSearchResponse -from ....types.matrix.bridges.user_resolve_response import UserResolveResponse - -__all__ = ["UsersResource", "AsyncUsersResource"] - - -class UsersResource(SyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> UsersResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return UsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return UsersResourceWithStreamingResponse(self) - - def resolve( - self, - identifier: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserResolveResponse: - """ - Resolve an identifier to a user on the remote network. - - Args: - login_id: An optional explicit login ID to do the action through. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/resolve_identifier/{identifier}", - bridge_id=bridge_id, - identifier=identifier, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"login_id": login_id}, user_resolve_params.UserResolveParams), - ), - cast_to=UserResolveResponse, - ) - - def search( - self, - bridge_id: str, - *, - login_id: str | Omit = omit, - query: 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, - ) -> UserSearchResponse: - """ - Search for users on the remote network - - Args: - login_id: An optional explicit login ID to do the action through. - - query: The search query to send to the remote network - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/search_users", - bridge_id=bridge_id, - ), - body=maybe_transform({"query": query}, user_search_params.UserSearchParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"login_id": login_id}, user_search_params.UserSearchParams), - ), - cast_to=UserSearchResponse, - ) - - -class AsyncUsersResource(AsyncAPIResource): - """Matrix-compatible APIs for accounts and connected network bridges.""" - - @cached_property - def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncUsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncUsersResourceWithStreamingResponse(self) - - async def resolve( - self, - identifier: str, - *, - bridge_id: str, - login_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserResolveResponse: - """ - Resolve an identifier to a user on the remote network. - - Args: - login_id: An optional explicit login ID to do the action through. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/resolve_identifier/{identifier}", - bridge_id=bridge_id, - identifier=identifier, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"login_id": login_id}, user_resolve_params.UserResolveParams), - ), - cast_to=UserResolveResponse, - ) - - async def search( - self, - bridge_id: str, - *, - login_id: str | Omit = omit, - query: 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, - ) -> UserSearchResponse: - """ - Search for users on the remote network - - Args: - login_id: An optional explicit login ID to do the action through. - - query: The search query to send to the remote network - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not bridge_id: - raise ValueError(f"Expected a non-empty value for `bridge_id` but received {bridge_id!r}") - return await self._post( - path_template( - "/_matrix/client/unstable/com.beeper.bridge/{bridge_id}/_matrix/provision/v3/search_users", - bridge_id=bridge_id, - ), - body=await async_maybe_transform({"query": query}, user_search_params.UserSearchParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"login_id": login_id}, user_search_params.UserSearchParams), - ), - cast_to=UserSearchResponse, - ) - - -class UsersResourceWithRawResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.resolve = to_raw_response_wrapper( - users.resolve, - ) - self.search = to_raw_response_wrapper( - users.search, - ) - - -class AsyncUsersResourceWithRawResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.resolve = async_to_raw_response_wrapper( - users.resolve, - ) - self.search = async_to_raw_response_wrapper( - users.search, - ) - - -class UsersResourceWithStreamingResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.resolve = to_streamed_response_wrapper( - users.resolve, - ) - self.search = to_streamed_response_wrapper( - users.search, - ) - - -class AsyncUsersResourceWithStreamingResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.resolve = async_to_streamed_response_wrapper( - users.resolve, - ) - self.search = async_to_streamed_response_wrapper( - users.search, - ) diff --git a/src/beeper_desktop_api/resources/matrix/matrix.py b/src/beeper_desktop_api/resources/matrix/matrix.py deleted file mode 100644 index 8a494a3..0000000 --- a/src/beeper_desktop_api/resources/matrix/matrix.py +++ /dev/null @@ -1,176 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from .rooms.rooms import ( - RoomsResource, - AsyncRoomsResource, - RoomsResourceWithRawResponse, - AsyncRoomsResourceWithRawResponse, - RoomsResourceWithStreamingResponse, - AsyncRoomsResourceWithStreamingResponse, -) -from .users.users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .bridges.bridges import ( - BridgesResource, - AsyncBridgesResource, - BridgesResourceWithRawResponse, - AsyncBridgesResourceWithRawResponse, - BridgesResourceWithStreamingResponse, - AsyncBridgesResourceWithStreamingResponse, -) - -__all__ = ["MatrixResource", "AsyncMatrixResource"] - - -class MatrixResource(SyncAPIResource): - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - - @cached_property - def users(self) -> UsersResource: - return UsersResource(self._client) - - @cached_property - def rooms(self) -> RoomsResource: - return RoomsResource(self._client) - - @cached_property - def bridges(self) -> BridgesResource: - """Matrix-compatible APIs for connected network bridges.""" - return BridgesResource(self._client) - - @cached_property - def with_raw_response(self) -> MatrixResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return MatrixResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MatrixResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return MatrixResourceWithStreamingResponse(self) - - -class AsyncMatrixResource(AsyncAPIResource): - """Matrix-compatible APIs for accounts, rooms, and connected network bridges.""" - - @cached_property - def users(self) -> AsyncUsersResource: - return AsyncUsersResource(self._client) - - @cached_property - def rooms(self) -> AsyncRoomsResource: - return AsyncRoomsResource(self._client) - - @cached_property - def bridges(self) -> AsyncBridgesResource: - """Matrix-compatible APIs for connected network bridges.""" - return AsyncBridgesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncMatrixResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncMatrixResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMatrixResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncMatrixResourceWithStreamingResponse(self) - - -class MatrixResourceWithRawResponse: - def __init__(self, matrix: MatrixResource) -> None: - self._matrix = matrix - - @cached_property - def users(self) -> UsersResourceWithRawResponse: - return UsersResourceWithRawResponse(self._matrix.users) - - @cached_property - def rooms(self) -> RoomsResourceWithRawResponse: - return RoomsResourceWithRawResponse(self._matrix.rooms) - - @cached_property - def bridges(self) -> BridgesResourceWithRawResponse: - """Matrix-compatible APIs for connected network bridges.""" - return BridgesResourceWithRawResponse(self._matrix.bridges) - - -class AsyncMatrixResourceWithRawResponse: - def __init__(self, matrix: AsyncMatrixResource) -> None: - self._matrix = matrix - - @cached_property - def users(self) -> AsyncUsersResourceWithRawResponse: - return AsyncUsersResourceWithRawResponse(self._matrix.users) - - @cached_property - def rooms(self) -> AsyncRoomsResourceWithRawResponse: - return AsyncRoomsResourceWithRawResponse(self._matrix.rooms) - - @cached_property - def bridges(self) -> AsyncBridgesResourceWithRawResponse: - """Matrix-compatible APIs for connected network bridges.""" - return AsyncBridgesResourceWithRawResponse(self._matrix.bridges) - - -class MatrixResourceWithStreamingResponse: - def __init__(self, matrix: MatrixResource) -> None: - self._matrix = matrix - - @cached_property - def users(self) -> UsersResourceWithStreamingResponse: - return UsersResourceWithStreamingResponse(self._matrix.users) - - @cached_property - def rooms(self) -> RoomsResourceWithStreamingResponse: - return RoomsResourceWithStreamingResponse(self._matrix.rooms) - - @cached_property - def bridges(self) -> BridgesResourceWithStreamingResponse: - """Matrix-compatible APIs for connected network bridges.""" - return BridgesResourceWithStreamingResponse(self._matrix.bridges) - - -class AsyncMatrixResourceWithStreamingResponse: - def __init__(self, matrix: AsyncMatrixResource) -> None: - self._matrix = matrix - - @cached_property - def users(self) -> AsyncUsersResourceWithStreamingResponse: - return AsyncUsersResourceWithStreamingResponse(self._matrix.users) - - @cached_property - def rooms(self) -> AsyncRoomsResourceWithStreamingResponse: - return AsyncRoomsResourceWithStreamingResponse(self._matrix.rooms) - - @cached_property - def bridges(self) -> AsyncBridgesResourceWithStreamingResponse: - """Matrix-compatible APIs for connected network bridges.""" - return AsyncBridgesResourceWithStreamingResponse(self._matrix.bridges) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/__init__.py b/src/beeper_desktop_api/resources/matrix/rooms/__init__.py deleted file mode 100644 index 443fc1b..0000000 --- a/src/beeper_desktop_api/resources/matrix/rooms/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .rooms import ( - RoomsResource, - AsyncRoomsResource, - RoomsResourceWithRawResponse, - AsyncRoomsResourceWithRawResponse, - RoomsResourceWithStreamingResponse, - AsyncRoomsResourceWithStreamingResponse, -) -from .state import ( - StateResource, - AsyncStateResource, - StateResourceWithRawResponse, - AsyncStateResourceWithRawResponse, - StateResourceWithStreamingResponse, - AsyncStateResourceWithStreamingResponse, -) -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from .account_data import ( - AccountDataResource, - AsyncAccountDataResource, - AccountDataResourceWithRawResponse, - AsyncAccountDataResourceWithRawResponse, - AccountDataResourceWithStreamingResponse, - AsyncAccountDataResourceWithStreamingResponse, -) - -__all__ = [ - "AccountDataResource", - "AsyncAccountDataResource", - "AccountDataResourceWithRawResponse", - "AsyncAccountDataResourceWithRawResponse", - "AccountDataResourceWithStreamingResponse", - "AsyncAccountDataResourceWithStreamingResponse", - "StateResource", - "AsyncStateResource", - "StateResourceWithRawResponse", - "AsyncStateResourceWithRawResponse", - "StateResourceWithStreamingResponse", - "AsyncStateResourceWithStreamingResponse", - "EventsResource", - "AsyncEventsResource", - "EventsResourceWithRawResponse", - "AsyncEventsResourceWithRawResponse", - "EventsResourceWithStreamingResponse", - "AsyncEventsResourceWithStreamingResponse", - "RoomsResource", - "AsyncRoomsResource", - "RoomsResourceWithRawResponse", - "AsyncRoomsResourceWithRawResponse", - "RoomsResourceWithStreamingResponse", - "AsyncRoomsResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/matrix/rooms/account_data.py b/src/beeper_desktop_api/resources/matrix/rooms/account_data.py deleted file mode 100644 index 967c27c..0000000 --- a/src/beeper_desktop_api/resources/matrix/rooms/account_data.py +++ /dev/null @@ -1,302 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._utils import path_template, 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.matrix.rooms import account_data_update_params - -__all__ = ["AccountDataResource", "AsyncAccountDataResource"] - - -class AccountDataResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AccountDataResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AccountDataResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AccountDataResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AccountDataResourceWithStreamingResponse(self) - - def retrieve( - self, - type: str, - *, - user_id: str, - room_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, - ) -> object: - """Get some account data for the client on a given room. - - This config is only - visible to the user that set the account data. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return self._get( - path_template( - "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", - user_id=user_id, - room_id=room_id, - type=type, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - def update( - self, - type: str, - *, - user_id: str, - room_id: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """Set some account data for the client on a given room. - - This config is only - visible to the user that set the account data. The config will be delivered to - clients in the per-room entries via - [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return self._put( - path_template( - "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", - user_id=user_id, - room_id=room_id, - type=type, - ), - body=maybe_transform(body, account_data_update_params.AccountDataUpdateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class AsyncAccountDataResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAccountDataResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncAccountDataResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAccountDataResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncAccountDataResourceWithStreamingResponse(self) - - async def retrieve( - self, - type: str, - *, - user_id: str, - room_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, - ) -> object: - """Get some account data for the client on a given room. - - This config is only - visible to the user that set the account data. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return await self._get( - path_template( - "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", - user_id=user_id, - room_id=room_id, - type=type, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - async def update( - self, - type: str, - *, - user_id: str, - room_id: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """Set some account data for the client on a given room. - - This config is only - visible to the user that set the account data. The config will be delivered to - clients in the per-room entries via - [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return await self._put( - path_template( - "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/account_data/{type}", - user_id=user_id, - room_id=room_id, - type=type, - ), - body=await async_maybe_transform(body, account_data_update_params.AccountDataUpdateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class AccountDataResourceWithRawResponse: - def __init__(self, account_data: AccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = to_raw_response_wrapper( - account_data.retrieve, - ) - self.update = to_raw_response_wrapper( - account_data.update, - ) - - -class AsyncAccountDataResourceWithRawResponse: - def __init__(self, account_data: AsyncAccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = async_to_raw_response_wrapper( - account_data.retrieve, - ) - self.update = async_to_raw_response_wrapper( - account_data.update, - ) - - -class AccountDataResourceWithStreamingResponse: - def __init__(self, account_data: AccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = to_streamed_response_wrapper( - account_data.retrieve, - ) - self.update = to_streamed_response_wrapper( - account_data.update, - ) - - -class AsyncAccountDataResourceWithStreamingResponse: - def __init__(self, account_data: AsyncAccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = async_to_streamed_response_wrapper( - account_data.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - account_data.update, - ) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/events.py b/src/beeper_desktop_api/resources/matrix/rooms/events.py deleted file mode 100644 index c7dc565..0000000 --- a/src/beeper_desktop_api/resources/matrix/rooms/events.py +++ /dev/null @@ -1,174 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._utils import path_template -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.matrix.rooms.event_retrieve_response import EventRetrieveResponse - -__all__ = ["EventsResource", "AsyncEventsResource"] - - -class EventsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EventsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return EventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EventsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return EventsResourceWithStreamingResponse(self) - - def retrieve( - self, - event_id: str, - *, - room_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, - ) -> EventRetrieveResponse: - """Get a single event based on `roomId/eventId`. - - You must have permission to - retrieve this event e.g. by being a member in the room for this event. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return self._get( - path_template("/_matrix/client/v3/rooms/{room_id}/event/{event_id}", room_id=room_id, event_id=event_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EventRetrieveResponse, - ) - - -class AsyncEventsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncEventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncEventsResourceWithStreamingResponse(self) - - async def retrieve( - self, - event_id: str, - *, - room_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, - ) -> EventRetrieveResponse: - """Get a single event based on `roomId/eventId`. - - You must have permission to - retrieve this event e.g. by being a member in the room for this event. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not event_id: - raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") - return await self._get( - path_template("/_matrix/client/v3/rooms/{room_id}/event/{event_id}", room_id=room_id, event_id=event_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EventRetrieveResponse, - ) - - -class EventsResourceWithRawResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.retrieve = to_raw_response_wrapper( - events.retrieve, - ) - - -class AsyncEventsResourceWithRawResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.retrieve = async_to_raw_response_wrapper( - events.retrieve, - ) - - -class EventsResourceWithStreamingResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.retrieve = to_streamed_response_wrapper( - events.retrieve, - ) - - -class AsyncEventsResourceWithStreamingResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.retrieve = async_to_streamed_response_wrapper( - events.retrieve, - ) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/rooms.py b/src/beeper_desktop_api/resources/matrix/rooms/rooms.py deleted file mode 100644 index 2686e32..0000000 --- a/src/beeper_desktop_api/resources/matrix/rooms/rooms.py +++ /dev/null @@ -1,845 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal - -import httpx - -from .state import ( - StateResource, - AsyncStateResource, - StateResourceWithRawResponse, - AsyncStateResourceWithRawResponse, - StateResourceWithStreamingResponse, - AsyncStateResourceWithStreamingResponse, -) -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import path_template, maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .account_data import ( - AccountDataResource, - AsyncAccountDataResource, - AccountDataResourceWithRawResponse, - AsyncAccountDataResourceWithRawResponse, - AccountDataResourceWithStreamingResponse, - AsyncAccountDataResourceWithStreamingResponse, -) -from ...._base_client import make_request_options -from ....types.matrix import room_join_params, room_leave_params, room_create_params -from ....types.matrix.room_join_response import RoomJoinResponse -from ....types.matrix.room_create_response import RoomCreateResponse - -__all__ = ["RoomsResource", "AsyncRoomsResource"] - - -class RoomsResource(SyncAPIResource): - @cached_property - def account_data(self) -> AccountDataResource: - return AccountDataResource(self._client) - - @cached_property - def state(self) -> StateResource: - return StateResource(self._client) - - @cached_property - def events(self) -> EventsResource: - return EventsResource(self._client) - - @cached_property - def with_raw_response(self) -> RoomsResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return RoomsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RoomsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return RoomsResourceWithStreamingResponse(self) - - def create( - self, - *, - creation_content: object | Omit = omit, - initial_state: Iterable[room_create_params.InitialState] | Omit = omit, - invite: SequenceNotStr[str] | Omit = omit, - invite_3pid: Iterable[room_create_params.Invite3pid] | Omit = omit, - is_direct: bool | Omit = omit, - name: str | Omit = omit, - power_level_content_override: object | Omit = omit, - preset: Literal["private_chat", "public_chat", "trusted_private_chat"] | Omit = omit, - room_alias_name: str | Omit = omit, - room_version: str | Omit = omit, - topic: str | Omit = omit, - visibility: Literal["public", "private"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoomCreateResponse: - """ - Create a new room with various configuration options. - - The server MUST apply the normal state resolution rules when creating the new - room, including checking power levels for each event. It MUST apply the events - implied by the request in the following order: - - 1. The `m.room.create` event itself. Must be the first event in the room. - - 2. An `m.room.member` event for the creator to join the room. This is needed so - the remaining events can be sent. - - 3. A default `m.room.power_levels` event. Overridden by the - `power_level_content_override` parameter. - - In [room versions](https://spec.matrix.org/v1.18/rooms) 1 through 11, the - room creator (and not other members) will be given permission to send state - events. - - In room versions 12 and later, the room creator is given infinite power level - and cannot be specified in the `users` field of `m.room.power_levels`, so is - not listed explicitly. - - **Note**: For `trusted_private_chat`, the users specified in the `invite` - parameter SHOULD also be appended to `additional_creators` by the server, per - the `creation_content` parameter. - - If the room's version is 12 or higher, the power level for sending - `m.room.tombstone` events MUST explicitly be higher than `state_default`. For - example, set to 150 instead of 100. - - 4. An `m.room.canonical_alias` event if `room_alias_name` is given. - - 5. Events set by the `preset`. Currently these are the `m.room.join_rules`, - `m.room.history_visibility`, and `m.room.guest_access` state events. - - 6. Events listed in `initial_state`, in the order that they are listed. - - 7. Events implied by `name` and `topic` (`m.room.name` and `m.room.topic` state - events). - - 8. Invite events implied by `invite` and `invite_3pid` (`m.room.member` with - `membership: invite` and `m.room.third_party_invite`). - - The available presets do the following with respect to room state: - - | Preset | `join_rules` | `history_visibility` | `guest_access` | Other | - | ---------------------- | ------------ | -------------------- | -------------- | ---------------------------------------------------------------- | - | `private_chat` | `invite` | `shared` | `can_join` | | - | `trusted_private_chat` | `invite` | `shared` | `can_join` | All invitees are given the same power level as the room creator. | - | `public_chat` | `public` | `shared` | `forbidden` | | - - The server will create a `m.room.create` event in the room with the requesting - user as the creator, alongside other keys provided in the `creation_content` or - implied by behaviour of `creation_content`. - - Args: - creation_content: Extra keys, such as `m.federate`, to be added to the content of the - [`m.room.create`](https://spec.matrix.org/v1.18/client-server-api/#mroomcreate) - event. - - The server will overwrite the following keys: `creator`, `room_version`. Future - versions of the specification may allow the server to overwrite other keys. - - When using the `trusted_private_chat` preset, the server SHOULD combine - `additional_creators` specified here and the `invite` array into the eventual - `m.room.create` event's `additional_creators`, deduplicating between the two - parameters. - - initial_state: A list of state events to set in the new room. This allows the user to override - the default state events set in the new room. The expected format of the state - events are an object with type, state_key and content keys set. - - Takes precedence over events set by `preset`, but gets overridden by `name` and - `topic` keys. - - invite: A list of user IDs to invite to the room. This will tell the server to invite - everyone in the list to the newly created room. - - invite_3pid: A list of objects representing third-party IDs to invite into the room. - - is_direct: This flag makes the server set the `is_direct` flag on the `m.room.member` - events sent to the users in `invite` and `invite_3pid`. See - [Direct Messaging](https://spec.matrix.org/v1.18/client-server-api/#direct-messaging) - for more information. - - name: If this is included, an - [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) - event will be sent into the room to indicate the name for the room. This - overwrites any - [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) - event in `initial_state`. - - power_level_content_override: The power level content to override in the default power level event. This - object is applied on top of the generated - [`m.room.power_levels`](https://spec.matrix.org/v1.18/client-server-api/#mroompower_levels) - event content prior to it being sent to the room. Defaults to overriding - nothing. - - preset: Convenience parameter for setting various default state events based on a - preset. - - If unspecified, the server should use the `visibility` to determine which preset - to use. A visibility of `public` equates to a preset of `public_chat` and - `private` visibility equates to a preset of `private_chat`. - - room_alias_name: The desired room alias **local part**. If this is included, a room alias will be - created and mapped to the newly created room. The alias will belong on the - _same_ homeserver which created the room. For example, if this was set to "foo" - and sent to the homeserver "example.com" the complete room alias would be - `#foo:example.com`. - - The complete room alias will become the canonical alias for the room and an - `m.room.canonical_alias` event will be sent into the room. - - room_version: The room version to set for the room. If not provided, the homeserver is to use - its configured default. If provided, the homeserver will return a 400 error with - the errcode `M_UNSUPPORTED_ROOM_VERSION` if it does not support the room - version. - - topic: If this is included, an - [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) - event with a `text/plain` mimetype will be sent into the room to indicate the - topic for the room. This overwrites any - [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) - event in `initial_state`. - - visibility: The room's visibility in the server's - [published room directory](https://spec.matrix.org/v1.18/client-server-api#published-room-directory). - Defaults to `private`. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/_matrix/client/v3/createRoom", - body=maybe_transform( - { - "creation_content": creation_content, - "initial_state": initial_state, - "invite": invite, - "invite_3pid": invite_3pid, - "is_direct": is_direct, - "name": name, - "power_level_content_override": power_level_content_override, - "preset": preset, - "room_alias_name": room_alias_name, - "room_version": room_version, - "topic": topic, - "visibility": visibility, - }, - room_create_params.RoomCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RoomCreateResponse, - ) - - def join( - self, - room_id_or_alias: str, - *, - via: SequenceNotStr[str] | Omit = omit, - reason: str | Omit = omit, - third_party_signed: room_join_params.ThirdPartySigned | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoomJoinResponse: - """ - _Note that this API takes either a room ID or alias, unlike_ - `/rooms/{roomId}/join`. - - This API starts a user's participation in a particular room, if that user is - allowed to participate in that room. After this call, the client is allowed to - see all current state events in the room, and all subsequent events associated - with the room until the user leaves the room. - - After a user has joined a room, the room will appear as an entry in the response - of the - [`/initialSync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3initialsync) - and - [`/sync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync) - APIs. - - Args: - via: The servers to attempt to join the room through. One of the servers must be - participating in the room. - - reason: Optional reason to be included as the `reason` on the subsequent membership - event. - - third_party_signed: A signature of an `m.third_party_invite` token to prove that this user owns a - third-party identity which has been invited to the room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id_or_alias: - raise ValueError(f"Expected a non-empty value for `room_id_or_alias` but received {room_id_or_alias!r}") - return self._post( - path_template("/_matrix/client/v3/join/{room_id_or_alias}", room_id_or_alias=room_id_or_alias), - body=maybe_transform( - { - "reason": reason, - "third_party_signed": third_party_signed, - }, - room_join_params.RoomJoinParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"via": via}, room_join_params.RoomJoinParams), - ), - cast_to=RoomJoinResponse, - ) - - def leave( - self, - room_id: str, - *, - reason: 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, - ) -> object: - """ - This API stops a user participating in a particular room. - - If the user was already in the room, they will no longer be able to see new - events in the room. If the room requires an invite to join, they will need to be - re-invited before they can re-join. - - If the user was invited to the room, but had not joined, this call serves to - reject the invite. - - Servers MAY additionally forget the room when this endpoint is called – just as - if the user had also invoked - [`/forget`](https://spec.matrix.org/v1.18/client-server-api/#post_matrixclientv3roomsroomidforget). - Servers that do this, MUST inform clients about this behavior using the - [`m.forget_forced_upon_leave`](https://spec.matrix.org/v1.18/client-server-api/#mforget_forced_upon_leave-capability) - capability. - - If the server doesn't automatically forget the room, the user will still be - allowed to retrieve history from the room which they were previously allowed to - see. - - Args: - reason: Optional reason to be included as the `reason` on the subsequent membership - event. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - return self._post( - path_template("/_matrix/client/v3/rooms/{room_id}/leave", room_id=room_id), - body=maybe_transform({"reason": reason}, room_leave_params.RoomLeaveParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class AsyncRoomsResource(AsyncAPIResource): - @cached_property - def account_data(self) -> AsyncAccountDataResource: - return AsyncAccountDataResource(self._client) - - @cached_property - def state(self) -> AsyncStateResource: - return AsyncStateResource(self._client) - - @cached_property - def events(self) -> AsyncEventsResource: - return AsyncEventsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncRoomsResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncRoomsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRoomsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncRoomsResourceWithStreamingResponse(self) - - async def create( - self, - *, - creation_content: object | Omit = omit, - initial_state: Iterable[room_create_params.InitialState] | Omit = omit, - invite: SequenceNotStr[str] | Omit = omit, - invite_3pid: Iterable[room_create_params.Invite3pid] | Omit = omit, - is_direct: bool | Omit = omit, - name: str | Omit = omit, - power_level_content_override: object | Omit = omit, - preset: Literal["private_chat", "public_chat", "trusted_private_chat"] | Omit = omit, - room_alias_name: str | Omit = omit, - room_version: str | Omit = omit, - topic: str | Omit = omit, - visibility: Literal["public", "private"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoomCreateResponse: - """ - Create a new room with various configuration options. - - The server MUST apply the normal state resolution rules when creating the new - room, including checking power levels for each event. It MUST apply the events - implied by the request in the following order: - - 1. The `m.room.create` event itself. Must be the first event in the room. - - 2. An `m.room.member` event for the creator to join the room. This is needed so - the remaining events can be sent. - - 3. A default `m.room.power_levels` event. Overridden by the - `power_level_content_override` parameter. - - In [room versions](https://spec.matrix.org/v1.18/rooms) 1 through 11, the - room creator (and not other members) will be given permission to send state - events. - - In room versions 12 and later, the room creator is given infinite power level - and cannot be specified in the `users` field of `m.room.power_levels`, so is - not listed explicitly. - - **Note**: For `trusted_private_chat`, the users specified in the `invite` - parameter SHOULD also be appended to `additional_creators` by the server, per - the `creation_content` parameter. - - If the room's version is 12 or higher, the power level for sending - `m.room.tombstone` events MUST explicitly be higher than `state_default`. For - example, set to 150 instead of 100. - - 4. An `m.room.canonical_alias` event if `room_alias_name` is given. - - 5. Events set by the `preset`. Currently these are the `m.room.join_rules`, - `m.room.history_visibility`, and `m.room.guest_access` state events. - - 6. Events listed in `initial_state`, in the order that they are listed. - - 7. Events implied by `name` and `topic` (`m.room.name` and `m.room.topic` state - events). - - 8. Invite events implied by `invite` and `invite_3pid` (`m.room.member` with - `membership: invite` and `m.room.third_party_invite`). - - The available presets do the following with respect to room state: - - | Preset | `join_rules` | `history_visibility` | `guest_access` | Other | - | ---------------------- | ------------ | -------------------- | -------------- | ---------------------------------------------------------------- | - | `private_chat` | `invite` | `shared` | `can_join` | | - | `trusted_private_chat` | `invite` | `shared` | `can_join` | All invitees are given the same power level as the room creator. | - | `public_chat` | `public` | `shared` | `forbidden` | | - - The server will create a `m.room.create` event in the room with the requesting - user as the creator, alongside other keys provided in the `creation_content` or - implied by behaviour of `creation_content`. - - Args: - creation_content: Extra keys, such as `m.federate`, to be added to the content of the - [`m.room.create`](https://spec.matrix.org/v1.18/client-server-api/#mroomcreate) - event. - - The server will overwrite the following keys: `creator`, `room_version`. Future - versions of the specification may allow the server to overwrite other keys. - - When using the `trusted_private_chat` preset, the server SHOULD combine - `additional_creators` specified here and the `invite` array into the eventual - `m.room.create` event's `additional_creators`, deduplicating between the two - parameters. - - initial_state: A list of state events to set in the new room. This allows the user to override - the default state events set in the new room. The expected format of the state - events are an object with type, state_key and content keys set. - - Takes precedence over events set by `preset`, but gets overridden by `name` and - `topic` keys. - - invite: A list of user IDs to invite to the room. This will tell the server to invite - everyone in the list to the newly created room. - - invite_3pid: A list of objects representing third-party IDs to invite into the room. - - is_direct: This flag makes the server set the `is_direct` flag on the `m.room.member` - events sent to the users in `invite` and `invite_3pid`. See - [Direct Messaging](https://spec.matrix.org/v1.18/client-server-api/#direct-messaging) - for more information. - - name: If this is included, an - [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) - event will be sent into the room to indicate the name for the room. This - overwrites any - [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) - event in `initial_state`. - - power_level_content_override: The power level content to override in the default power level event. This - object is applied on top of the generated - [`m.room.power_levels`](https://spec.matrix.org/v1.18/client-server-api/#mroompower_levels) - event content prior to it being sent to the room. Defaults to overriding - nothing. - - preset: Convenience parameter for setting various default state events based on a - preset. - - If unspecified, the server should use the `visibility` to determine which preset - to use. A visibility of `public` equates to a preset of `public_chat` and - `private` visibility equates to a preset of `private_chat`. - - room_alias_name: The desired room alias **local part**. If this is included, a room alias will be - created and mapped to the newly created room. The alias will belong on the - _same_ homeserver which created the room. For example, if this was set to "foo" - and sent to the homeserver "example.com" the complete room alias would be - `#foo:example.com`. - - The complete room alias will become the canonical alias for the room and an - `m.room.canonical_alias` event will be sent into the room. - - room_version: The room version to set for the room. If not provided, the homeserver is to use - its configured default. If provided, the homeserver will return a 400 error with - the errcode `M_UNSUPPORTED_ROOM_VERSION` if it does not support the room - version. - - topic: If this is included, an - [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) - event with a `text/plain` mimetype will be sent into the room to indicate the - topic for the room. This overwrites any - [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) - event in `initial_state`. - - visibility: The room's visibility in the server's - [published room directory](https://spec.matrix.org/v1.18/client-server-api#published-room-directory). - Defaults to `private`. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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( - "/_matrix/client/v3/createRoom", - body=await async_maybe_transform( - { - "creation_content": creation_content, - "initial_state": initial_state, - "invite": invite, - "invite_3pid": invite_3pid, - "is_direct": is_direct, - "name": name, - "power_level_content_override": power_level_content_override, - "preset": preset, - "room_alias_name": room_alias_name, - "room_version": room_version, - "topic": topic, - "visibility": visibility, - }, - room_create_params.RoomCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RoomCreateResponse, - ) - - async def join( - self, - room_id_or_alias: str, - *, - via: SequenceNotStr[str] | Omit = omit, - reason: str | Omit = omit, - third_party_signed: room_join_params.ThirdPartySigned | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoomJoinResponse: - """ - _Note that this API takes either a room ID or alias, unlike_ - `/rooms/{roomId}/join`. - - This API starts a user's participation in a particular room, if that user is - allowed to participate in that room. After this call, the client is allowed to - see all current state events in the room, and all subsequent events associated - with the room until the user leaves the room. - - After a user has joined a room, the room will appear as an entry in the response - of the - [`/initialSync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3initialsync) - and - [`/sync`](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync) - APIs. - - Args: - via: The servers to attempt to join the room through. One of the servers must be - participating in the room. - - reason: Optional reason to be included as the `reason` on the subsequent membership - event. - - third_party_signed: A signature of an `m.third_party_invite` token to prove that this user owns a - third-party identity which has been invited to the room. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id_or_alias: - raise ValueError(f"Expected a non-empty value for `room_id_or_alias` but received {room_id_or_alias!r}") - return await self._post( - path_template("/_matrix/client/v3/join/{room_id_or_alias}", room_id_or_alias=room_id_or_alias), - body=await async_maybe_transform( - { - "reason": reason, - "third_party_signed": third_party_signed, - }, - room_join_params.RoomJoinParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"via": via}, room_join_params.RoomJoinParams), - ), - cast_to=RoomJoinResponse, - ) - - async def leave( - self, - room_id: str, - *, - reason: 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, - ) -> object: - """ - This API stops a user participating in a particular room. - - If the user was already in the room, they will no longer be able to see new - events in the room. If the room requires an invite to join, they will need to be - re-invited before they can re-join. - - If the user was invited to the room, but had not joined, this call serves to - reject the invite. - - Servers MAY additionally forget the room when this endpoint is called – just as - if the user had also invoked - [`/forget`](https://spec.matrix.org/v1.18/client-server-api/#post_matrixclientv3roomsroomidforget). - Servers that do this, MUST inform clients about this behavior using the - [`m.forget_forced_upon_leave`](https://spec.matrix.org/v1.18/client-server-api/#mforget_forced_upon_leave-capability) - capability. - - If the server doesn't automatically forget the room, the user will still be - allowed to retrieve history from the room which they were previously allowed to - see. - - Args: - reason: Optional reason to be included as the `reason` on the subsequent membership - event. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - return await self._post( - path_template("/_matrix/client/v3/rooms/{room_id}/leave", room_id=room_id), - body=await async_maybe_transform({"reason": reason}, room_leave_params.RoomLeaveParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class RoomsResourceWithRawResponse: - def __init__(self, rooms: RoomsResource) -> None: - self._rooms = rooms - - self.create = to_raw_response_wrapper( - rooms.create, - ) - self.join = to_raw_response_wrapper( - rooms.join, - ) - self.leave = to_raw_response_wrapper( - rooms.leave, - ) - - @cached_property - def account_data(self) -> AccountDataResourceWithRawResponse: - return AccountDataResourceWithRawResponse(self._rooms.account_data) - - @cached_property - def state(self) -> StateResourceWithRawResponse: - return StateResourceWithRawResponse(self._rooms.state) - - @cached_property - def events(self) -> EventsResourceWithRawResponse: - return EventsResourceWithRawResponse(self._rooms.events) - - -class AsyncRoomsResourceWithRawResponse: - def __init__(self, rooms: AsyncRoomsResource) -> None: - self._rooms = rooms - - self.create = async_to_raw_response_wrapper( - rooms.create, - ) - self.join = async_to_raw_response_wrapper( - rooms.join, - ) - self.leave = async_to_raw_response_wrapper( - rooms.leave, - ) - - @cached_property - def account_data(self) -> AsyncAccountDataResourceWithRawResponse: - return AsyncAccountDataResourceWithRawResponse(self._rooms.account_data) - - @cached_property - def state(self) -> AsyncStateResourceWithRawResponse: - return AsyncStateResourceWithRawResponse(self._rooms.state) - - @cached_property - def events(self) -> AsyncEventsResourceWithRawResponse: - return AsyncEventsResourceWithRawResponse(self._rooms.events) - - -class RoomsResourceWithStreamingResponse: - def __init__(self, rooms: RoomsResource) -> None: - self._rooms = rooms - - self.create = to_streamed_response_wrapper( - rooms.create, - ) - self.join = to_streamed_response_wrapper( - rooms.join, - ) - self.leave = to_streamed_response_wrapper( - rooms.leave, - ) - - @cached_property - def account_data(self) -> AccountDataResourceWithStreamingResponse: - return AccountDataResourceWithStreamingResponse(self._rooms.account_data) - - @cached_property - def state(self) -> StateResourceWithStreamingResponse: - return StateResourceWithStreamingResponse(self._rooms.state) - - @cached_property - def events(self) -> EventsResourceWithStreamingResponse: - return EventsResourceWithStreamingResponse(self._rooms.events) - - -class AsyncRoomsResourceWithStreamingResponse: - def __init__(self, rooms: AsyncRoomsResource) -> None: - self._rooms = rooms - - self.create = async_to_streamed_response_wrapper( - rooms.create, - ) - self.join = async_to_streamed_response_wrapper( - rooms.join, - ) - self.leave = async_to_streamed_response_wrapper( - rooms.leave, - ) - - @cached_property - def account_data(self) -> AsyncAccountDataResourceWithStreamingResponse: - return AsyncAccountDataResourceWithStreamingResponse(self._rooms.account_data) - - @cached_property - def state(self) -> AsyncStateResourceWithStreamingResponse: - return AsyncStateResourceWithStreamingResponse(self._rooms.state) - - @cached_property - def events(self) -> AsyncEventsResourceWithStreamingResponse: - return AsyncEventsResourceWithStreamingResponse(self._rooms.events) diff --git a/src/beeper_desktop_api/resources/matrix/rooms/state.py b/src/beeper_desktop_api/resources/matrix/rooms/state.py deleted file mode 100644 index dc7f15f..0000000 --- a/src/beeper_desktop_api/resources/matrix/rooms/state.py +++ /dev/null @@ -1,294 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import path_template, maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.matrix.rooms import state_retrieve_params -from ....types.matrix.rooms.state_list_response import StateListResponse -from ....types.matrix.rooms.state_retrieve_response import StateRetrieveResponse - -__all__ = ["StateResource", "AsyncStateResource"] - - -class StateResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> StateResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return StateResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> StateResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return StateResourceWithStreamingResponse(self) - - def retrieve( - self, - state_key: str, - *, - room_id: str, - event_type: str, - format: Literal["content", "event"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StateRetrieveResponse: - """Looks up the contents of a state event in a room. - - If the user is joined to the - room then the state is taken from the current state of the room. If the user has - left the room then the state is taken from the state of the room when they left. - - Args: - format: The format to use for the returned data. `content` (the default) will return - only the content of the state event. `event` will return the entire event in the - usual format suitable for clients, including fields like event ID, sender and - timestamp. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not event_type: - raise ValueError(f"Expected a non-empty value for `event_type` but received {event_type!r}") - if not state_key: - raise ValueError(f"Expected a non-empty value for `state_key` but received {state_key!r}") - return self._get( - path_template( - "/_matrix/client/v3/rooms/{room_id}/state/{event_type}/{state_key}", - room_id=room_id, - event_type=event_type, - state_key=state_key, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"format": format}, state_retrieve_params.StateRetrieveParams), - ), - cast_to=StateRetrieveResponse, - ) - - def list( - self, - room_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, - ) -> StateListResponse: - """ - Get the state events for the current state of a room. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - return self._get( - path_template("/_matrix/client/v3/rooms/{room_id}/state", room_id=room_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=StateListResponse, - ) - - -class AsyncStateResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncStateResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncStateResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncStateResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncStateResourceWithStreamingResponse(self) - - async def retrieve( - self, - state_key: str, - *, - room_id: str, - event_type: str, - format: Literal["content", "event"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StateRetrieveResponse: - """Looks up the contents of a state event in a room. - - If the user is joined to the - room then the state is taken from the current state of the room. If the user has - left the room then the state is taken from the state of the room when they left. - - Args: - format: The format to use for the returned data. `content` (the default) will return - only the content of the state event. `event` will return the entire event in the - usual format suitable for clients, including fields like event ID, sender and - timestamp. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - if not event_type: - raise ValueError(f"Expected a non-empty value for `event_type` but received {event_type!r}") - if not state_key: - raise ValueError(f"Expected a non-empty value for `state_key` but received {state_key!r}") - return await self._get( - path_template( - "/_matrix/client/v3/rooms/{room_id}/state/{event_type}/{state_key}", - room_id=room_id, - event_type=event_type, - state_key=state_key, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"format": format}, state_retrieve_params.StateRetrieveParams), - ), - cast_to=StateRetrieveResponse, - ) - - async def list( - self, - room_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, - ) -> StateListResponse: - """ - Get the state events for the current state of a room. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not room_id: - raise ValueError(f"Expected a non-empty value for `room_id` but received {room_id!r}") - return await self._get( - path_template("/_matrix/client/v3/rooms/{room_id}/state", room_id=room_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=StateListResponse, - ) - - -class StateResourceWithRawResponse: - def __init__(self, state: StateResource) -> None: - self._state = state - - self.retrieve = to_raw_response_wrapper( - state.retrieve, - ) - self.list = to_raw_response_wrapper( - state.list, - ) - - -class AsyncStateResourceWithRawResponse: - def __init__(self, state: AsyncStateResource) -> None: - self._state = state - - self.retrieve = async_to_raw_response_wrapper( - state.retrieve, - ) - self.list = async_to_raw_response_wrapper( - state.list, - ) - - -class StateResourceWithStreamingResponse: - def __init__(self, state: StateResource) -> None: - self._state = state - - self.retrieve = to_streamed_response_wrapper( - state.retrieve, - ) - self.list = to_streamed_response_wrapper( - state.list, - ) - - -class AsyncStateResourceWithStreamingResponse: - def __init__(self, state: AsyncStateResource) -> None: - self._state = state - - self.retrieve = async_to_streamed_response_wrapper( - state.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - state.list, - ) diff --git a/src/beeper_desktop_api/resources/matrix/users/__init__.py b/src/beeper_desktop_api/resources/matrix/users/__init__.py deleted file mode 100644 index 84ad0d9..0000000 --- a/src/beeper_desktop_api/resources/matrix/users/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .account_data import ( - AccountDataResource, - AsyncAccountDataResource, - AccountDataResourceWithRawResponse, - AsyncAccountDataResourceWithRawResponse, - AccountDataResourceWithStreamingResponse, - AsyncAccountDataResourceWithStreamingResponse, -) - -__all__ = [ - "AccountDataResource", - "AsyncAccountDataResource", - "AccountDataResourceWithRawResponse", - "AsyncAccountDataResourceWithRawResponse", - "AccountDataResourceWithStreamingResponse", - "AsyncAccountDataResourceWithStreamingResponse", - "UsersResource", - "AsyncUsersResource", - "UsersResourceWithRawResponse", - "AsyncUsersResourceWithRawResponse", - "UsersResourceWithStreamingResponse", - "AsyncUsersResourceWithStreamingResponse", -] diff --git a/src/beeper_desktop_api/resources/matrix/users/account_data.py b/src/beeper_desktop_api/resources/matrix/users/account_data.py deleted file mode 100644 index 2c8a316..0000000 --- a/src/beeper_desktop_api/resources/matrix/users/account_data.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._utils import path_template, 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.matrix.users import account_data_update_params - -__all__ = ["AccountDataResource", "AsyncAccountDataResource"] - - -class AccountDataResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AccountDataResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AccountDataResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AccountDataResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AccountDataResourceWithStreamingResponse(self) - - def retrieve( - self, - type: str, - *, - user_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, - ) -> object: - """Get some account data for the client. - - This config is only visible to the user - that set the account data. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return self._get( - path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - def update( - self, - type: str, - *, - user_id: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """Set some account data for the client. - - This config is only visible to the user - that set the account data. The config will be available to clients through the - top-level `account_data` field in the homeserver response to - [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return self._put( - path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), - body=maybe_transform(body, account_data_update_params.AccountDataUpdateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class AsyncAccountDataResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAccountDataResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncAccountDataResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAccountDataResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncAccountDataResourceWithStreamingResponse(self) - - async def retrieve( - self, - type: str, - *, - user_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, - ) -> object: - """Get some account data for the client. - - This config is only visible to the user - that set the account data. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return await self._get( - path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - async def update( - self, - type: str, - *, - user_id: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """Set some account data for the client. - - This config is only visible to the user - that set the account data. The config will be available to clients through the - top-level `account_data` field in the homeserver response to - [/sync](https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv3sync). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - if not type: - raise ValueError(f"Expected a non-empty value for `type` but received {type!r}") - return await self._put( - path_template("/_matrix/client/v3/user/{user_id}/account_data/{type}", user_id=user_id, type=type), - body=await async_maybe_transform(body, account_data_update_params.AccountDataUpdateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class AccountDataResourceWithRawResponse: - def __init__(self, account_data: AccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = to_raw_response_wrapper( - account_data.retrieve, - ) - self.update = to_raw_response_wrapper( - account_data.update, - ) - - -class AsyncAccountDataResourceWithRawResponse: - def __init__(self, account_data: AsyncAccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = async_to_raw_response_wrapper( - account_data.retrieve, - ) - self.update = async_to_raw_response_wrapper( - account_data.update, - ) - - -class AccountDataResourceWithStreamingResponse: - def __init__(self, account_data: AccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = to_streamed_response_wrapper( - account_data.retrieve, - ) - self.update = to_streamed_response_wrapper( - account_data.update, - ) - - -class AsyncAccountDataResourceWithStreamingResponse: - def __init__(self, account_data: AsyncAccountDataResource) -> None: - self._account_data = account_data - - self.retrieve = async_to_streamed_response_wrapper( - account_data.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - account_data.update, - ) diff --git a/src/beeper_desktop_api/resources/matrix/users/users.py b/src/beeper_desktop_api/resources/matrix/users/users.py deleted file mode 100644 index f7bdfb6..0000000 --- a/src/beeper_desktop_api/resources/matrix/users/users.py +++ /dev/null @@ -1,196 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._utils import path_template -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .account_data import ( - AccountDataResource, - AsyncAccountDataResource, - AccountDataResourceWithRawResponse, - AsyncAccountDataResourceWithRawResponse, - AccountDataResourceWithStreamingResponse, - AsyncAccountDataResourceWithStreamingResponse, -) -from ...._base_client import make_request_options -from ....types.matrix.user_retrieve_profile_response import UserRetrieveProfileResponse - -__all__ = ["UsersResource", "AsyncUsersResource"] - - -class UsersResource(SyncAPIResource): - @cached_property - def account_data(self) -> AccountDataResource: - return AccountDataResource(self._client) - - @cached_property - def with_raw_response(self) -> UsersResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return UsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return UsersResourceWithStreamingResponse(self) - - def retrieve_profile( - self, - user_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, - ) -> UserRetrieveProfileResponse: - """ - Get the complete profile for a user. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return self._get( - path_template("/_matrix/client/v3/profile/{user_id}", user_id=user_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UserRetrieveProfileResponse, - ) - - -class AsyncUsersResource(AsyncAPIResource): - @cached_property - def account_data(self) -> AsyncAccountDataResource: - return AsyncAccountDataResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: - """ - 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncUsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response - """ - return AsyncUsersResourceWithStreamingResponse(self) - - async def retrieve_profile( - self, - user_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, - ) -> UserRetrieveProfileResponse: - """ - Get the complete profile for a user. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return await self._get( - path_template("/_matrix/client/v3/profile/{user_id}", user_id=user_id), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UserRetrieveProfileResponse, - ) - - -class UsersResourceWithRawResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.retrieve_profile = to_raw_response_wrapper( - users.retrieve_profile, - ) - - @cached_property - def account_data(self) -> AccountDataResourceWithRawResponse: - return AccountDataResourceWithRawResponse(self._users.account_data) - - -class AsyncUsersResourceWithRawResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.retrieve_profile = async_to_raw_response_wrapper( - users.retrieve_profile, - ) - - @cached_property - def account_data(self) -> AsyncAccountDataResourceWithRawResponse: - return AsyncAccountDataResourceWithRawResponse(self._users.account_data) - - -class UsersResourceWithStreamingResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.retrieve_profile = to_streamed_response_wrapper( - users.retrieve_profile, - ) - - @cached_property - def account_data(self) -> AccountDataResourceWithStreamingResponse: - return AccountDataResourceWithStreamingResponse(self._users.account_data) - - -class AsyncUsersResourceWithStreamingResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.retrieve_profile = async_to_streamed_response_wrapper( - users.retrieve_profile, - ) - - @cached_property - def account_data(self) -> AsyncAccountDataResourceWithStreamingResponse: - return AsyncAccountDataResourceWithStreamingResponse(self._users.account_data) diff --git a/src/beeper_desktop_api/resources/messages.py b/src/beeper_desktop_api/resources/messages.py index 290c923..7c4e7e6 100644 --- a/src/beeper_desktop_api/resources/messages.py +++ b/src/beeper_desktop_api/resources/messages.py @@ -70,11 +70,11 @@ def retrieve( ) -> Message: """ Retrieve a message by final message ID, pendingMessageID, or Matrix event ID. - Chat ID may be a Beeper chat ID or local chat ID. + chatID may be a Beeper chat ID or a local chat ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -117,8 +117,8 @@ def update( be edited. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -163,8 +163,8 @@ def list( Sorted by timestamp. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. cursor: Opaque pagination cursor; do not inspect. Use together with 'direction'. @@ -219,8 +219,8 @@ def delete( because messages cannot be deleted while sending. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -307,10 +307,10 @@ def search( media_types: Filter messages by media types. Use ['any'] for any media type, or specify exact types like ['video', 'image']. Omit for no media filtering. - query: Literal word search (non-semantic). Finds messages containing these EXACT words - in any order. Use single words users actually type, not concepts or phrases. - Example: use "dinner" not "dinner plans", use "sick" not "health issues". If - omitted, returns results filtered only by other parameters. + query: Literal word search. Finds messages containing these words in any order. Use + words the user actually typed, not inferred concepts. Example: use "dinner" + rather than "dinner plans". If omitted, returns results filtered only by the + other parameters. sender: Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). @@ -373,15 +373,15 @@ def send( Returns a pending message ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. attachment: Single attachment to send with the message reply_to_message_id: Provide a message ID to send this as a reply to an existing message - text: Draft text. Plain text and Markdown are converted to Matrix HTML with the same - rules used by send and edit. + text: Draft text. Plain text and Markdown are converted to Beeper rich text with the + same rules used by send and edit. extra_headers: Send extra headers @@ -446,11 +446,11 @@ async def retrieve( ) -> Message: """ Retrieve a message by final message ID, pendingMessageID, or Matrix event ID. - Chat ID may be a Beeper chat ID or local chat ID. + chatID may be a Beeper chat ID or a local chat ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -493,8 +493,8 @@ async def update( be edited. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -539,8 +539,8 @@ def list( Sorted by timestamp. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. cursor: Opaque pagination cursor; do not inspect. Use together with 'direction'. @@ -595,8 +595,8 @@ async def delete( because messages cannot be deleted while sending. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. message_id: Message ID. @@ -685,10 +685,10 @@ def search( media_types: Filter messages by media types. Use ['any'] for any media type, or specify exact types like ['video', 'image']. Omit for no media filtering. - query: Literal word search (non-semantic). Finds messages containing these EXACT words - in any order. Use single words users actually type, not concepts or phrases. - Example: use "dinner" not "dinner plans", use "sick" not "health issues". If - omitted, returns results filtered only by other parameters. + query: Literal word search. Finds messages containing these words in any order. Use + words the user actually typed, not inferred concepts. Example: use "dinner" + rather than "dinner plans". If omitted, returns results filtered only by the + other parameters. sender: Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). @@ -751,15 +751,15 @@ async def send( Returns a pending message ID. Args: - chat_id: Chat ID. Input routes also accept the local chat ID from this Beeper Desktop - installation when available. + chat_id: Chat ID. Input routes also accept the local chat ID from this installation when + available. attachment: Single attachment to send with the message reply_to_message_id: Provide a message ID to send this as a reply to an existing message - text: Draft text. Plain text and Markdown are converted to Matrix HTML with the same - rules used by send and edit. + text: Draft text. Plain text and Markdown are converted to Beeper rich text with the + same rules used by send and edit. extra_headers: Send extra headers diff --git a/src/beeper_desktop_api/types/__init__.py b/src/beeper_desktop_api/types/__init__.py index fdfcad3..61b5559 100644 --- a/src/beeper_desktop_api/types/__init__.py +++ b/src/beeper_desktop_api/types/__init__.py @@ -3,27 +3,32 @@ from __future__ import annotations from .chat import Chat as Chat +from .bridge import Bridge as Bridge from .shared import ( User as User, Error as Error, Message as Message, + APIError as APIError, Reaction as Reaction, Attachment as Attachment, AppStateSnapshot as AppStateSnapshot, ) from .account import Account as Account +from .login_flow import LoginFlow as LoginFlow +from .cookie_field import CookieField as CookieField +from .login_session import LoginSession as LoginSession +from .account_bridge import AccountBridge as AccountBridge from .focus_response import FocusResponse as FocusResponse from .search_response import SearchResponse as SearchResponse from .chat_list_params import ChatListParams as ChatListParams from .chat_start_params import ChatStartParams as ChatStartParams +from .login_input_field import LoginInputField as LoginInputField from .asset_serve_params import AssetServeParams as AssetServeParams from .chat_create_params import ChatCreateParams as ChatCreateParams from .chat_list_response import ChatListResponse as ChatListResponse from .chat_search_params import ChatSearchParams as ChatSearchParams from .chat_update_params import ChatUpdateParams as ChatUpdateParams -from .app_status_response import AppStatusResponse as AppStatusResponse from .asset_upload_params import AssetUploadParams as AssetUploadParams -from .bridge_availability import BridgeAvailability as BridgeAvailability from .chat_archive_params import ChatArchiveParams as ChatArchiveParams from .chat_start_response import ChatStartResponse as ChatStartResponse from .client_focus_params import ClientFocusParams as ClientFocusParams @@ -41,9 +46,16 @@ from .message_search_params import MessageSearchParams as MessageSearchParams from .message_send_response import MessageSendResponse as MessageSendResponse from .message_update_params import MessageUpdateParams as MessageUpdateParams +from .group_field_capability import GroupFieldCapability as GroupFieldCapability from .info_retrieve_response import InfoRetrieveResponse as InfoRetrieveResponse from .asset_download_response import AssetDownloadResponse as AssetDownloadResponse from .chat_mark_unread_params import ChatMarkUnreadParams as ChatMarkUnreadParams +from .group_type_capabilities import GroupTypeCapabilities as GroupTypeCapabilities from .message_update_response import MessageUpdateResponse as MessageUpdateResponse +from .bridge_retrieve_response import BridgeRetrieveResponse as BridgeRetrieveResponse +from .account_retrieve_response import AccountRetrieveResponse as AccountRetrieveResponse +from .provisioning_capabilities import ProvisioningCapabilities as ProvisioningCapabilities from .asset_upload_base64_params import AssetUploadBase64Params as AssetUploadBase64Params from .asset_upload_base64_response import AssetUploadBase64Response as AssetUploadBase64Response +from .disappearing_timer_capability import DisappearingTimerCapability as DisappearingTimerCapability +from .resolve_identifier_capabilities import ResolveIdentifierCapabilities as ResolveIdentifierCapabilities diff --git a/src/beeper_desktop_api/types/account.py b/src/beeper_desktop_api/types/account.py index fdc1a4b..a469ec4 100644 --- a/src/beeper_desktop_api/types/account.py +++ b/src/beeper_desktop_api/types/account.py @@ -1,35 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel from .shared.user import User +from .account_bridge import AccountBridge -__all__ = ["Account", "Bridge"] - - -class Bridge(BaseModel): - """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" - - id: str - """Bridge instance identifier. - - Matrix and cloud bridges often use the bridge type (for example matrix or - discordgo); local bridges use a local bridge ID (for example local-whatsapp). - Available in Beeper Desktop v4.2.785+. - """ - - provider: Literal["cloud", "self-hosted", "local", "platform-sdk"] - """Bridge provider for the account. Available in Beeper Desktop v4.2.785+.""" - - type: str - """Bridge type, such as matrix, discordgo, slackgo, whatsapp, telegram, or twitter. - - Available in Beeper Desktop v4.2.785+. - """ +__all__ = ["Account"] class Account(BaseModel): @@ -43,14 +23,38 @@ class Account(BaseModel): workspace-scoped cloud bridges, and local-whatsapp*ba*... for local bridges. """ - bridge: Bridge + bridge: AccountBridge """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" + status: Literal[ + "connected", + "connecting", + "backfilling", + "connection_required", + "reconnect_required", + "attention_required", + "disconnected", + "disabled", + ] + """Current connection status for this account.""" + user: User """User the account belongs to.""" + capabilities: Optional[Dict[str, Optional[object]]] = None + """Runtime chat/message capabilities for this connected account, when available.""" + + login_id: Optional[str] = FieldInfo(alias="loginID", default=None) + """Bridge login ID for this account, when known. + + One bridge login can contain multiple chat accounts. + """ + network: Optional[str] = None """Human-friendly network name for the account. Omitted when the network is unknown. """ + + status_text: Optional[str] = FieldInfo(alias="statusText", default=None) + """Human-friendly account status text.""" diff --git a/src/beeper_desktop_api/types/account_bridge.py b/src/beeper_desktop_api/types/account_bridge.py new file mode 100644 index 0000000..d507424 --- /dev/null +++ b/src/beeper_desktop_api/types/account_bridge.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["AccountBridge"] + + +class AccountBridge(BaseModel): + """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" + + id: str + """Bridge identifier. + + Beeper Cloud accounts often use the network type (for example matrix or + discordgo); on-device accounts use a local bridge ID (for example + local-whatsapp). Available in Beeper Desktop v4.2.785+. + """ + + provider: Literal["cloud", "self-hosted", "local", "platform-sdk"] + """Where this account runs: on this device or in Beeper Cloud. + + Available in Beeper Desktop v4.2.785+. + """ + + type: str + """Bridge type, such as matrix, discordgo, slackgo, whatsapp, telegram, or twitter. + + Available in Beeper Desktop v4.2.785+. + """ diff --git a/src/beeper_desktop_api/types/account_retrieve_response.py b/src/beeper_desktop_api/types/account_retrieve_response.py new file mode 100644 index 0000000..20b59e8 --- /dev/null +++ b/src/beeper_desktop_api/types/account_retrieve_response.py @@ -0,0 +1,60 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.user import User +from .account_bridge import AccountBridge + +__all__ = ["AccountRetrieveResponse"] + + +class AccountRetrieveResponse(BaseModel): + """A chat account added to Beeper.""" + + account_id: str = FieldInfo(alias="accountID") + """Chat account added to Beeper. + + Use this to route account-scoped actions. Examples include matrix for + Beeper/Matrix, discordgo for a cloud bridge, slackgo.TEAM-USER for + workspace-scoped cloud bridges, and local-whatsapp*ba*... for local bridges. + """ + + bridge: AccountBridge + """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" + + status: Literal[ + "connected", + "connecting", + "backfilling", + "connection_required", + "reconnect_required", + "attention_required", + "disconnected", + "disabled", + ] + """Current connection status for this account.""" + + user: User + """User the account belongs to.""" + + capabilities: Optional[Dict[str, Optional[object]]] = None + """Runtime chat/message capabilities for this connected account, when available.""" + + login_id: Optional[str] = FieldInfo(alias="loginID", default=None) + """Bridge login ID for this account, when known. + + One bridge login can contain multiple chat accounts. + """ + + network: Optional[str] = None + """Human-friendly network name for the account. + + Omitted when the network is unknown. + """ + + status_text: Optional[str] = FieldInfo(alias="statusText", default=None) + """Human-friendly account status text.""" diff --git a/src/beeper_desktop_api/types/accounts/contact_list_params.py b/src/beeper_desktop_api/types/accounts/contact_list_params.py index e452ddb..983aea0 100644 --- a/src/beeper_desktop_api/types/accounts/contact_list_params.py +++ b/src/beeper_desktop_api/types/accounts/contact_list_params.py @@ -21,4 +21,4 @@ class ContactListParams(TypedDict, total=False): """Maximum contacts to return per page.""" query: str - """Optional search query for blended contact lookup.""" + """Optional search query for contact lookup.""" diff --git a/src/beeper_desktop_api/types/accounts/contact_search_params.py b/src/beeper_desktop_api/types/accounts/contact_search_params.py index f9063e0..b663175 100644 --- a/src/beeper_desktop_api/types/accounts/contact_search_params.py +++ b/src/beeper_desktop_api/types/accounts/contact_search_params.py @@ -9,4 +9,4 @@ class ContactSearchParams(TypedDict, total=False): query: Required[str] - """Text to search users by. Network-specific behavior.""" + """Text to search contacts by. Matching behavior depends on the network.""" diff --git a/src/beeper_desktop_api/types/app/__init__.py b/src/beeper_desktop_api/types/app/__init__.py index bf025a8..f8ee8b1 100644 --- a/src/beeper_desktop_api/types/app/__init__.py +++ b/src/beeper_desktop_api/types/app/__init__.py @@ -1,10 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .login_email_params import LoginEmailParams as LoginEmailParams -from .login_start_response import LoginStartResponse as LoginStartResponse -from .login_register_params import LoginRegisterParams as LoginRegisterParams -from .login_response_params import LoginResponseParams as LoginResponseParams -from .login_register_response import LoginRegisterResponse as LoginRegisterResponse -from .login_response_response import LoginResponseResponse as LoginResponseResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/__init__.py b/src/beeper_desktop_api/types/app/e2ee/__init__.py deleted file mode 100644 index 2cd79cf..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .verification_cancel_params import VerificationCancelParams as VerificationCancelParams -from .verification_create_params import VerificationCreateParams as VerificationCreateParams -from .recovery_code_verify_params import RecoveryCodeVerifyParams as RecoveryCodeVerifyParams -from .verification_accept_response import VerificationAcceptResponse as VerificationAcceptResponse -from .verification_cancel_response import VerificationCancelResponse as VerificationCancelResponse -from .verification_create_response import VerificationCreateResponse as VerificationCreateResponse -from .recovery_code_verify_response import RecoveryCodeVerifyResponse as RecoveryCodeVerifyResponse -from .recovery_code_mark_backed_up_response import RecoveryCodeMarkBackedUpResponse as RecoveryCodeMarkBackedUpResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py deleted file mode 100644 index 0299c46..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .reset_create_params import ResetCreateParams as ResetCreateParams -from .reset_confirm_params import ResetConfirmParams as ResetConfirmParams -from .reset_create_response import ResetCreateResponse as ResetCreateResponse -from .reset_confirm_response import ResetConfirmResponse as ResetConfirmResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py deleted file mode 100644 index 745927e..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ....._utils import PropertyInfo - -__all__ = ["ResetConfirmParams"] - - -class ResetConfirmParams(TypedDict, total=False): - recovery_code: Required[Annotated[str, PropertyInfo(alias="recoveryCode")]] - """New recovery key returned by the reset step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py deleted file mode 100644 index 9ba8280..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_confirm_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "ResetConfirmResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class ResetConfirmResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py deleted file mode 100644 index 05928a2..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Annotated, TypedDict - -from ....._utils import PropertyInfo - -__all__ = ["ResetCreateParams"] - - -class ResetCreateParams(TypedDict, total=False): - recovery_code: Annotated[str, PropertyInfo(alias="recoveryCode")] - """Existing recovery key, if the user has it.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py deleted file mode 100644 index 8efd2b0..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code/reset_create_response.py +++ /dev/null @@ -1,173 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "ResetCreateResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after creating the new recovery key.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class ResetCreateResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after creating the new recovery key.""" - - recovery_code: str = FieldInfo(alias="recoveryCode") - """New recovery key. Show it once and ask the user to save it.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py deleted file mode 100644 index a9b8f1d..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code_mark_backed_up_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "RecoveryCodeMarkBackedUpResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class RecoveryCodeMarkBackedUpResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py deleted file mode 100644 index 9869a2d..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["RecoveryCodeVerifyParams"] - - -class RecoveryCodeVerifyParams(TypedDict, total=False): - recovery_code: Required[Annotated[str, PropertyInfo(alias="recoveryCode")]] - """Recovery key saved by the user.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py b/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py deleted file mode 100644 index 4af7794..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/recovery_code_verify_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "RecoveryCodeVerifyResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class RecoveryCodeVerifyResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/__init__.py b/src/beeper_desktop_api/types/app/e2ee/verification/__init__.py deleted file mode 100644 index d0eff7c..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .qr_scan_params import QrScanParams as QrScanParams -from .qr_scan_response import QrScanResponse as QrScanResponse -from .sa_start_response import SaStartResponse as SaStartResponse -from .sa_confirm_response import SaConfirmResponse as SaConfirmResponse -from .qr_confirm_scanned_response import QrConfirmScannedResponse as QrConfirmScannedResponse diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py deleted file mode 100644 index a2032d8..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification/qr_confirm_scanned_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "QrConfirmScannedResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class QrConfirmScannedResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py b/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py deleted file mode 100644 index a16f78e..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["QrScanParams"] - - -class QrScanParams(TypedDict, total=False): - data: Required[str] - """QR code payload scanned from the other device.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py deleted file mode 100644 index ef7014b..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification/qr_scan_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "QrScanResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class QrScanResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py deleted file mode 100644 index 9f90136..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification/sa_confirm_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "SaConfirmResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class SaConfirmResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py b/src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py deleted file mode 100644 index b68ed95..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification/sa_start_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "SaStartResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class SaStartResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py b/src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py deleted file mode 100644 index 5e3cc0e..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification_accept_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "VerificationAcceptResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class VerificationAcceptResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py b/src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py deleted file mode 100644 index d954b97..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification_cancel_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["VerificationCancelParams"] - - -class VerificationCancelParams(TypedDict, total=False): - code: str - """Optional cancellation code.""" - - reason: str - """Optional user-facing cancellation reason.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py b/src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py deleted file mode 100644 index 4f19689..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification_cancel_response.py +++ /dev/null @@ -1,170 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "VerificationCancelResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after the requested step.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class VerificationCancelResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after the requested step.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_create_params.py b/src/beeper_desktop_api/types/app/e2ee/verification_create_params.py deleted file mode 100644 index c46feac..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification_create_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["VerificationCreateParams"] - - -class VerificationCreateParams(TypedDict, total=False): - user_id: Annotated[str, PropertyInfo(alias="userID")] - """User ID to verify. Defaults to the signed-in user.""" diff --git a/src/beeper_desktop_api/types/app/e2ee/verification_create_response.py b/src/beeper_desktop_api/types/app/e2ee/verification_create_response.py deleted file mode 100644 index d5ccc58..0000000 --- a/src/beeper_desktop_api/types/app/e2ee/verification_create_response.py +++ /dev/null @@ -1,173 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "VerificationCreateResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after starting verification.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class VerificationCreateResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after starting verification.""" - - verification_id: str = FieldInfo(alias="verificationID") - """Verification ID to pass in verification action paths.""" diff --git a/tests/api_resources/matrix/__init__.py b/src/beeper_desktop_api/types/app/login/__init__.py similarity index 70% rename from tests/api_resources/matrix/__init__.py rename to src/beeper_desktop_api/types/app/login/__init__.py index fd8019a..f8ee8b1 100644 --- a/tests/api_resources/matrix/__init__.py +++ b/src/beeper_desktop_api/types/app/login/__init__.py @@ -1 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/tests/api_resources/app/e2ee/verification/__init__.py b/src/beeper_desktop_api/types/app/login/verification/__init__.py similarity index 70% rename from tests/api_resources/app/e2ee/verification/__init__.py rename to src/beeper_desktop_api/types/app/login/verification/__init__.py index fd8019a..f8ee8b1 100644 --- a/tests/api_resources/app/e2ee/verification/__init__.py +++ b/src/beeper_desktop_api/types/app/login/verification/__init__.py @@ -1 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/tests/api_resources/matrix/bridges/__init__.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key/__init__.py similarity index 70% rename from tests/api_resources/matrix/bridges/__init__.py rename to src/beeper_desktop_api/types/app/login/verification/recovery_key/__init__.py index fd8019a..f8ee8b1 100644 --- a/tests/api_resources/matrix/bridges/__init__.py +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key/__init__.py @@ -1 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/src/beeper_desktop_api/types/app/login_email_params.py b/src/beeper_desktop_api/types/app/login_email_params.py deleted file mode 100644 index bbf1d19..0000000 --- a/src/beeper_desktop_api/types/app/login_email_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["LoginEmailParams"] - - -class LoginEmailParams(TypedDict, total=False): - email: Required[str] - """Email address to send the sign-in code to.""" - - request: Required[str] - """Login request ID returned by the start step.""" diff --git a/src/beeper_desktop_api/types/app/login_register_params.py b/src/beeper_desktop_api/types/app/login_register_params.py deleted file mode 100644 index f6ea523..0000000 --- a/src/beeper_desktop_api/types/app/login_register_params.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["LoginRegisterParams"] - - -class LoginRegisterParams(TypedDict, total=False): - accept_terms: Required[Annotated[Literal[True], PropertyInfo(alias="acceptTerms")]] - """ - Confirms that the user accepted the Terms of Use and acknowledged the Privacy - Policy. - """ - - lead_token: Required[Annotated[str, PropertyInfo(alias="leadToken")]] - """Registration token returned by Beeper.""" - - request: Required[str] - """Login request ID returned by the start step.""" - - username: Required[str] - """Username selected by the user.""" diff --git a/src/beeper_desktop_api/types/app/login_register_response.py b/src/beeper_desktop_api/types/app/login_register_response.py deleted file mode 100644 index 1296355..0000000 --- a/src/beeper_desktop_api/types/app/login_register_response.py +++ /dev/null @@ -1,207 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = [ - "LoginRegisterResponse", - "AppState", - "AppStateE2ee", - "AppStateE2eeSecrets", - "AppStateMatrix", - "AppStateVerification", - "AppStateVerificationError", - "AppStateVerificationSas", - "DesktopAPI", - "Matrix", -] - - -class AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppState(BaseModel): - """Current onboarding state after sign-in.""" - - e2ee: AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[AppStateVerification] = None - """Trusted-device verification progress.""" - - -class DesktopAPI(BaseModel): - """Desktop API credentials for the signed-in app session.""" - - access_token: str = FieldInfo(alias="accessToken") - """Desktop API access token for this app session.""" - - scope: Literal["read write"] - """Granted Desktop API scopes.""" - - token_type: Literal["Bearer"] = FieldInfo(alias="tokenType") - """Access token type.""" - - -class Matrix(BaseModel): - """Account credentials for first-party app setup.""" - - access_token: str = FieldInfo(alias="accessToken") - """Account access token. Returned once for first-party app setup.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class LoginRegisterResponse(BaseModel): - app_state: AppState = FieldInfo(alias="appState") - """Current onboarding state after sign-in.""" - - desktop_api: DesktopAPI = FieldInfo(alias="desktopAPI") - """Desktop API credentials for the signed-in app session.""" - - matrix: Matrix - """Account credentials for first-party app setup.""" diff --git a/src/beeper_desktop_api/types/app/login_response_params.py b/src/beeper_desktop_api/types/app/login_response_params.py deleted file mode 100644 index f218f96..0000000 --- a/src/beeper_desktop_api/types/app/login_response_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["LoginResponseParams"] - - -class LoginResponseParams(TypedDict, total=False): - request: Required[str] - """Login request ID returned by the start step.""" - - response: Required[str] - """Sign-in code from the user email.""" diff --git a/src/beeper_desktop_api/types/app/login_response_response.py b/src/beeper_desktop_api/types/app/login_response_response.py deleted file mode 100644 index e28b77d..0000000 --- a/src/beeper_desktop_api/types/app/login_response_response.py +++ /dev/null @@ -1,246 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = [ - "LoginResponseResponse", - "UnionMember0", - "UnionMember0AppState", - "UnionMember0AppStateE2ee", - "UnionMember0AppStateE2eeSecrets", - "UnionMember0AppStateMatrix", - "UnionMember0AppStateVerification", - "UnionMember0AppStateVerificationError", - "UnionMember0AppStateVerificationSas", - "UnionMember0DesktopAPI", - "UnionMember0Matrix", - "UnionMember1", - "UnionMember1Copy", -] - - -class UnionMember0AppStateE2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class UnionMember0AppStateE2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: UnionMember0AppStateE2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class UnionMember0AppStateMatrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class UnionMember0AppStateVerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class UnionMember0AppStateVerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class UnionMember0AppStateVerification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[UnionMember0AppStateVerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[UnionMember0AppStateVerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class UnionMember0AppState(BaseModel): - """Current onboarding state after sign-in.""" - - e2ee: UnionMember0AppStateE2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[UnionMember0AppStateMatrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[UnionMember0AppStateVerification] = None - """Trusted-device verification progress.""" - - -class UnionMember0DesktopAPI(BaseModel): - """Desktop API credentials for the signed-in app session.""" - - access_token: str = FieldInfo(alias="accessToken") - """Desktop API access token for this app session.""" - - scope: Literal["read write"] - """Granted Desktop API scopes.""" - - token_type: Literal["Bearer"] = FieldInfo(alias="tokenType") - """Access token type.""" - - -class UnionMember0Matrix(BaseModel): - """Account credentials for first-party app setup.""" - - access_token: str = FieldInfo(alias="accessToken") - """Account access token. Returned once for first-party app setup.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class UnionMember0(BaseModel): - app_state: UnionMember0AppState = FieldInfo(alias="appState") - """Current onboarding state after sign-in.""" - - desktop_api: UnionMember0DesktopAPI = FieldInfo(alias="desktopAPI") - """Desktop API credentials for the signed-in app session.""" - - matrix: UnionMember0Matrix - """Account credentials for first-party app setup.""" - - -class UnionMember1Copy(BaseModel): - """Copy to display during account creation.""" - - submit: Literal["Continue"] - """Submit button label.""" - - terms: Literal["By continuing, you agree to the Terms of Use and acknowledge the Privacy Policy."] - """Terms and privacy notice to show before account creation.""" - - title: Literal["Choose your username"] - """Title for the username step.""" - - username_placeholder: Literal["Username"] = FieldInfo(alias="usernamePlaceholder") - """Placeholder for the username field.""" - - -class UnionMember1(BaseModel): - copy_: UnionMember1Copy = FieldInfo(alias="copy") - """Copy to display during account creation.""" - - lead_token: str = FieldInfo(alias="leadToken") - """Registration token returned by Beeper.""" - - registration_required: Literal[True] = FieldInfo(alias="registrationRequired") - """Indicates that the user needs to create a Beeper account.""" - - request: str - """Login request ID to use when creating the account.""" - - username_suggestions: Optional[List[str]] = FieldInfo(alias="usernameSuggestions", default=None) - """Suggested usernames for the new account.""" - - -LoginResponseResponse: TypeAlias = Union[UnionMember0, UnionMember1] diff --git a/src/beeper_desktop_api/types/app/login_start_response.py b/src/beeper_desktop_api/types/app/login_start_response.py deleted file mode 100644 index d108b0d..0000000 --- a/src/beeper_desktop_api/types/app/login_start_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["LoginStartResponse"] - - -class LoginStartResponse(BaseModel): - request: str - """Login request ID to use in the next sign-in step.""" - - type: List[str] - """Available sign-in methods for this request.""" diff --git a/tests/api_resources/app/e2ee/recovery_code/__init__.py b/src/beeper_desktop_api/types/app/verifications/__init__.py similarity index 70% rename from tests/api_resources/app/e2ee/recovery_code/__init__.py rename to src/beeper_desktop_api/types/app/verifications/__init__.py index fd8019a..f8ee8b1 100644 --- a/tests/api_resources/app/e2ee/recovery_code/__init__.py +++ b/src/beeper_desktop_api/types/app/verifications/__init__.py @@ -1 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/src/beeper_desktop_api/types/app_status_response.py b/src/beeper_desktop_api/types/app_status_response.py deleted file mode 100644 index dbc8499..0000000 --- a/src/beeper_desktop_api/types/app_status_response.py +++ /dev/null @@ -1,154 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["AppStatusResponse", "E2ee", "E2eeSecrets", "Matrix", "Verification", "VerificationError", "VerificationSas"] - - -class E2eeSecrets(BaseModel): - """Encrypted messaging keys available on this device.""" - - master_key: bool = FieldInfo(alias="masterKey") - """Whether the account identity key is available.""" - - megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") - """Whether the encrypted message backup key is available.""" - - recovery_code: bool = FieldInfo(alias="recoveryCode") - """Whether a recovery key is available.""" - - self_signing_key: bool = FieldInfo(alias="selfSigningKey") - """Whether the device trust key is available.""" - - user_signing_key: bool = FieldInfo(alias="userSigningKey") - """Whether the user trust key is available.""" - - -class E2ee(BaseModel): - """Encrypted messaging setup status.""" - - cross_signing: bool = FieldInfo(alias="crossSigning") - """Whether this account can verify trusted devices.""" - - first_sync_done: bool = FieldInfo(alias="firstSyncDone") - """Whether the first encrypted message sync is complete.""" - - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") - """Whether the user confirmed that they saved their recovery key.""" - - initialized: bool - """Whether encrypted messaging setup has started.""" - - key_backup: bool = FieldInfo(alias="keyBackup") - """Whether encrypted message backup is available.""" - - secrets: E2eeSecrets - """Encrypted messaging keys available on this device.""" - - secret_storage: bool = FieldInfo(alias="secretStorage") - """Whether secure key storage is available.""" - - verified: bool - """Whether this device is trusted for encrypted messages.""" - - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) - """Unix timestamp for when the recovery key was created.""" - - -class Matrix(BaseModel): - """Signed-in account details. Omitted until sign-in is complete.""" - - device_id: str = FieldInfo(alias="deviceID") - """Current device ID.""" - - homeserver: str - """Beeper server URL for this account.""" - - user_id: str = FieldInfo(alias="userID") - """Signed-in Beeper user ID.""" - - -class VerificationError(BaseModel): - """Verification error details, if verification stopped.""" - - code: str - """Verification error code.""" - - reason: str - """User-facing verification error message.""" - - -class VerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" - - decimals: str - """Number sequence to compare on both devices.""" - - emojis: str - """Emoji sequence to compare on both devices.""" - - -class Verification(BaseModel): - """Trusted-device verification progress.""" - - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") - """Verification actions that are valid for the current state.""" - - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] - """Current trusted-device verification state.""" - - error: Optional[VerificationError] = None - """Verification error details, if verification stopped.""" - - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) - """Other device participating in verification.""" - - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[VerificationSas] = None - """Emoji or number comparison data for verification.""" - - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" - - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" - - -class AppStatusResponse(BaseModel): - e2ee: E2ee - """Encrypted messaging setup status.""" - - state: Literal[ - "needs-login", - "initializing", - "needs-cross-signing-setup", - "needs-verification", - "needs-secrets", - "needs-first-sync", - "ready", - ] - """Current onboarding state for Beeper Desktop.""" - - matrix: Optional[Matrix] = None - """Signed-in account details. Omitted until sign-in is complete.""" - - verification: Optional[Verification] = None - """Trusted-device verification progress.""" diff --git a/src/beeper_desktop_api/types/asset_download_params.py b/src/beeper_desktop_api/types/asset_download_params.py index 62e7c02..58a04a1 100644 --- a/src/beeper_desktop_api/types/asset_download_params.py +++ b/src/beeper_desktop_api/types/asset_download_params.py @@ -9,4 +9,4 @@ class AssetDownloadParams(TypedDict, total=False): url: Required[str] - """Matrix content URL (mxc:// or localmxc://) for the file to download.""" + """Beeper media URL (mxc:// or localmxc://) for the file to download.""" diff --git a/src/beeper_desktop_api/types/bridge.py b/src/beeper_desktop_api/types/bridge.py new file mode 100644 index 0000000..38adb1b --- /dev/null +++ b/src/beeper_desktop_api/types/bridge.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .account import Account +from .._models import BaseModel + +__all__ = ["Bridge"] + + +class Bridge(BaseModel): + """Available bridge that can connect or reconnect chat accounts.""" + + id: str + """Bridge ID. Use with bridge endpoints.""" + + accounts: List[Account] + """Connected accounts for this bridge. + + Uses the same Account schema as GET /v1/accounts. + """ + + active_account_count: int = FieldInfo(alias="activeAccountCount") + """Number of active accounts for this network on this device.""" + + display_name: str = FieldInfo(alias="displayName") + """Human-friendly bridge name shown in Beeper.""" + + provider: Literal["cloud", "self-hosted", "local", "platform-sdk"] + """Where accounts for this bridge run: on this device or in Beeper Cloud.""" + + status: Literal["available", "connected", "limit_reached", "temporarily_unavailable", "disabled"] + """Whether this bridge can currently be used to connect new accounts.""" + + supports_multiple_accounts: bool = FieldInfo(alias="supportsMultipleAccounts") + """Whether this bridge can have multiple active accounts for the same network.""" + + type: str + """ + Underlying bridge type, such as matrix, discordgo, slackgo, whatsapp, telegram, + or twitter. + """ + + network: Optional[str] = None + """Network grouping used for account counts and limits.""" + + status_text: Optional[str] = FieldInfo(alias="statusText", default=None) + """Human-friendly status text matching Beeper account management language.""" diff --git a/src/beeper_desktop_api/types/bridge_availability.py b/src/beeper_desktop_api/types/bridge_availability.py deleted file mode 100644 index abf7746..0000000 --- a/src/beeper_desktop_api/types/bridge_availability.py +++ /dev/null @@ -1,63 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .account import Account -from .._models import BaseModel - -__all__ = ["BridgeAvailability", "Bridge"] - - -class Bridge(BaseModel): - """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" - - id: str - """Bridge instance identifier. - - Matrix and cloud bridges often use the bridge type (for example matrix or - discordgo); local bridges use a local bridge ID (for example local-whatsapp). - Available in Beeper Desktop v4.2.785+. - """ - - provider: Literal["cloud", "self-hosted", "local", "platform-sdk"] - """Bridge provider for the account. Available in Beeper Desktop v4.2.785+.""" - - type: str - """Bridge type, such as matrix, discordgo, slackgo, whatsapp, telegram, or twitter. - - Available in Beeper Desktop v4.2.785+. - """ - - -class BridgeAvailability(BaseModel): - """Bridge-backed account type that can be shown in add-account flows.""" - - accounts: List[Account] - """Connected accounts for this bridge. - - Uses the same Account schema as GET /v1/accounts. - """ - - active_account_count: int = FieldInfo(alias="activeAccountCount") - """Number of active accounts for this network on this device.""" - - bridge: Bridge - """Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.""" - - display_name: str = FieldInfo(alias="displayName") - """Human-friendly account type name shown in Beeper Desktop.""" - - login_mode: str = FieldInfo(alias="loginMode") - """Login mode used by Beeper Desktop for this bridge.""" - - status: Literal["available", "connected", "limit_reached", "temporarily_unavailable"] - """Whether this bridge can currently be used to add an account.""" - - network: Optional[str] = None - """Network grouping used for account counts and limits.""" - - status_text: Optional[str] = FieldInfo(alias="statusText", default=None) - """Human-friendly status text matching Beeper Desktop account management language.""" diff --git a/src/beeper_desktop_api/types/bridge_list_response.py b/src/beeper_desktop_api/types/bridge_list_response.py index fc09661..ed0d497 100644 --- a/src/beeper_desktop_api/types/bridge_list_response.py +++ b/src/beeper_desktop_api/types/bridge_list_response.py @@ -2,13 +2,13 @@ from typing import List +from .bridge import Bridge from .._models import BaseModel -from .bridge_availability import BridgeAvailability __all__ = ["BridgeListResponse"] class BridgeListResponse(BaseModel): - """Bridge-backed account types and their connected accounts.""" + """Available bridges and their connected accounts.""" - items: List[BridgeAvailability] + items: List[Bridge] diff --git a/src/beeper_desktop_api/types/bridge_retrieve_response.py b/src/beeper_desktop_api/types/bridge_retrieve_response.py new file mode 100644 index 0000000..89b4512 --- /dev/null +++ b/src/beeper_desktop_api/types/bridge_retrieve_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .account import Account +from .._models import BaseModel + +__all__ = ["BridgeRetrieveResponse"] + + +class BridgeRetrieveResponse(BaseModel): + """Available bridge that can connect or reconnect chat accounts.""" + + id: str + """Bridge ID. Use with bridge endpoints.""" + + accounts: List[Account] + """Connected accounts for this bridge. + + Uses the same Account schema as GET /v1/accounts. + """ + + active_account_count: int = FieldInfo(alias="activeAccountCount") + """Number of active accounts for this network on this device.""" + + display_name: str = FieldInfo(alias="displayName") + """Human-friendly bridge name shown in Beeper.""" + + provider: Literal["cloud", "self-hosted", "local", "platform-sdk"] + """Where accounts for this bridge run: on this device or in Beeper Cloud.""" + + status: Literal["available", "connected", "limit_reached", "temporarily_unavailable", "disabled"] + """Whether this bridge can currently be used to connect new accounts.""" + + supports_multiple_accounts: bool = FieldInfo(alias="supportsMultipleAccounts") + """Whether this bridge can have multiple active accounts for the same network.""" + + type: str + """ + Underlying bridge type, such as matrix, discordgo, slackgo, whatsapp, telegram, + or twitter. + """ + + network: Optional[str] = None + """Network grouping used for account counts and limits.""" + + status_text: Optional[str] = FieldInfo(alias="statusText", default=None) + """Human-friendly status text matching Beeper account management language.""" diff --git a/src/beeper_desktop_api/types/bridges/__init__.py b/src/beeper_desktop_api/types/bridges/__init__.py new file mode 100644 index 0000000..4efdabc --- /dev/null +++ b/src/beeper_desktop_api/types/bridges/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .login_flow_list_response import LoginFlowListResponse as LoginFlowListResponse +from .login_session_create_params import LoginSessionCreateParams as LoginSessionCreateParams +from .login_session_cancel_response import LoginSessionCancelResponse as LoginSessionCancelResponse diff --git a/src/beeper_desktop_api/types/bridges/login_flow_list_response.py b/src/beeper_desktop_api/types/bridges/login_flow_list_response.py new file mode 100644 index 0000000..1d625e3 --- /dev/null +++ b/src/beeper_desktop_api/types/bridges/login_flow_list_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from ..login_flow import LoginFlow + +__all__ = ["LoginFlowListResponse"] + + +class LoginFlowListResponse(BaseModel): + items: List[LoginFlow] diff --git a/src/beeper_desktop_api/types/bridges/login_session_cancel_response.py b/src/beeper_desktop_api/types/bridges/login_session_cancel_response.py new file mode 100644 index 0000000..a3aaee6 --- /dev/null +++ b/src/beeper_desktop_api/types/bridges/login_session_cancel_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LoginSessionCancelResponse"] + + +class LoginSessionCancelResponse(BaseModel): + bridge_id: str = FieldInfo(alias="bridgeID") + + login_session_id: str = FieldInfo(alias="loginSessionID") + + status: Literal["cancelled"] diff --git a/src/beeper_desktop_api/types/bridges/login_session_create_params.py b/src/beeper_desktop_api/types/bridges/login_session_create_params.py new file mode 100644 index 0000000..8da4234 --- /dev/null +++ b/src/beeper_desktop_api/types/bridges/login_session_create_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LoginSessionCreateParams"] + + +class LoginSessionCreateParams(TypedDict, total=False): + account_id: Annotated[str, PropertyInfo(alias="accountID")] + """Existing chat account ID to reconnect. Omit to connect a new account.""" + + flow_id: Annotated[str, PropertyInfo(alias="flowID")] + """Optional flow ID returned by the list login flows endpoint. + + If omitted, Beeper chooses the default flow. + """ + + login_id: Annotated[str, PropertyInfo(alias="loginID")] + """Existing bridge login ID to reconnect. Omit to connect a new account.""" diff --git a/src/beeper_desktop_api/types/matrix/users/__init__.py b/src/beeper_desktop_api/types/bridges/login_sessions/__init__.py similarity index 57% rename from src/beeper_desktop_api/types/matrix/users/__init__.py rename to src/beeper_desktop_api/types/bridges/login_sessions/__init__.py index 65bf6e2..a83b5fb 100644 --- a/src/beeper_desktop_api/types/matrix/users/__init__.py +++ b/src/beeper_desktop_api/types/bridges/login_sessions/__init__.py @@ -2,4 +2,4 @@ from __future__ import annotations -from .account_data_update_params import AccountDataUpdateParams as AccountDataUpdateParams +from .step_submit_params import StepSubmitParams as StepSubmitParams diff --git a/src/beeper_desktop_api/types/bridges/login_sessions/step_submit_params.py b/src/beeper_desktop_api/types/bridges/login_sessions/step_submit_params.py new file mode 100644 index 0000000..e099810 --- /dev/null +++ b/src/beeper_desktop_api/types/bridges/login_sessions/step_submit_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["StepSubmitParams"] + + +class StepSubmitParams(TypedDict, total=False): + bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] + """Bridge ID.""" + + login_session_id: Required[Annotated[str, PropertyInfo(alias="loginSessionID")]] + """Temporary bridge login session ID.""" + + type: Required[Literal["user_input", "cookies", "display_and_wait"]] + + fields: Dict[str, str] + """Field values keyed by the field IDs from the current step.""" + + last_url: Annotated[str, PropertyInfo(alias="lastURL")] + """Last browser URL reached during a cookies step, if available.""" + + source: Literal["api", "webview", "browser_extension"] + """How the step was completed. + + Omit unless the client needs to distinguish an embedded webview or browser + extension. + """ diff --git a/src/beeper_desktop_api/types/chat.py b/src/beeper_desktop_api/types/chat.py index 4cd922c..788c891 100644 --- a/src/beeper_desktop_api/types/chat.py +++ b/src/beeper_desktop_api/types/chat.py @@ -38,7 +38,7 @@ class ParticipantsItem(User): """True if this participant has admin privileges in the chat.""" is_network_bot: Optional[bool] = FieldInfo(alias="isNetworkBot", default=None) - """True if this participant represents a network or bridge bot.""" + """True if this participant represents an automated network account.""" is_pending: Optional[bool] = FieldInfo(alias="isPending", default=None) """True if this participant has been invited but has not joined yet.""" @@ -370,7 +370,7 @@ class Draft(BaseModel): """Current draft object for this chat, or null when no draft is set.""" text: str - """Matrix HTML draft body.""" + """Rich-text draft body as returned by Beeper.""" attachments: Optional[Dict[str, DraftAttachments]] = None """Draft attachments keyed by attachment ID.""" @@ -455,7 +455,7 @@ class Chat(BaseModel): """Last read message sortKey.""" local_chat_id: Optional[str] = FieldInfo(alias="localChatID", default=None) - """Local chat ID specific to this Beeper Desktop installation.""" + """Local chat ID specific to this installation.""" message_expiry_seconds: Optional[int] = FieldInfo(alias="messageExpirySeconds", default=None) """Disappearing-message timer in seconds when available.""" diff --git a/src/beeper_desktop_api/types/chat_search_params.py b/src/beeper_desktop_api/types/chat_search_params.py index 661e9de..b3d8876 100644 --- a/src/beeper_desktop_api/types/chat_search_params.py +++ b/src/beeper_desktop_api/types/chat_search_params.py @@ -14,10 +14,7 @@ class ChatSearchParams(TypedDict, total=False): account_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="accountIDs")] - """ - Provide an array of account IDs to filter chats from specific messaging accounts - only - """ + """Limit results to specific chat accounts.""" cursor: str """Opaque pagination cursor; do not inspect. Use together with 'direction'.""" @@ -41,25 +38,19 @@ class ChatSearchParams(TypedDict, total=False): """ last_activity_after: Annotated[Union[str, datetime], PropertyInfo(alias="lastActivityAfter", format="iso8601")] - """ - Provide an ISO datetime string to only retrieve chats with last activity after - this time - """ + """Only include chats with last activity after this ISO 8601 datetime.""" last_activity_before: Annotated[Union[str, datetime], PropertyInfo(alias="lastActivityBefore", format="iso8601")] - """ - Provide an ISO datetime string to only retrieve chats with last activity before - this time - """ + """Only include chats with last activity before this ISO 8601 datetime.""" limit: int """Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50""" query: str - """Literal token search (non-semantic). + """Literal chat search. - Use single words users type (e.g., "dinner"). When multiple words provided, ALL - must match. Case-insensitive. + Use words the user typed, such as "dinner". When multiple words are provided, + all must match. Case-insensitive. """ scope: Literal["titles", "participants"] diff --git a/src/beeper_desktop_api/types/chat_start_params.py b/src/beeper_desktop_api/types/chat_start_params.py index e70216d..69030f1 100644 --- a/src/beeper_desktop_api/types/chat_start_params.py +++ b/src/beeper_desktop_api/types/chat_start_params.py @@ -14,7 +14,7 @@ class ChatStartParams(TypedDict, total=False): """Account to create or start the chat on.""" user: Required[User] - """Merged user-like contact payload used to resolve the best identifier.""" + """Contact-like user payload used to resolve the best identifier.""" allow_invite: Annotated[bool, PropertyInfo(alias="allowInvite")] """Whether invite-based DM creation is allowed when required by the platform.""" @@ -24,7 +24,7 @@ class ChatStartParams(TypedDict, total=False): class User(TypedDict, total=False): - """Merged user-like contact payload used to resolve the best identifier.""" + """Contact-like user payload used to resolve the best identifier.""" id: str """Known user ID when available.""" diff --git a/src/beeper_desktop_api/types/chat_update_params.py b/src/beeper_desktop_api/types/chat_update_params.py index d485a1b..1e6da03 100644 --- a/src/beeper_desktop_api/types/chat_update_params.py +++ b/src/beeper_desktop_api/types/chat_update_params.py @@ -95,8 +95,8 @@ class Draft(TypedDict, total=False): text: Required[str] """Draft text. - Plain text and Markdown are converted to Matrix HTML with the same rules used by - send and edit. + Plain text and Markdown are converted to Beeper rich text with the same rules + used by send and edit. """ attachments: Dict[str, DraftAttachments] diff --git a/src/beeper_desktop_api/types/chats/messages/reaction_add_params.py b/src/beeper_desktop_api/types/chats/messages/reaction_add_params.py index 976e0a0..24b3585 100644 --- a/src/beeper_desktop_api/types/chats/messages/reaction_add_params.py +++ b/src/beeper_desktop_api/types/chats/messages/reaction_add_params.py @@ -13,8 +13,8 @@ class ReactionAddParams(TypedDict, total=False): chat_id: Required[Annotated[str, PropertyInfo(alias="chatID")]] """Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop installation - when available. + Input routes also accept the local chat ID from this installation when + available. """ reaction_key: Required[Annotated[str, PropertyInfo(alias="reactionKey")]] diff --git a/src/beeper_desktop_api/types/chats/messages/reaction_add_response.py b/src/beeper_desktop_api/types/chats/messages/reaction_add_response.py index 3e0a638..d465e10 100644 --- a/src/beeper_desktop_api/types/chats/messages/reaction_add_response.py +++ b/src/beeper_desktop_api/types/chats/messages/reaction_add_response.py @@ -13,8 +13,8 @@ class ReactionAddResponse(BaseModel): chat_id: str = FieldInfo(alias="chatID") """Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop installation - when available. + Input routes also accept the local chat ID from this installation when + available. """ message_id: str = FieldInfo(alias="messageID") diff --git a/src/beeper_desktop_api/types/chats/messages/reaction_delete_response.py b/src/beeper_desktop_api/types/chats/messages/reaction_delete_response.py index 196a739..48b65de 100644 --- a/src/beeper_desktop_api/types/chats/messages/reaction_delete_response.py +++ b/src/beeper_desktop_api/types/chats/messages/reaction_delete_response.py @@ -13,8 +13,8 @@ class ReactionDeleteResponse(BaseModel): chat_id: str = FieldInfo(alias="chatID") """Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop installation - when available. + Input routes also accept the local chat ID from this installation when + available. """ message_id: str = FieldInfo(alias="messageID") diff --git a/src/beeper_desktop_api/types/client_focus_params.py b/src/beeper_desktop_api/types/client_focus_params.py index df3106f..c8e0d9d 100644 --- a/src/beeper_desktop_api/types/client_focus_params.py +++ b/src/beeper_desktop_api/types/client_focus_params.py @@ -17,7 +17,7 @@ class ClientFocusParams(TypedDict, total=False): """ draft_attachment_path: Annotated[str, PropertyInfo(alias="draftAttachmentPath")] - """Optional image path to populate in the message input field.""" + """Optional local image path to populate in the message input field.""" draft_text: Annotated[str, PropertyInfo(alias="draftText")] """Optional plain text to populate in the message input field.""" diff --git a/src/beeper_desktop_api/types/client_search_params.py b/src/beeper_desktop_api/types/client_search_params.py index 6135164..fb7f161 100644 --- a/src/beeper_desktop_api/types/client_search_params.py +++ b/src/beeper_desktop_api/types/client_search_params.py @@ -9,4 +9,4 @@ class ClientSearchParams(TypedDict, total=False): query: Required[str] - """User-typed search text. Literal word matching (non-semantic).""" + """User-typed search text. Uses literal word matching.""" diff --git a/src/beeper_desktop_api/types/cookie_field.py b/src/beeper_desktop_api/types/cookie_field.py new file mode 100644 index 0000000..5c20149 --- /dev/null +++ b/src/beeper_desktop_api/types/cookie_field.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["CookieField"] + + +class CookieField(BaseModel): + id: str + """Field ID to send back in the fields object.""" + + name: Optional[str] = None + """Cookie, header, or local storage key to collect.""" + + type: Optional[Literal["cookie", "header", "local_storage"]] = None + """Browser storage source for this value.""" diff --git a/src/beeper_desktop_api/types/disappearing_timer_capability.py b/src/beeper_desktop_api/types/disappearing_timer_capability.py new file mode 100644 index 0000000..9e86c25 --- /dev/null +++ b/src/beeper_desktop_api/types/disappearing_timer_capability.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["DisappearingTimerCapability"] + + +class DisappearingTimerCapability(BaseModel): + """Disappearing-message timer capability.""" + + types: List[Literal["", "after_read", "after_send"]] + + omit_empty_timer: Optional[Literal[True]] = None + + timers: Optional[List[int]] = None diff --git a/src/beeper_desktop_api/types/group_field_capability.py b/src/beeper_desktop_api/types/group_field_capability.py new file mode 100644 index 0000000..2ecbb92 --- /dev/null +++ b/src/beeper_desktop_api/types/group_field_capability.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .disappearing_timer_capability import DisappearingTimerCapability + +__all__ = ["GroupFieldCapability"] + + +class GroupFieldCapability(BaseModel): + """Group creation field capability.""" + + allowed: bool + + max_length: Optional[int] = None + + min_length: Optional[int] = None + + required: Optional[bool] = None + + settings: Optional[DisappearingTimerCapability] = None + """Disappearing-message timer capability.""" diff --git a/src/beeper_desktop_api/types/group_type_capabilities.py b/src/beeper_desktop_api/types/group_type_capabilities.py new file mode 100644 index 0000000..abb841f --- /dev/null +++ b/src/beeper_desktop_api/types/group_type_capabilities.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .group_field_capability import GroupFieldCapability + +__all__ = ["GroupTypeCapabilities"] + + +class GroupTypeCapabilities(BaseModel): + """Group creation capabilities for one group type.""" + + type_description: str + + avatar: Optional[GroupFieldCapability] = None + """Group creation field capability.""" + + disappear: Optional[GroupFieldCapability] = None + """Group creation field capability.""" + + name: Optional[GroupFieldCapability] = None + """Group creation field capability.""" + + parent: Optional[GroupFieldCapability] = None + """Group creation field capability.""" + + participants: Optional[GroupFieldCapability] = None + """Group creation field capability.""" + + topic: Optional[GroupFieldCapability] = None + """Group creation field capability.""" + + username: Optional[GroupFieldCapability] = None + """Group creation field capability.""" diff --git a/src/beeper_desktop_api/types/info_retrieve_response.py b/src/beeper_desktop_api/types/info_retrieve_response.py index 9a643aa..74124de 100644 --- a/src/beeper_desktop_api/types/info_retrieve_response.py +++ b/src/beeper_desktop_api/types/info_retrieve_response.py @@ -64,7 +64,7 @@ class Platform(BaseModel): class Server(BaseModel): base_url: str - """Base URL of the Beeper Desktop API server""" + """Base URL of the Beeper Client API server""" hostname: str """Listening host""" diff --git a/src/beeper_desktop_api/types/login_flow.py b/src/beeper_desktop_api/types/login_flow.py new file mode 100644 index 0000000..fe0c71b --- /dev/null +++ b/src/beeper_desktop_api/types/login_flow.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel + +__all__ = ["LoginFlow"] + + +class LoginFlow(BaseModel): + """Connect or reconnect flow option for a bridge.""" + + id: str + """Flow ID to pass when creating a bridge login session.""" + + description: Optional[str] = None + """Short explanation for when to use this flow, when provided.""" + + name: Optional[str] = None + """Display name for the flow, when provided.""" diff --git a/src/beeper_desktop_api/types/login_input_field.py b/src/beeper_desktop_api/types/login_input_field.py new file mode 100644 index 0000000..4407f27 --- /dev/null +++ b/src/beeper_desktop_api/types/login_input_field.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["LoginInputField"] + + +class LoginInputField(BaseModel): + id: str + """Field ID to send back in the fields object.""" + + initial_value: Optional[str] = FieldInfo(alias="initialValue", default=None) + """Initial field value, when provided by the network.""" + + label: Optional[str] = None + """Field label to show to the user.""" + + optional: Optional[bool] = None + """True if the user can leave this field empty.""" + + placeholder: Optional[str] = None + """Placeholder text to show when the field is empty.""" + + type: Optional[str] = None + """Suggested input type, such as text, password, or email.""" diff --git a/src/beeper_desktop_api/types/login_session.py b/src/beeper_desktop_api/types/login_session.py new file mode 100644 index 0000000..1a5fe9f --- /dev/null +++ b/src/beeper_desktop_api/types/login_session.py @@ -0,0 +1,207 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo + +from .account import Account +from .._models import BaseModel +from .shared.user import User +from .cookie_field import CookieField +from .shared.api_error import APIError +from .login_input_field import LoginInputField + +__all__ = [ + "LoginSession", + "CurrentStep", + "CurrentStepUserInput", + "CurrentStepCookies", + "CurrentStepDisplayAndWait", + "CurrentStepDisplayAndWaitDisplay", + "CurrentStepDisplayAndWaitDisplayQrCode", + "CurrentStepDisplayAndWaitDisplayEmoji", + "CurrentStepDisplayAndWaitDisplayEmpty", + "CurrentStepComplete", + "CurrentStepCompleteLogin", + "Login", +] + + +class CurrentStepUserInput(BaseModel): + fields: List[LoginInputField] + + step_id: str = FieldInfo(alias="stepID") + + type: Literal["user_input"] + + attachments: Optional[List[Optional[object]]] = None + + instructions: Optional[str] = None + """User-facing instructions for this step.""" + + +class CurrentStepCookies(BaseModel): + fields: List[CookieField] + + step_id: str = FieldInfo(alias="stepID") + + type: Literal["cookies"] + + url: str + """URL to open for the user.""" + + expected_final_url_regex: Optional[str] = FieldInfo(alias="expectedFinalURLRegex", default=None) + """Regular expression that identifies the final URL after sign-in.""" + + extract_js: Optional[str] = FieldInfo(alias="extractJS", default=None) + """Optional extraction script for browser-based sign-in helpers. + + Treat as an opaque helper value. + """ + + instructions: Optional[str] = None + """User-facing instructions for this browser step.""" + + user_agent: Optional[str] = FieldInfo(alias="userAgent", default=None) + """Suggested user agent for the browser session.""" + + +class CurrentStepDisplayAndWaitDisplayQrCode(BaseModel): + data: str + + type: Literal["qr"] + + +class CurrentStepDisplayAndWaitDisplayEmoji(BaseModel): + image_url: str = FieldInfo(alias="imageURL") + + type: Literal["emoji"] + + +class CurrentStepDisplayAndWaitDisplayEmpty(BaseModel): + type: Literal["nothing"] + + +CurrentStepDisplayAndWaitDisplay: TypeAlias = Union[ + CurrentStepDisplayAndWaitDisplayQrCode, CurrentStepDisplayAndWaitDisplayEmoji, CurrentStepDisplayAndWaitDisplayEmpty +] + + +class CurrentStepDisplayAndWait(BaseModel): + display: CurrentStepDisplayAndWaitDisplay + + step_id: str = FieldInfo(alias="stepID") + + type: Literal["display_and_wait"] + + instructions: Optional[str] = None + """User-facing instructions for this step.""" + + +class CurrentStepCompleteLogin(BaseModel): + """Signed-in identity for a bridge. + + One bridge login can contain multiple chat accounts. + """ + + bridge_id: str = FieldInfo(alias="bridgeID") + """Bridge ID.""" + + login_id: str = FieldInfo(alias="loginID") + """Bridge login ID.""" + + remove_scopes: List[Literal["current-device", "all-devices"]] = FieldInfo(alias="removeScopes") + + status: Literal["connected", "connecting", "needs_login", "logged_out", "unknown"] + + account_ids: Optional[List[str]] = FieldInfo(alias="accountIDs", default=None) + """Chat accounts that belong to this bridge login, when known.""" + + status_text: Optional[str] = FieldInfo(alias="statusText", default=None) + """Human-friendly bridge login status text.""" + + user: Optional[User] = None + """User the account belongs to.""" + + +class CurrentStepComplete(BaseModel): + type: Literal["complete"] + + account: Optional[Account] = None + """A chat account added to Beeper.""" + + instructions: Optional[str] = None + """Completion instructions, when provided.""" + + login: Optional[CurrentStepCompleteLogin] = None + """Signed-in identity for a bridge. + + One bridge login can contain multiple chat accounts. + """ + + step_id: Optional[str] = FieldInfo(alias="stepID", default=None) + + +CurrentStep: TypeAlias = Union[CurrentStepUserInput, CurrentStepCookies, CurrentStepDisplayAndWait, CurrentStepComplete] + + +class Login(BaseModel): + """Signed-in identity for a bridge. + + One bridge login can contain multiple chat accounts. + """ + + bridge_id: str = FieldInfo(alias="bridgeID") + """Bridge ID.""" + + login_id: str = FieldInfo(alias="loginID") + """Bridge login ID.""" + + remove_scopes: List[Literal["current-device", "all-devices"]] = FieldInfo(alias="removeScopes") + + status: Literal["connected", "connecting", "needs_login", "logged_out", "unknown"] + + account_ids: Optional[List[str]] = FieldInfo(alias="accountIDs", default=None) + """Chat accounts that belong to this bridge login, when known.""" + + status_text: Optional[str] = FieldInfo(alias="statusText", default=None) + """Human-friendly bridge login status text.""" + + user: Optional[User] = None + """User the account belongs to.""" + + +class LoginSession(BaseModel): + bridge_id: str = FieldInfo(alias="bridgeID") + """Bridge ID.""" + + login_session_id: str = FieldInfo(alias="loginSessionID") + """Temporary bridge login session ID.""" + + status: Literal[ + "waiting_for_input", "waiting_for_cookies", "waiting_for_display", "complete", "cancelled", "failed" + ] + + account: Optional[Account] = None + """A chat account added to Beeper.""" + + account_id: Optional[str] = FieldInfo(alias="accountID", default=None) + """Chat account ID for reconnect flows, when known.""" + + current_step: Optional[CurrentStep] = FieldInfo(alias="currentStep", default=None) + """Step the client should show or complete next. + + Omitted when the session is complete, cancelled, or failed. + """ + + error: Optional[APIError] = None + + login: Optional[Login] = None + """Signed-in identity for a bridge. + + One bridge login can contain multiple chat accounts. + """ + + login_id: Optional[str] = FieldInfo(alias="loginID", default=None) + """Bridge login ID for reconnect flows, when known.""" diff --git a/src/beeper_desktop_api/types/matrix/__init__.py b/src/beeper_desktop_api/types/matrix/__init__.py deleted file mode 100644 index 1dfecfe..0000000 --- a/src/beeper_desktop_api/types/matrix/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .room_join_params import RoomJoinParams as RoomJoinParams -from .room_leave_params import RoomLeaveParams as RoomLeaveParams -from .room_create_params import RoomCreateParams as RoomCreateParams -from .room_join_response import RoomJoinResponse as RoomJoinResponse -from .room_create_response import RoomCreateResponse as RoomCreateResponse -from .user_retrieve_profile_response import UserRetrieveProfileResponse as UserRetrieveProfileResponse diff --git a/src/beeper_desktop_api/types/matrix/bridges/__init__.py b/src/beeper_desktop_api/types/matrix/bridges/__init__.py deleted file mode 100644 index ff6da5f..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .user_search_params import UserSearchParams as UserSearchParams -from .contact_list_params import ContactListParams as ContactListParams -from .user_resolve_params import UserResolveParams as UserResolveParams -from .auth_whoami_response import AuthWhoamiResponse as AuthWhoamiResponse -from .user_search_response import UserSearchResponse as UserSearchResponse -from .contact_list_response import ContactListResponse as ContactListResponse -from .room_create_dm_params import RoomCreateDmParams as RoomCreateDmParams -from .user_resolve_response import UserResolveResponse as UserResolveResponse -from .auth_start_login_params import AuthStartLoginParams as AuthStartLoginParams -from .room_create_dm_response import RoomCreateDmResponse as RoomCreateDmResponse -from .auth_list_flows_response import AuthListFlowsResponse as AuthListFlowsResponse -from .room_create_group_params import RoomCreateGroupParams as RoomCreateGroupParams -from .auth_list_logins_response import AuthListLoginsResponse as AuthListLoginsResponse -from .auth_start_login_response import AuthStartLoginResponse as AuthStartLoginResponse -from .auth_submit_cookies_params import AuthSubmitCookiesParams as AuthSubmitCookiesParams -from .room_create_group_response import RoomCreateGroupResponse as RoomCreateGroupResponse -from .auth_wait_for_step_response import AuthWaitForStepResponse as AuthWaitForStepResponse -from .auth_submit_cookies_response import AuthSubmitCookiesResponse as AuthSubmitCookiesResponse -from .capability_retrieve_response import CapabilityRetrieveResponse as CapabilityRetrieveResponse -from .auth_submit_user_input_params import AuthSubmitUserInputParams as AuthSubmitUserInputParams -from .auth_submit_user_input_response import AuthSubmitUserInputResponse as AuthSubmitUserInputResponse diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py deleted file mode 100644 index 05de99c..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_list_flows_response.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["AuthListFlowsResponse", "Flow"] - - -class Flow(BaseModel): - """An individual login flow which can be used to sign into the remote network.""" - - id: str - """ - An internal ID that is passed to the /login/start call to start a login with - this flow. - """ - - description: str - """A human-readable description of the login flow.""" - - name: str - """A human-readable name for the login flow.""" - - -class AuthListFlowsResponse(BaseModel): - flows: Optional[List[Flow]] = None diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py deleted file mode 100644 index a0e9d3a..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_list_logins_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["AuthListLoginsResponse"] - - -class AuthListLoginsResponse(BaseModel): - login_ids: Optional[List[str]] = None diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py b/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py deleted file mode 100644 index 83368eb..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["AuthStartLoginParams"] - - -class AuthStartLoginParams(TypedDict, total=False): - bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] - - login_id: str - """An existing login ID to re-login as. - - If this is specified and the user logs into a different account, the provided ID - will be logged out. - """ diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py deleted file mode 100644 index a63c5d6..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_start_login_response.py +++ /dev/null @@ -1,278 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ...._models import BaseModel - -__all__ = [ - "AuthStartLoginResponse", - "UnionMember0", - "UnionMember0DisplayAndWait", - "UnionMember1", - "UnionMember1UserInput", - "UnionMember1UserInputField", - "UnionMember1UserInputAttachment", - "UnionMember1UserInputAttachmentInfo", - "UnionMember2", - "UnionMember2Cookies", - "UnionMember2CookiesField", - "UnionMember3", - "UnionMember3Complete", -] - - -class UnionMember0DisplayAndWait(BaseModel): - """Parameters for the display and wait login step""" - - type: Literal["qr", "emoji", "code", "nothing"] - """The type of thing to display""" - - data: Optional[str] = None - """ - The thing to display (raw data for QR, unicode emoji for emoji, plain string for - code) - """ - - image_url: Optional[str] = None - """An image containing the thing to display. - - If present, this is recommended over using data directly. For emojis, the URL to - the canonical image representation of the emoji - """ - - -class UnionMember0(BaseModel): - """Display and wait login step""" - - display_and_wait: UnionMember0DisplayAndWait - """Parameters for the display and wait login step""" - - type: Literal["display_and_wait"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember1UserInputField(BaseModel): - """A field that the user can fill.""" - - id: str - """The internal ID of the field. - - This must be used as the key in the object when submitting the data back to the - bridge. - """ - - name: str - """The name of the field shown to the user.""" - - type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] - """The type of field.""" - - default_value: Optional[str] = None - """A default value that the client can pre-fill the field with.""" - - description: Optional[str] = None - """A more detailed description of the field shown to the user.""" - - options: Optional[List[str]] = None - """For fields of type select, the valid options.""" - - pattern: Optional[str] = None - """A regular expression that the field value must match.""" - - -class UnionMember1UserInputAttachmentInfo(BaseModel): - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - h: Optional[float] = None - """The height of the media in pixels. Only applicable for images and videos.""" - - mimetype: Optional[str] = None - """The MIME type for the media content.""" - - size: Optional[float] = None - """The size of the media content in number of bytes. - - Strongly recommended to include. - """ - - w: Optional[float] = None - """The width of the media in pixels. Only applicable for images and videos.""" - - -class UnionMember1UserInputAttachment(BaseModel): - """A media attachment to show the user.""" - - content: str - """The raw file content for the attachment encoded in base64.""" - - filename: str - """The filename for the media attachment.""" - - type: Literal["m.image", "m.audio"] - """ - The type of media attachment, using the same media type identifiers as Matrix - attachments. Only some are supported. - """ - - info: Optional[UnionMember1UserInputAttachmentInfo] = None - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - -class UnionMember1UserInput(BaseModel): - """Parameters for the user input login step""" - - fields: List[UnionMember1UserInputField] - """The list of fields that the user is requested to fill.""" - - attachments: Optional[List[UnionMember1UserInputAttachment]] = None - """A list of media attachments to show the user alongside the form fields.""" - - -class UnionMember1(BaseModel): - """User input login step""" - - type: Literal["user_input"] - - user_input: UnionMember1UserInput - """Parameters for the user input login step""" - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember2CookiesField(BaseModel): - """An individual cookie or other stored data item that must be extracted.""" - - name: str - """The name of the item to extract.""" - - type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] - """The type of data to extract.""" - - cookie_domain: Optional[str] = None - """For the `cookie` type, the domain of the cookie.""" - - request_url_regex: Optional[str] = None - """ - For the `request_header` and `request_body` types, a regex that matches the URLs - from which the values can be extracted. - """ - - -class UnionMember2Cookies(BaseModel): - """Parameters for the cookie login step""" - - fields: List[UnionMember2CookiesField] - """The list of cookies or other stored data that must be extracted.""" - - url: str - """The URL to open when using a webview to extract cookies.""" - - extract_js: Optional[str] = None - """ - A JavaScript snippet that can extract some or all of the fields. The snippet - will evaluate to a promise that resolves when the relevant fields are found. - Fields that are not present in the promise result must be extracted another way. - """ - - user_agent: Optional[str] = None - """An optional user agent that the webview should use.""" - - wait_for_url_pattern: Optional[str] = None - """A regex pattern that the URL should match before the client closes the webview. - - The client may submit the login if the user closes the webview after all cookies - are collected even if this URL is not reached, but it should only automatically - close the webview after both cookies and the URL match. - """ - - -class UnionMember2(BaseModel): - """Cookie login step""" - - cookies: UnionMember2Cookies - """Parameters for the cookie login step""" - - type: Literal["cookies"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember3Complete(BaseModel): - """Information about the completed login""" - - user_login_id: Optional[str] = None - """The unique ID of a login. Defined by the network connector.""" - - -class UnionMember3(BaseModel): - """Login complete""" - - complete: UnionMember3Complete - """Information about the completed login""" - - type: Literal["complete"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -AuthStartLoginResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py deleted file mode 100644 index 21a5979..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["AuthSubmitCookiesParams"] - - -class AuthSubmitCookiesParams(TypedDict, total=False): - bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] - - login_process_id: Required[Annotated[str, PropertyInfo(alias="loginProcessID")]] - - body: Required[Dict[str, str]] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py deleted file mode 100644 index a4c0ce0..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_cookies_response.py +++ /dev/null @@ -1,278 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ...._models import BaseModel - -__all__ = [ - "AuthSubmitCookiesResponse", - "UnionMember0", - "UnionMember0DisplayAndWait", - "UnionMember1", - "UnionMember1UserInput", - "UnionMember1UserInputField", - "UnionMember1UserInputAttachment", - "UnionMember1UserInputAttachmentInfo", - "UnionMember2", - "UnionMember2Cookies", - "UnionMember2CookiesField", - "UnionMember3", - "UnionMember3Complete", -] - - -class UnionMember0DisplayAndWait(BaseModel): - """Parameters for the display and wait login step""" - - type: Literal["qr", "emoji", "code", "nothing"] - """The type of thing to display""" - - data: Optional[str] = None - """ - The thing to display (raw data for QR, unicode emoji for emoji, plain string for - code) - """ - - image_url: Optional[str] = None - """An image containing the thing to display. - - If present, this is recommended over using data directly. For emojis, the URL to - the canonical image representation of the emoji - """ - - -class UnionMember0(BaseModel): - """Display and wait login step""" - - display_and_wait: UnionMember0DisplayAndWait - """Parameters for the display and wait login step""" - - type: Literal["display_and_wait"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember1UserInputField(BaseModel): - """A field that the user can fill.""" - - id: str - """The internal ID of the field. - - This must be used as the key in the object when submitting the data back to the - bridge. - """ - - name: str - """The name of the field shown to the user.""" - - type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] - """The type of field.""" - - default_value: Optional[str] = None - """A default value that the client can pre-fill the field with.""" - - description: Optional[str] = None - """A more detailed description of the field shown to the user.""" - - options: Optional[List[str]] = None - """For fields of type select, the valid options.""" - - pattern: Optional[str] = None - """A regular expression that the field value must match.""" - - -class UnionMember1UserInputAttachmentInfo(BaseModel): - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - h: Optional[float] = None - """The height of the media in pixels. Only applicable for images and videos.""" - - mimetype: Optional[str] = None - """The MIME type for the media content.""" - - size: Optional[float] = None - """The size of the media content in number of bytes. - - Strongly recommended to include. - """ - - w: Optional[float] = None - """The width of the media in pixels. Only applicable for images and videos.""" - - -class UnionMember1UserInputAttachment(BaseModel): - """A media attachment to show the user.""" - - content: str - """The raw file content for the attachment encoded in base64.""" - - filename: str - """The filename for the media attachment.""" - - type: Literal["m.image", "m.audio"] - """ - The type of media attachment, using the same media type identifiers as Matrix - attachments. Only some are supported. - """ - - info: Optional[UnionMember1UserInputAttachmentInfo] = None - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - -class UnionMember1UserInput(BaseModel): - """Parameters for the user input login step""" - - fields: List[UnionMember1UserInputField] - """The list of fields that the user is requested to fill.""" - - attachments: Optional[List[UnionMember1UserInputAttachment]] = None - """A list of media attachments to show the user alongside the form fields.""" - - -class UnionMember1(BaseModel): - """User input login step""" - - type: Literal["user_input"] - - user_input: UnionMember1UserInput - """Parameters for the user input login step""" - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember2CookiesField(BaseModel): - """An individual cookie or other stored data item that must be extracted.""" - - name: str - """The name of the item to extract.""" - - type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] - """The type of data to extract.""" - - cookie_domain: Optional[str] = None - """For the `cookie` type, the domain of the cookie.""" - - request_url_regex: Optional[str] = None - """ - For the `request_header` and `request_body` types, a regex that matches the URLs - from which the values can be extracted. - """ - - -class UnionMember2Cookies(BaseModel): - """Parameters for the cookie login step""" - - fields: List[UnionMember2CookiesField] - """The list of cookies or other stored data that must be extracted.""" - - url: str - """The URL to open when using a webview to extract cookies.""" - - extract_js: Optional[str] = None - """ - A JavaScript snippet that can extract some or all of the fields. The snippet - will evaluate to a promise that resolves when the relevant fields are found. - Fields that are not present in the promise result must be extracted another way. - """ - - user_agent: Optional[str] = None - """An optional user agent that the webview should use.""" - - wait_for_url_pattern: Optional[str] = None - """A regex pattern that the URL should match before the client closes the webview. - - The client may submit the login if the user closes the webview after all cookies - are collected even if this URL is not reached, but it should only automatically - close the webview after both cookies and the URL match. - """ - - -class UnionMember2(BaseModel): - """Cookie login step""" - - cookies: UnionMember2Cookies - """Parameters for the cookie login step""" - - type: Literal["cookies"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember3Complete(BaseModel): - """Information about the completed login""" - - user_login_id: Optional[str] = None - """The unique ID of a login. Defined by the network connector.""" - - -class UnionMember3(BaseModel): - """Login complete""" - - complete: UnionMember3Complete - """Information about the completed login""" - - type: Literal["complete"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -AuthSubmitCookiesResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py deleted file mode 100644 index edbb7db..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["AuthSubmitUserInputParams"] - - -class AuthSubmitUserInputParams(TypedDict, total=False): - bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] - - login_process_id: Required[Annotated[str, PropertyInfo(alias="loginProcessID")]] - - body: Required[Dict[str, str]] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py deleted file mode 100644 index 0f2808d..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_submit_user_input_response.py +++ /dev/null @@ -1,278 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ...._models import BaseModel - -__all__ = [ - "AuthSubmitUserInputResponse", - "UnionMember0", - "UnionMember0DisplayAndWait", - "UnionMember1", - "UnionMember1UserInput", - "UnionMember1UserInputField", - "UnionMember1UserInputAttachment", - "UnionMember1UserInputAttachmentInfo", - "UnionMember2", - "UnionMember2Cookies", - "UnionMember2CookiesField", - "UnionMember3", - "UnionMember3Complete", -] - - -class UnionMember0DisplayAndWait(BaseModel): - """Parameters for the display and wait login step""" - - type: Literal["qr", "emoji", "code", "nothing"] - """The type of thing to display""" - - data: Optional[str] = None - """ - The thing to display (raw data for QR, unicode emoji for emoji, plain string for - code) - """ - - image_url: Optional[str] = None - """An image containing the thing to display. - - If present, this is recommended over using data directly. For emojis, the URL to - the canonical image representation of the emoji - """ - - -class UnionMember0(BaseModel): - """Display and wait login step""" - - display_and_wait: UnionMember0DisplayAndWait - """Parameters for the display and wait login step""" - - type: Literal["display_and_wait"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember1UserInputField(BaseModel): - """A field that the user can fill.""" - - id: str - """The internal ID of the field. - - This must be used as the key in the object when submitting the data back to the - bridge. - """ - - name: str - """The name of the field shown to the user.""" - - type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] - """The type of field.""" - - default_value: Optional[str] = None - """A default value that the client can pre-fill the field with.""" - - description: Optional[str] = None - """A more detailed description of the field shown to the user.""" - - options: Optional[List[str]] = None - """For fields of type select, the valid options.""" - - pattern: Optional[str] = None - """A regular expression that the field value must match.""" - - -class UnionMember1UserInputAttachmentInfo(BaseModel): - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - h: Optional[float] = None - """The height of the media in pixels. Only applicable for images and videos.""" - - mimetype: Optional[str] = None - """The MIME type for the media content.""" - - size: Optional[float] = None - """The size of the media content in number of bytes. - - Strongly recommended to include. - """ - - w: Optional[float] = None - """The width of the media in pixels. Only applicable for images and videos.""" - - -class UnionMember1UserInputAttachment(BaseModel): - """A media attachment to show the user.""" - - content: str - """The raw file content for the attachment encoded in base64.""" - - filename: str - """The filename for the media attachment.""" - - type: Literal["m.image", "m.audio"] - """ - The type of media attachment, using the same media type identifiers as Matrix - attachments. Only some are supported. - """ - - info: Optional[UnionMember1UserInputAttachmentInfo] = None - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - -class UnionMember1UserInput(BaseModel): - """Parameters for the user input login step""" - - fields: List[UnionMember1UserInputField] - """The list of fields that the user is requested to fill.""" - - attachments: Optional[List[UnionMember1UserInputAttachment]] = None - """A list of media attachments to show the user alongside the form fields.""" - - -class UnionMember1(BaseModel): - """User input login step""" - - type: Literal["user_input"] - - user_input: UnionMember1UserInput - """Parameters for the user input login step""" - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember2CookiesField(BaseModel): - """An individual cookie or other stored data item that must be extracted.""" - - name: str - """The name of the item to extract.""" - - type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] - """The type of data to extract.""" - - cookie_domain: Optional[str] = None - """For the `cookie` type, the domain of the cookie.""" - - request_url_regex: Optional[str] = None - """ - For the `request_header` and `request_body` types, a regex that matches the URLs - from which the values can be extracted. - """ - - -class UnionMember2Cookies(BaseModel): - """Parameters for the cookie login step""" - - fields: List[UnionMember2CookiesField] - """The list of cookies or other stored data that must be extracted.""" - - url: str - """The URL to open when using a webview to extract cookies.""" - - extract_js: Optional[str] = None - """ - A JavaScript snippet that can extract some or all of the fields. The snippet - will evaluate to a promise that resolves when the relevant fields are found. - Fields that are not present in the promise result must be extracted another way. - """ - - user_agent: Optional[str] = None - """An optional user agent that the webview should use.""" - - wait_for_url_pattern: Optional[str] = None - """A regex pattern that the URL should match before the client closes the webview. - - The client may submit the login if the user closes the webview after all cookies - are collected even if this URL is not reached, but it should only automatically - close the webview after both cookies and the URL match. - """ - - -class UnionMember2(BaseModel): - """Cookie login step""" - - cookies: UnionMember2Cookies - """Parameters for the cookie login step""" - - type: Literal["cookies"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember3Complete(BaseModel): - """Information about the completed login""" - - user_login_id: Optional[str] = None - """The unique ID of a login. Defined by the network connector.""" - - -class UnionMember3(BaseModel): - """Login complete""" - - complete: UnionMember3Complete - """Information about the completed login""" - - type: Literal["complete"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -AuthSubmitUserInputResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py deleted file mode 100644 index bd2fb65..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_wait_for_step_response.py +++ /dev/null @@ -1,278 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ...._models import BaseModel - -__all__ = [ - "AuthWaitForStepResponse", - "UnionMember0", - "UnionMember0DisplayAndWait", - "UnionMember1", - "UnionMember1UserInput", - "UnionMember1UserInputField", - "UnionMember1UserInputAttachment", - "UnionMember1UserInputAttachmentInfo", - "UnionMember2", - "UnionMember2Cookies", - "UnionMember2CookiesField", - "UnionMember3", - "UnionMember3Complete", -] - - -class UnionMember0DisplayAndWait(BaseModel): - """Parameters for the display and wait login step""" - - type: Literal["qr", "emoji", "code", "nothing"] - """The type of thing to display""" - - data: Optional[str] = None - """ - The thing to display (raw data for QR, unicode emoji for emoji, plain string for - code) - """ - - image_url: Optional[str] = None - """An image containing the thing to display. - - If present, this is recommended over using data directly. For emojis, the URL to - the canonical image representation of the emoji - """ - - -class UnionMember0(BaseModel): - """Display and wait login step""" - - display_and_wait: UnionMember0DisplayAndWait - """Parameters for the display and wait login step""" - - type: Literal["display_and_wait"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember1UserInputField(BaseModel): - """A field that the user can fill.""" - - id: str - """The internal ID of the field. - - This must be used as the key in the object when submitting the data back to the - bridge. - """ - - name: str - """The name of the field shown to the user.""" - - type: Literal["username", "phone_number", "email", "password", "2fa_code", "token", "url", "domain", "select"] - """The type of field.""" - - default_value: Optional[str] = None - """A default value that the client can pre-fill the field with.""" - - description: Optional[str] = None - """A more detailed description of the field shown to the user.""" - - options: Optional[List[str]] = None - """For fields of type select, the valid options.""" - - pattern: Optional[str] = None - """A regular expression that the field value must match.""" - - -class UnionMember1UserInputAttachmentInfo(BaseModel): - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - h: Optional[float] = None - """The height of the media in pixels. Only applicable for images and videos.""" - - mimetype: Optional[str] = None - """The MIME type for the media content.""" - - size: Optional[float] = None - """The size of the media content in number of bytes. - - Strongly recommended to include. - """ - - w: Optional[float] = None - """The width of the media in pixels. Only applicable for images and videos.""" - - -class UnionMember1UserInputAttachment(BaseModel): - """A media attachment to show the user.""" - - content: str - """The raw file content for the attachment encoded in base64.""" - - filename: str - """The filename for the media attachment.""" - - type: Literal["m.image", "m.audio"] - """ - The type of media attachment, using the same media type identifiers as Matrix - attachments. Only some are supported. - """ - - info: Optional[UnionMember1UserInputAttachmentInfo] = None - """Optional but recommended metadata for the attachment. - - Can generally be derived from the raw content if omitted. - """ - - -class UnionMember1UserInput(BaseModel): - """Parameters for the user input login step""" - - fields: List[UnionMember1UserInputField] - """The list of fields that the user is requested to fill.""" - - attachments: Optional[List[UnionMember1UserInputAttachment]] = None - """A list of media attachments to show the user alongside the form fields.""" - - -class UnionMember1(BaseModel): - """User input login step""" - - type: Literal["user_input"] - - user_input: UnionMember1UserInput - """Parameters for the user input login step""" - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember2CookiesField(BaseModel): - """An individual cookie or other stored data item that must be extracted.""" - - name: str - """The name of the item to extract.""" - - type: Literal["cookie", "local_storage", "request_header", "request_body", "special"] - """The type of data to extract.""" - - cookie_domain: Optional[str] = None - """For the `cookie` type, the domain of the cookie.""" - - request_url_regex: Optional[str] = None - """ - For the `request_header` and `request_body` types, a regex that matches the URLs - from which the values can be extracted. - """ - - -class UnionMember2Cookies(BaseModel): - """Parameters for the cookie login step""" - - fields: List[UnionMember2CookiesField] - """The list of cookies or other stored data that must be extracted.""" - - url: str - """The URL to open when using a webview to extract cookies.""" - - extract_js: Optional[str] = None - """ - A JavaScript snippet that can extract some or all of the fields. The snippet - will evaluate to a promise that resolves when the relevant fields are found. - Fields that are not present in the promise result must be extracted another way. - """ - - user_agent: Optional[str] = None - """An optional user agent that the webview should use.""" - - wait_for_url_pattern: Optional[str] = None - """A regex pattern that the URL should match before the client closes the webview. - - The client may submit the login if the user closes the webview after all cookies - are collected even if this URL is not reached, but it should only automatically - close the webview after both cookies and the URL match. - """ - - -class UnionMember2(BaseModel): - """Cookie login step""" - - cookies: UnionMember2Cookies - """Parameters for the cookie login step""" - - type: Literal["cookies"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -class UnionMember3Complete(BaseModel): - """Information about the completed login""" - - user_login_id: Optional[str] = None - """The unique ID of a login. Defined by the network connector.""" - - -class UnionMember3(BaseModel): - """Login complete""" - - complete: UnionMember3Complete - """Information about the completed login""" - - type: Literal["complete"] - - instructions: Optional[str] = None - """Human-readable instructions for completing this login step.""" - - login_id: Optional[str] = None - """An identifier for the current login process. - - Must be passed to execute more steps of the login. - """ - - step_id: Optional[str] = None - """An unique ID identifying this step. - - This can be used to implement special behavior in clients. - """ - - -AuthWaitForStepResponse: TypeAlias = Union[UnionMember0, UnionMember1, UnionMember2, UnionMember3] diff --git a/src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py b/src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py deleted file mode 100644 index 7bd7db7..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/auth_whoami_response.py +++ /dev/null @@ -1,128 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["AuthWhoamiResponse", "LoginFlow", "Login", "LoginProfile", "LoginState", "Network"] - - -class LoginFlow(BaseModel): - """An individual login flow which can be used to sign into the remote network.""" - - id: str - """ - An internal ID that is passed to the /login/start call to start a login with - this flow. - """ - - description: str - """A human-readable description of the login flow.""" - - name: str - """A human-readable name for the login flow.""" - - -class LoginProfile(BaseModel): - """The profile info of the logged-in user on the remote network.""" - - avatar: Optional[str] = None - """The user's avatar""" - - email: Optional[str] = None - """The user's email address""" - - name: Optional[str] = None - """The user's displayname""" - - phone: Optional[str] = None - """The user's phone number""" - - username: Optional[str] = None - """The user's username""" - - -class LoginState(BaseModel): - """The connection status of an individual login""" - - state_event: Literal["CONNECTING", "CONNECTED", "TRANSIENT_DISCONNECT", "BAD_CREDENTIALS", "UNKNOWN_ERROR"] - """The current state of this login.""" - - timestamp: float - """The time when the state was last updated.""" - - error: Optional[str] = None - """An error code defined by the network connector.""" - - info: Optional[object] = None - """Additional arbitrary info provided by the network connector.""" - - message: Optional[str] = None - """A human-readable error message defined by the network connector.""" - - reason: Optional[str] = None - """A reason code for non-error states that aren't exactly successes either.""" - - -class Login(BaseModel): - """The info of an individual login""" - - id: str - """The unique ID of a login. Defined by the network connector.""" - - name: str - """A human-readable name for the login. Defined by the network connector.""" - - profile: LoginProfile - """The profile info of the logged-in user on the remote network.""" - - state: LoginState - """The connection status of an individual login""" - - space_room: Optional[str] = None - """The personal filtering space room ID for this login.""" - - -class Network(BaseModel): - """Info about the network that the bridge is bridging to.""" - - beeper_bridge_type: str - """An identifier uniquely identifying the bridge software.""" - - displayname: str - """The displayname of the network.""" - - network_icon: str - """The icon of the network as a `mxc://` URI.""" - - network_id: str - """An identifier uniquely identifying the network.""" - - network_url: str - """The URL to the website of the network.""" - - -class AuthWhoamiResponse(BaseModel): - """Info about the bridge and user""" - - bridge_bot: str - """The Matrix user ID of the bridge bot.""" - - command_prefix: str - """The command prefix used by this bridge.""" - - homeserver: str - """The server name the bridge is running on.""" - - login_flows: List[LoginFlow] - """The login flows that the bridge supports.""" - - logins: List[Login] - """The logins of the user who made the /whoami call""" - - network: Network - """Info about the network that the bridge is bridging to.""" - - management_room: Optional[str] = None - """The Matrix management room ID of the user who made the /whoami call.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py b/src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py deleted file mode 100644 index 18c6716..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/capability_retrieve_response.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict -from typing_extensions import TypeAlias - -__all__ = ["CapabilityRetrieveResponse"] - -CapabilityRetrieveResponse: TypeAlias = Dict[str, object] diff --git a/src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py b/src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py deleted file mode 100644 index 73465db..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/contact_list_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ContactListParams"] - - -class ContactListParams(TypedDict, total=False): - login_id: str - """An optional explicit login ID to do the action through.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py b/src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py deleted file mode 100644 index c0b51dc..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/contact_list_response.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["ContactListResponse", "Contact"] - - -class Contact(BaseModel): - """A successfully resolved identifier.""" - - id: str - """The internal user ID of the resolved user.""" - - avatar_url: Optional[str] = None - """The avatar of the user on the remote network.""" - - dm_room_mxid: Optional[str] = None - """The Matrix room ID of the direct chat with the user.""" - - identifiers: Optional[List[str]] = None - """A list of identifiers for the user on the remote network.""" - - mxid: Optional[str] = None - """The Matrix user ID of the ghost representing the user.""" - - name: Optional[str] = None - """The name of the user on the remote network.""" - - -class ContactListResponse(BaseModel): - contacts: Optional[List[Contact]] = None diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py deleted file mode 100644 index 5535a29..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["RoomCreateDmParams"] - - -class RoomCreateDmParams(TypedDict, total=False): - bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] - - login_id: str - """An optional explicit login ID to do the action through.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py deleted file mode 100644 index f15debc..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/room_create_dm_response.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["RoomCreateDmResponse"] - - -class RoomCreateDmResponse(BaseModel): - """A successfully resolved identifier.""" - - id: str - """The internal user ID of the resolved user.""" - - avatar_url: Optional[str] = None - """The avatar of the user on the remote network.""" - - dm_room_mxid: Optional[str] = None - """The Matrix room ID of the direct chat with the user.""" - - identifiers: Optional[List[str]] = None - """A list of identifiers for the user on the remote network.""" - - mxid: Optional[str] = None - """The Matrix user ID of the ghost representing the user.""" - - name: Optional[str] = None - """The name of the user on the remote network.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py deleted file mode 100644 index de9c10d..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/room_create_group_params.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ...._types import SequenceNotStr -from ...._utils import PropertyInfo - -__all__ = ["RoomCreateGroupParams", "Avatar", "Disappear", "Name", "Topic"] - - -class RoomCreateGroupParams(TypedDict, total=False): - bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] - - login_id: str - """An optional explicit login ID to do the action through.""" - - avatar: Avatar - """The `m.room.avatar` event content for the room.""" - - disappear: Disappear - """The `com.beeper.disappearing_timer` event content for the room.""" - - name: Name - """The `m.room.name` event content for the room.""" - - parent: object - - participants: SequenceNotStr[str] - """The users to add to the group initially.""" - - room_id: str - """ - An existing Matrix room ID to bridge to. The other parameters must be already in - sync with the room state when using this parameter. - """ - - topic: Topic - """The `m.room.topic` event content for the room.""" - - type: str - """The type of group to create.""" - - username: str - """The public username for the created group.""" - - -class Avatar(TypedDict, total=False): - """The `m.room.avatar` event content for the room.""" - - url: str - - -class Disappear(TypedDict, total=False): - """The `com.beeper.disappearing_timer` event content for the room.""" - - timer: float - - type: str - - -class Name(TypedDict, total=False): - """The `m.room.name` event content for the room.""" - - name: str - - -class Topic(TypedDict, total=False): - """The `m.room.topic` event content for the room.""" - - topic: str diff --git a/src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py b/src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py deleted file mode 100644 index 824275b..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/room_create_group_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel - -__all__ = ["RoomCreateGroupResponse"] - - -class RoomCreateGroupResponse(BaseModel): - """A successfully created group chat.""" - - id: str - """The internal chat ID of the created group.""" - - mxid: str - """The Matrix room ID of the portal.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py b/src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py deleted file mode 100644 index 46d6b21..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/user_resolve_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["UserResolveParams"] - - -class UserResolveParams(TypedDict, total=False): - bridge_id: Required[Annotated[str, PropertyInfo(alias="bridgeID")]] - - login_id: str - """An optional explicit login ID to do the action through.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py b/src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py deleted file mode 100644 index 22b2517..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/user_resolve_response.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["UserResolveResponse"] - - -class UserResolveResponse(BaseModel): - """A successfully resolved identifier.""" - - id: str - """The internal user ID of the resolved user.""" - - avatar_url: Optional[str] = None - """The avatar of the user on the remote network.""" - - dm_room_mxid: Optional[str] = None - """The Matrix room ID of the direct chat with the user.""" - - identifiers: Optional[List[str]] = None - """A list of identifiers for the user on the remote network.""" - - mxid: Optional[str] = None - """The Matrix user ID of the ghost representing the user.""" - - name: Optional[str] = None - """The name of the user on the remote network.""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_search_params.py b/src/beeper_desktop_api/types/matrix/bridges/user_search_params.py deleted file mode 100644 index 45190a8..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/user_search_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["UserSearchParams"] - - -class UserSearchParams(TypedDict, total=False): - login_id: str - """An optional explicit login ID to do the action through.""" - - query: str - """The search query to send to the remote network""" diff --git a/src/beeper_desktop_api/types/matrix/bridges/user_search_response.py b/src/beeper_desktop_api/types/matrix/bridges/user_search_response.py deleted file mode 100644 index c001e5c..0000000 --- a/src/beeper_desktop_api/types/matrix/bridges/user_search_response.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["UserSearchResponse", "Result"] - - -class Result(BaseModel): - """A successfully resolved identifier.""" - - id: str - """The internal user ID of the resolved user.""" - - avatar_url: Optional[str] = None - """The avatar of the user on the remote network.""" - - dm_room_mxid: Optional[str] = None - """The Matrix room ID of the direct chat with the user.""" - - identifiers: Optional[List[str]] = None - """A list of identifiers for the user on the remote network.""" - - mxid: Optional[str] = None - """The Matrix user ID of the ghost representing the user.""" - - name: Optional[str] = None - """The name of the user on the remote network.""" - - -class UserSearchResponse(BaseModel): - results: Optional[List[Result]] = None diff --git a/src/beeper_desktop_api/types/matrix/room_create_params.py b/src/beeper_desktop_api/types/matrix/room_create_params.py deleted file mode 100644 index 073228e..0000000 --- a/src/beeper_desktop_api/types/matrix/room_create_params.py +++ /dev/null @@ -1,157 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, Required, TypedDict - -from ..._types import SequenceNotStr - -__all__ = ["RoomCreateParams", "InitialState", "Invite3pid"] - - -class RoomCreateParams(TypedDict, total=False): - creation_content: object - """ - Extra keys, such as `m.federate`, to be added to the content of the - [`m.room.create`](https://spec.matrix.org/v1.18/client-server-api/#mroomcreate) - event. - - The server will overwrite the following keys: `creator`, `room_version`. Future - versions of the specification may allow the server to overwrite other keys. - - When using the `trusted_private_chat` preset, the server SHOULD combine - `additional_creators` specified here and the `invite` array into the eventual - `m.room.create` event's `additional_creators`, deduplicating between the two - parameters. - """ - - initial_state: Iterable[InitialState] - """A list of state events to set in the new room. - - This allows the user to override the default state events set in the new room. - The expected format of the state events are an object with type, state_key and - content keys set. - - Takes precedence over events set by `preset`, but gets overridden by `name` and - `topic` keys. - """ - - invite: SequenceNotStr[str] - """A list of user IDs to invite to the room. - - This will tell the server to invite everyone in the list to the newly created - room. - """ - - invite_3pid: Iterable[Invite3pid] - """A list of objects representing third-party IDs to invite into the room.""" - - is_direct: bool - """ - This flag makes the server set the `is_direct` flag on the `m.room.member` - events sent to the users in `invite` and `invite_3pid`. See - [Direct Messaging](https://spec.matrix.org/v1.18/client-server-api/#direct-messaging) - for more information. - """ - - name: str - """ - If this is included, an - [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) - event will be sent into the room to indicate the name for the room. This - overwrites any - [`m.room.name`](https://spec.matrix.org/v1.18/client-server-api/#mroomname) - event in `initial_state`. - """ - - power_level_content_override: object - """The power level content to override in the default power level event. - - This object is applied on top of the generated - [`m.room.power_levels`](https://spec.matrix.org/v1.18/client-server-api/#mroompower_levels) - event content prior to it being sent to the room. Defaults to overriding - nothing. - """ - - preset: Literal["private_chat", "public_chat", "trusted_private_chat"] - """ - Convenience parameter for setting various default state events based on a - preset. - - If unspecified, the server should use the `visibility` to determine which preset - to use. A visibility of `public` equates to a preset of `public_chat` and - `private` visibility equates to a preset of `private_chat`. - """ - - room_alias_name: str - """The desired room alias **local part**. - - If this is included, a room alias will be created and mapped to the newly - created room. The alias will belong on the _same_ homeserver which created the - room. For example, if this was set to "foo" and sent to the homeserver - "example.com" the complete room alias would be `#foo:example.com`. - - The complete room alias will become the canonical alias for the room and an - `m.room.canonical_alias` event will be sent into the room. - """ - - room_version: str - """The room version to set for the room. - - If not provided, the homeserver is to use its configured default. If provided, - the homeserver will return a 400 error with the errcode - `M_UNSUPPORTED_ROOM_VERSION` if it does not support the room version. - """ - - topic: str - """ - If this is included, an - [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) - event with a `text/plain` mimetype will be sent into the room to indicate the - topic for the room. This overwrites any - [`m.room.topic`](https://spec.matrix.org/v1.18/client-server-api/#mroomtopic) - event in `initial_state`. - """ - - visibility: Literal["public", "private"] - """ - The room's visibility in the server's - [published room directory](https://spec.matrix.org/v1.18/client-server-api#published-room-directory). - Defaults to `private`. - """ - - -class InitialState(TypedDict, total=False): - content: Required[object] - """The content of the event.""" - - type: Required[str] - """The type of event to send.""" - - state_key: str - """The state_key of the state event. Defaults to an empty string.""" - - -class Invite3pid(TypedDict, total=False): - address: Required[str] - """The invitee's third-party identifier.""" - - id_access_token: Required[str] - """An access token previously registered with the identity server. - - Servers can treat this as optional to distinguish between r0.5-compatible - clients and this specification version. - """ - - id_server: Required[str] - """ - The hostname+port of the identity server which should be used for third-party - identifier lookups. - """ - - medium: Required[str] - """ - The kind of address being passed in the address field, for example `email` (see - [the list of recognised values](https://spec.matrix.org/v1.18/appendices/#3pid-types)). - """ diff --git a/src/beeper_desktop_api/types/matrix/room_create_response.py b/src/beeper_desktop_api/types/matrix/room_create_response.py deleted file mode 100644 index e8559bf..0000000 --- a/src/beeper_desktop_api/types/matrix/room_create_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["RoomCreateResponse"] - - -class RoomCreateResponse(BaseModel): - """Information about the newly created room.""" - - room_id: str - """The created room's ID.""" diff --git a/src/beeper_desktop_api/types/matrix/room_join_params.py b/src/beeper_desktop_api/types/matrix/room_join_params.py deleted file mode 100644 index 2bbc93b..0000000 --- a/src/beeper_desktop_api/types/matrix/room_join_params.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict -from typing_extensions import Required, TypedDict - -from ..._types import SequenceNotStr - -__all__ = ["RoomJoinParams", "ThirdPartySigned"] - - -class RoomJoinParams(TypedDict, total=False): - via: SequenceNotStr[str] - """The servers to attempt to join the room through. - - One of the servers must be participating in the room. - """ - - reason: str - """ - Optional reason to be included as the `reason` on the subsequent membership - event. - """ - - third_party_signed: ThirdPartySigned - """ - A signature of an `m.third_party_invite` token to prove that this user owns a - third-party identity which has been invited to the room. - """ - - -class ThirdPartySigned(TypedDict, total=False): - """ - A signature of an `m.third_party_invite` token to prove that this user - owns a third-party identity which has been invited to the room. - """ - - token: Required[str] - """The state key of the m.third_party_invite event.""" - - mxid: Required[str] - """The Matrix ID of the invitee.""" - - sender: Required[str] - """The Matrix ID of the user who issued the invite.""" - - signatures: Required[Dict[str, Dict[str, str]]] - """A signatures object containing a signature of the entire signed object.""" diff --git a/src/beeper_desktop_api/types/matrix/room_join_response.py b/src/beeper_desktop_api/types/matrix/room_join_response.py deleted file mode 100644 index 337f661..0000000 --- a/src/beeper_desktop_api/types/matrix/room_join_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["RoomJoinResponse"] - - -class RoomJoinResponse(BaseModel): - room_id: str - """The joined room ID.""" diff --git a/src/beeper_desktop_api/types/matrix/room_leave_params.py b/src/beeper_desktop_api/types/matrix/room_leave_params.py deleted file mode 100644 index 1641101..0000000 --- a/src/beeper_desktop_api/types/matrix/room_leave_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["RoomLeaveParams"] - - -class RoomLeaveParams(TypedDict, total=False): - reason: str - """ - Optional reason to be included as the `reason` on the subsequent membership - event. - """ diff --git a/src/beeper_desktop_api/types/matrix/rooms/__init__.py b/src/beeper_desktop_api/types/matrix/rooms/__init__.py deleted file mode 100644 index 39de1f8..0000000 --- a/src/beeper_desktop_api/types/matrix/rooms/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .state_list_response import StateListResponse as StateListResponse -from .state_retrieve_params import StateRetrieveParams as StateRetrieveParams -from .event_retrieve_response import EventRetrieveResponse as EventRetrieveResponse -from .state_retrieve_response import StateRetrieveResponse as StateRetrieveResponse -from .account_data_update_params import AccountDataUpdateParams as AccountDataUpdateParams diff --git a/src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py b/src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py deleted file mode 100644 index aa8463a..0000000 --- a/src/beeper_desktop_api/types/matrix/rooms/account_data_update_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["AccountDataUpdateParams"] - - -class AccountDataUpdateParams(TypedDict, total=False): - user_id: Required[Annotated[str, PropertyInfo(alias="userId")]] - - room_id: Required[Annotated[str, PropertyInfo(alias="roomId")]] - - body: Required[object] diff --git a/src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py b/src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py deleted file mode 100644 index f39b2fe..0000000 --- a/src/beeper_desktop_api/types/matrix/rooms/event_retrieve_response.py +++ /dev/null @@ -1,94 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["EventRetrieveResponse", "Unsigned"] - - -class Unsigned(BaseModel): - age: Optional[int] = None - """The time in milliseconds that has elapsed since the event was sent. - - This field is generated by the local homeserver, and may be incorrect if the - local time on at least one of the two servers is out of sync, which can cause - the age to either be negative or greater than it actually is. - """ - - membership: Optional[str] = None - """The room membership of the user making the request, at the time of the event. - - This property is the value of the `membership` property of the requesting user's - [`m.room.member`](https://spec.matrix.org/v1.18/client-server-api#mroommember) - state at the point of the event, including any changes caused by the event. If - the user had yet to join the room at the time of the event (i.e, they have no - `m.room.member` state), this property is set to `leave`. - - Homeservers SHOULD populate this property wherever practical, but they MAY omit - it if necessary (for example, if calculating the value is expensive, servers - might choose to only implement it in encrypted rooms). The property is _not_ - normally populated in events pushed to application services via the application - service transaction API (where there is no clear definition of "requesting - user"). - """ - - prev_content: Optional[object] = None - """The previous `content` for this event. - - This field is generated by the local homeserver, and is only returned if the - event is a state event, and the client has permission to see the previous - content. - """ - - redacted_because: Optional[object] = None - - transaction_id: Optional[str] = None - """ - The client-supplied - [transaction ID](https://spec.matrix.org/v1.18/client-server-api/#transaction-identifiers), - for example, provided via - `PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}`, if the client - being given the event is the same one which sent it. - """ - - -class EventRetrieveResponse(BaseModel): - """ - The format used for events when they are returned from a homeserver to a client - via the Client-Server API, or sent to an Application Service via the Application Services API. - """ - - content: object - """The body of this event, as created by the client which sent it.""" - - event_id: str - """The globally unique identifier for this event.""" - - origin_server_ts: int - """ - Timestamp (in milliseconds since the unix epoch) on originating homeserver when - this event was sent. - """ - - room_id: str - """The ID of the room associated with this event.""" - - sender: str - """Contains the fully-qualified ID of the user who sent this event.""" - - type: str - """The type of the event.""" - - state_key: Optional[str] = None - """Present if, and only if, this event is a _state_ event. - - The key making this piece of state unique in the room. Note that it is often an - empty string. - - State keys starting with an `@` are reserved for referencing user IDs, such as - room members. With the exception of a few events, state events set with a given - user's ID as the state key MUST only be set by that user. - """ - - unsigned: Optional[Unsigned] = None diff --git a/src/beeper_desktop_api/types/matrix/rooms/state_list_response.py b/src/beeper_desktop_api/types/matrix/rooms/state_list_response.py deleted file mode 100644 index 1f879ef..0000000 --- a/src/beeper_desktop_api/types/matrix/rooms/state_list_response.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import TypeAlias - -from ...._models import BaseModel - -__all__ = ["StateListResponse", "StateListResponseItem", "StateListResponseItemUnsigned"] - - -class StateListResponseItemUnsigned(BaseModel): - age: Optional[int] = None - """The time in milliseconds that has elapsed since the event was sent. - - This field is generated by the local homeserver, and may be incorrect if the - local time on at least one of the two servers is out of sync, which can cause - the age to either be negative or greater than it actually is. - """ - - membership: Optional[str] = None - """The room membership of the user making the request, at the time of the event. - - This property is the value of the `membership` property of the requesting user's - [`m.room.member`](https://spec.matrix.org/v1.18/client-server-api#mroommember) - state at the point of the event, including any changes caused by the event. If - the user had yet to join the room at the time of the event (i.e, they have no - `m.room.member` state), this property is set to `leave`. - - Homeservers SHOULD populate this property wherever practical, but they MAY omit - it if necessary (for example, if calculating the value is expensive, servers - might choose to only implement it in encrypted rooms). The property is _not_ - normally populated in events pushed to application services via the application - service transaction API (where there is no clear definition of "requesting - user"). - """ - - prev_content: Optional[object] = None - """The previous `content` for this event. - - This field is generated by the local homeserver, and is only returned if the - event is a state event, and the client has permission to see the previous - content. - """ - - redacted_because: Optional[object] = None - - transaction_id: Optional[str] = None - """ - The client-supplied - [transaction ID](https://spec.matrix.org/v1.18/client-server-api/#transaction-identifiers), - for example, provided via - `PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}`, if the client - being given the event is the same one which sent it. - """ - - -class StateListResponseItem(BaseModel): - """ - The format used for events when they are returned from a homeserver to a client - via the Client-Server API, or sent to an Application Service via the Application Services API. - """ - - content: object - """The body of this event, as created by the client which sent it.""" - - event_id: str - """The globally unique identifier for this event.""" - - origin_server_ts: int - """ - Timestamp (in milliseconds since the unix epoch) on originating homeserver when - this event was sent. - """ - - room_id: str - """The ID of the room associated with this event.""" - - sender: str - """Contains the fully-qualified ID of the user who sent this event.""" - - type: str - """The type of the event.""" - - state_key: Optional[str] = None - """Present if, and only if, this event is a _state_ event. - - The key making this piece of state unique in the room. Note that it is often an - empty string. - - State keys starting with an `@` are reserved for referencing user IDs, such as - room members. With the exception of a few events, state events set with a given - user's ID as the state key MUST only be set by that user. - """ - - unsigned: Optional[StateListResponseItemUnsigned] = None - - -StateListResponse: TypeAlias = List[StateListResponseItem] diff --git a/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py b/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py deleted file mode 100644 index c2a4d7d..0000000 --- a/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_params.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["StateRetrieveParams"] - - -class StateRetrieveParams(TypedDict, total=False): - room_id: Required[Annotated[str, PropertyInfo(alias="roomId")]] - - event_type: Required[Annotated[str, PropertyInfo(alias="eventType")]] - - format: Literal["content", "event"] - """The format to use for the returned data. - - `content` (the default) will return only the content of the state event. `event` - will return the entire event in the usual format suitable for clients, including - fields like event ID, sender and timestamp. - """ diff --git a/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py b/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py deleted file mode 100644 index 4f07375..0000000 --- a/src/beeper_desktop_api/types/matrix/rooms/state_retrieve_response.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict -from typing_extensions import TypeAlias - -__all__ = ["StateRetrieveResponse"] - -StateRetrieveResponse: TypeAlias = Dict[str, object] diff --git a/src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py b/src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py deleted file mode 100644 index 9ad6009..0000000 --- a/src/beeper_desktop_api/types/matrix/user_retrieve_profile_response.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import TYPE_CHECKING, Dict, Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["UserRetrieveProfileResponse"] - - -class UserRetrieveProfileResponse(BaseModel): - avatar_url: Optional[str] = None - """The user's avatar URL if they have set one, otherwise not present.""" - - displayname: Optional[str] = None - """The user's display name if they have set one, otherwise not present.""" - - m_tz: Optional[str] = FieldInfo(alias="m.tz", default=None) - """The user's time zone.""" - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] diff --git a/src/beeper_desktop_api/types/matrix/users/account_data_update_params.py b/src/beeper_desktop_api/types/matrix/users/account_data_update_params.py deleted file mode 100644 index b1d58de..0000000 --- a/src/beeper_desktop_api/types/matrix/users/account_data_update_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["AccountDataUpdateParams"] - - -class AccountDataUpdateParams(TypedDict, total=False): - user_id: Required[Annotated[str, PropertyInfo(alias="userId")]] - - body: Required[object] diff --git a/src/beeper_desktop_api/types/message_delete_params.py b/src/beeper_desktop_api/types/message_delete_params.py index f8c7fff..ee4ca5e 100644 --- a/src/beeper_desktop_api/types/message_delete_params.py +++ b/src/beeper_desktop_api/types/message_delete_params.py @@ -14,8 +14,8 @@ class MessageDeleteParams(TypedDict, total=False): chat_id: Required[Annotated[str, PropertyInfo(alias="chatID")]] """Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop installation - when available. + Input routes also accept the local chat ID from this installation when + available. """ for_everyone: Annotated[Optional[bool], PropertyInfo(alias="forEveryone")] diff --git a/src/beeper_desktop_api/types/message_search_params.py b/src/beeper_desktop_api/types/message_search_params.py index e9bab35..09b3336 100644 --- a/src/beeper_desktop_api/types/message_search_params.py +++ b/src/beeper_desktop_api/types/message_search_params.py @@ -66,12 +66,11 @@ class MessageSearchParams(TypedDict, total=False): """ query: str - """Literal word search (non-semantic). + """Literal word search. - Finds messages containing these EXACT words in any order. Use single words users - actually type, not concepts or phrases. Example: use "dinner" not "dinner - plans", use "sick" not "health issues". If omitted, returns results filtered - only by other parameters. + Finds messages containing these words in any order. Use words the user actually + typed, not inferred concepts. Example: use "dinner" rather than "dinner plans". + If omitted, returns results filtered only by the other parameters. """ sender: str diff --git a/src/beeper_desktop_api/types/message_send_params.py b/src/beeper_desktop_api/types/message_send_params.py index 78de9d1..f73d26d 100644 --- a/src/beeper_desktop_api/types/message_send_params.py +++ b/src/beeper_desktop_api/types/message_send_params.py @@ -19,8 +19,8 @@ class MessageSendParams(TypedDict, total=False): text: str """Draft text. - Plain text and Markdown are converted to Matrix HTML with the same rules used by - send and edit. + Plain text and Markdown are converted to Beeper rich text with the same rules + used by send and edit. """ diff --git a/src/beeper_desktop_api/types/message_send_response.py b/src/beeper_desktop_api/types/message_send_response.py index 37b739c..82ae9ce 100644 --- a/src/beeper_desktop_api/types/message_send_response.py +++ b/src/beeper_desktop_api/types/message_send_response.py @@ -11,8 +11,8 @@ class MessageSendResponse(BaseModel): chat_id: str = FieldInfo(alias="chatID") """Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop installation - when available. + Input routes also accept the local chat ID from this installation when + available. """ pending_message_id: str = FieldInfo(alias="pendingMessageID") diff --git a/src/beeper_desktop_api/types/message_update_params.py b/src/beeper_desktop_api/types/message_update_params.py index 9f62d93..024259b 100644 --- a/src/beeper_desktop_api/types/message_update_params.py +++ b/src/beeper_desktop_api/types/message_update_params.py @@ -13,8 +13,8 @@ class MessageUpdateParams(TypedDict, total=False): chat_id: Required[Annotated[str, PropertyInfo(alias="chatID")]] """Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop installation - when available. + Input routes also accept the local chat ID from this installation when + available. """ text: Required[str] diff --git a/src/beeper_desktop_api/types/provisioning_capabilities.py b/src/beeper_desktop_api/types/provisioning_capabilities.py new file mode 100644 index 0000000..2a6d15a --- /dev/null +++ b/src/beeper_desktop_api/types/provisioning_capabilities.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from .._models import BaseModel +from .group_type_capabilities import GroupTypeCapabilities +from .resolve_identifier_capabilities import ResolveIdentifierCapabilities + +__all__ = ["ProvisioningCapabilities"] + + +class ProvisioningCapabilities(BaseModel): + """Advanced network capabilities for account lookup and group creation.""" + + group_creation: Dict[str, GroupTypeCapabilities] + + resolve_identifier: ResolveIdentifierCapabilities + """Identifier lookup capabilities for this bridge.""" + + image_pack_import: Optional[bool] = None diff --git a/src/beeper_desktop_api/types/resolve_identifier_capabilities.py b/src/beeper_desktop_api/types/resolve_identifier_capabilities.py new file mode 100644 index 0000000..23038a6 --- /dev/null +++ b/src/beeper_desktop_api/types/resolve_identifier_capabilities.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["ResolveIdentifierCapabilities"] + + +class ResolveIdentifierCapabilities(BaseModel): + """Identifier lookup capabilities for this bridge.""" + + any_phone: bool + + contact_list: bool + + create_dm: bool + + lookup_email: bool + + lookup_phone: bool + + lookup_username: bool + + search: bool diff --git a/src/beeper_desktop_api/types/shared/__init__.py b/src/beeper_desktop_api/types/shared/__init__.py index 63cd244..c29fad6 100644 --- a/src/beeper_desktop_api/types/shared/__init__.py +++ b/src/beeper_desktop_api/types/shared/__init__.py @@ -4,5 +4,6 @@ from .error import Error as Error from .message import Message as Message from .reaction import Reaction as Reaction +from .api_error import APIError as APIError from .attachment import Attachment as Attachment from .app_state_snapshot import AppStateSnapshot as AppStateSnapshot diff --git a/src/beeper_desktop_api/types/shared/api_error.py b/src/beeper_desktop_api/types/shared/api_error.py new file mode 100644 index 0000000..1f000f0 --- /dev/null +++ b/src/beeper_desktop_api/types/shared/api_error.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ..._models import BaseModel + +__all__ = ["APIError"] + + +class APIError(BaseModel): + code: str + + message: str + + details: Optional[Dict[str, Optional[object]]] = None diff --git a/src/beeper_desktop_api/types/shared/app_state_snapshot.py b/src/beeper_desktop_api/types/shared/app_state_snapshot.py index 88fc131..58eea37 100644 --- a/src/beeper_desktop_api/types/shared/app_state_snapshot.py +++ b/src/beeper_desktop_api/types/shared/app_state_snapshot.py @@ -7,10 +7,20 @@ from ..._models import BaseModel -__all__ = ["AppStateSnapshot", "E2ee", "E2eeSecrets", "Matrix", "Verification", "VerificationError", "VerificationSas"] - - -class E2eeSecrets(BaseModel): +__all__ = [ + "AppStateSnapshot", + "E2EE", + "E2EESecrets", + "Matrix", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class E2EESecrets(BaseModel): """Encrypted messaging keys available on this device.""" master_key: bool = FieldInfo(alias="masterKey") @@ -19,7 +29,7 @@ class E2eeSecrets(BaseModel): megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") """Whether the encrypted message backup key is available.""" - recovery_code: bool = FieldInfo(alias="recoveryCode") + recovery_key: bool = FieldInfo(alias="recoveryKey") """Whether a recovery key is available.""" self_signing_key: bool = FieldInfo(alias="selfSigningKey") @@ -29,7 +39,7 @@ class E2eeSecrets(BaseModel): """Whether the user trust key is available.""" -class E2ee(BaseModel): +class E2EE(BaseModel): """Encrypted messaging setup status.""" cross_signing: bool = FieldInfo(alias="crossSigning") @@ -38,7 +48,7 @@ class E2ee(BaseModel): first_sync_done: bool = FieldInfo(alias="firstSyncDone") """Whether the first encrypted message sync is complete.""" - has_backed_up_code: bool = FieldInfo(alias="hasBackedUpCode") + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") """Whether the user confirmed that they saved their recovery key.""" initialized: bool @@ -47,7 +57,7 @@ class E2ee(BaseModel): key_backup: bool = FieldInfo(alias="keyBackup") """Whether encrypted message backup is available.""" - secrets: E2eeSecrets + secrets: E2EESecrets """Encrypted messaging keys available on this device.""" secret_storage: bool = FieldInfo(alias="secretStorage") @@ -56,7 +66,7 @@ class E2ee(BaseModel): verified: bool """Whether this device is trusted for encrypted messages.""" - recovery_code_generated_at: Optional[float] = FieldInfo(alias="recoveryCodeGeneratedAt", default=None) + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) """Unix timestamp for when the recovery key was created.""" @@ -67,7 +77,7 @@ class Matrix(BaseModel): """Current device ID.""" homeserver: str - """Beeper server URL for this account.""" + """Beeper homeserver URL for this account.""" user_id: str = FieldInfo(alias="userID") """Signed-in Beeper user ID.""" @@ -83,57 +93,74 @@ class VerificationError(BaseModel): """User-facing verification error message.""" -class VerificationSas(BaseModel): - """Emoji or number comparison data for verification.""" +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" - decimals: str - """Number sequence to compare on both devices.""" + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" emojis: str """Emoji sequence to compare on both devices.""" + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + class Verification(BaseModel): - """Trusted-device verification progress.""" + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" - available_actions: List[ - Literal["create", "qr.scan", "accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"] - ] = FieldInfo(alias="availableActions") + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) """Verification actions that are valid for the current state.""" - state: Literal["idle", "requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] """Current trusted-device verification state.""" error: Optional[VerificationError] = None """Verification error details, if verification stopped.""" - from_: Optional[str] = FieldInfo(alias="from", default=None) - """User ID that started verification.""" - - from_device: Optional[str] = FieldInfo(alias="fromDevice", default=None) - """Device that started verification.""" - - other_device: Optional[str] = FieldInfo(alias="otherDevice", default=None) + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) """Other device participating in verification.""" - qr_data: Optional[str] = FieldInfo(alias="qrData", default=None) - """QR code payload to display for verification.""" - - sas: Optional[VerificationSas] = None - """Emoji or number comparison data for verification.""" + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" - supports_sas: Optional[bool] = FieldInfo(alias="supportsSAS", default=None) - """Whether emoji comparison is available.""" + qr: Optional[VerificationQr] = None + """QR verification data.""" - supports_scan_qr_code: Optional[bool] = FieldInfo(alias="supportsScanQRCode", default=None) - """Whether QR code verification is available.""" - - verification_id: Optional[str] = FieldInfo(alias="verificationID", default=None) - """Verification ID to pass in verification action paths.""" + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" class AppStateSnapshot(BaseModel): - e2ee: E2ee + e2ee: E2EE """Encrypted messaging setup status.""" state: Literal[ @@ -145,10 +172,13 @@ class AppStateSnapshot(BaseModel): "needs-first-sync", "ready", ] - """Current onboarding state for Beeper Desktop.""" + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ matrix: Optional[Matrix] = None """Signed-in account details. Omitted until sign-in is complete.""" verification: Optional[Verification] = None - """Trusted-device verification progress.""" + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/shared/attachment.py b/src/beeper_desktop_api/types/shared/attachment.py index 1ec39f6..cd7ed3b 100644 --- a/src/beeper_desktop_api/types/shared/attachment.py +++ b/src/beeper_desktop_api/types/shared/attachment.py @@ -36,7 +36,7 @@ class Attachment(BaseModel): """Attachment type.""" id: Optional[str] = None - """Attachment identifier (typically an mxc:// URL). + """Attachment identifier, typically an mxc:// URL. Use the download file endpoint to get a local file path. """ @@ -65,7 +65,7 @@ class Attachment(BaseModel): poster_img: Optional[str] = FieldInfo(alias="posterImg", default=None) """Preview image URL for video attachments (poster frame). - May be temporary or local-only to this device; download promptly if durable + May be temporary or available only on this device; download promptly if durable access is needed. """ @@ -75,7 +75,7 @@ class Attachment(BaseModel): src_url: Optional[str] = FieldInfo(alias="srcURL", default=None) """Public URL or local file path to fetch the file. - May be temporary or local-only to this device; download promptly if durable + May be temporary or available only on this device; download promptly if durable access is needed. """ diff --git a/src/beeper_desktop_api/types/shared/message.py b/src/beeper_desktop_api/types/shared/message.py index 40206de..2f74fe4 100644 --- a/src/beeper_desktop_api/types/shared/message.py +++ b/src/beeper_desktop_api/types/shared/message.py @@ -33,14 +33,14 @@ class Link(BaseModel): favicon: Optional[str] = None """Favicon URL if available. - May be temporary or local-only to this device; download promptly if durable + May be temporary or available only on this device; download promptly if durable access is needed. """ img: Optional[str] = None """Preview image URL if available. - May be temporary or local-only to this device; download promptly if durable + May be temporary or available only on this device; download promptly if durable access is needed. """ @@ -67,7 +67,10 @@ class SendStatus(BaseModel): """User IDs the message was delivered to, when reported by the network.""" internal_error: Optional[str] = FieldInfo(alias="internalError", default=None) - """Internal bridge error detail. Intended for diagnostics, not end-user display.""" + """Diagnostic error detail from the messaging network adapter. + + Do not show directly to users. + """ message: Optional[str] = None """Human-readable send status or failure message.""" @@ -86,14 +89,14 @@ class Message(BaseModel): chat_id: str = FieldInfo(alias="chatID") """Chat ID. - Input routes also accept the local chat ID from this Beeper Desktop installation - when available. + Input routes also accept the local chat ID from this installation when + available. """ sender_id: str = FieldInfo(alias="senderID") - """ - Matrix-style fully-qualified sender user ID, usually including a bridge prefix - and homeserver. + """Fully qualified sender user ID. + + Network-backed IDs usually include the network prefix and homeserver. """ sort_key: str = FieldInfo(alias="sortKey") @@ -139,15 +142,13 @@ class Message(BaseModel): """Read receipt state for this message, when available.""" sender_name: Optional[str] = FieldInfo(alias="senderName", default=None) - """ - Resolved sender display name (impersonator/full name/username/participant name). - """ + """Resolved sender display name.""" send_status: Optional[SendStatus] = FieldInfo(alias="sendStatus", default=None) """Message send status for this message, when reported by the bridge.""" text: Optional[str] = None - """Matrix HTML body if present.""" + """Rich-text message body if present.""" type: Optional[ Literal["TEXT", "NOTICE", "IMAGE", "VIDEO", "VOICE", "AUDIO", "FILE", "STICKER", "LOCATION", "REACTION"] diff --git a/src/beeper_desktop_api/types/shared/reaction.py b/src/beeper_desktop_api/types/shared/reaction.py index e28fb69..751db4e 100644 --- a/src/beeper_desktop_api/types/shared/reaction.py +++ b/src/beeper_desktop_api/types/shared/reaction.py @@ -32,6 +32,6 @@ class Reaction(BaseModel): img_url: Optional[str] = FieldInfo(alias="imgURL", default=None) """URL to the reaction's image. - May be temporary or local-only to this device; download promptly if durable + May be temporary or available only on this device; download promptly if durable access is needed. """ diff --git a/src/beeper_desktop_api/types/shared/user.py b/src/beeper_desktop_api/types/shared/user.py index f77a31f..2f170ab 100644 --- a/src/beeper_desktop_api/types/shared/user.py +++ b/src/beeper_desktop_api/types/shared/user.py @@ -30,9 +30,9 @@ class User(BaseModel): img_url: Optional[str] = FieldInfo(alias="imgURL", default=None) """Avatar image URL if available. - This may be a remote URL, Matrix media URL, data URL, or local filesystem URL - depending on source and endpoint. May be temporary or local-only to this device; - download promptly if durable access is needed. + This may be a remote URL, media URL, data URL, or local file URL depending on + the source. May be temporary or available only on this device; download promptly + if durable access is needed. """ is_self: Optional[bool] = FieldInfo(alias="isSelf", default=None) diff --git a/tests/api_resources/app/e2ee/recovery_code/test_reset.py b/tests/api_resources/app/e2ee/recovery_code/test_reset.py deleted file mode 100644 index 34aae1f..0000000 --- a/tests/api_resources/app/e2ee/recovery_code/test_reset.py +++ /dev/null @@ -1,153 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.app.e2ee.recovery_code import ( - ResetCreateResponse, - ResetConfirmResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestReset: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: BeeperDesktop) -> None: - reset = client.app.e2ee.recovery_code.reset.create() - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: - reset = client.app.e2ee.recovery_code.reset.create( - recovery_code="recoveryCode", - ) - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.recovery_code.reset.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - reset = response.parse() - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: BeeperDesktop) -> None: - with client.app.e2ee.recovery_code.reset.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - reset = response.parse() - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_confirm(self, client: BeeperDesktop) -> None: - reset = client.app.e2ee.recovery_code.reset.confirm( - recovery_code="x", - ) - assert_matches_type(ResetConfirmResponse, reset, path=["response"]) - - @parametrize - def test_raw_response_confirm(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.recovery_code.reset.with_raw_response.confirm( - recovery_code="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - reset = response.parse() - assert_matches_type(ResetConfirmResponse, reset, path=["response"]) - - @parametrize - def test_streaming_response_confirm(self, client: BeeperDesktop) -> None: - with client.app.e2ee.recovery_code.reset.with_streaming_response.confirm( - recovery_code="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - reset = response.parse() - assert_matches_type(ResetConfirmResponse, reset, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncReset: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: - reset = await async_client.app.e2ee.recovery_code.reset.create() - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - reset = await async_client.app.e2ee.recovery_code.reset.create( - recovery_code="recoveryCode", - ) - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.recovery_code.reset.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - reset = await response.parse() - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.recovery_code.reset.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - reset = await response.parse() - assert_matches_type(ResetCreateResponse, reset, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_confirm(self, async_client: AsyncBeeperDesktop) -> None: - reset = await async_client.app.e2ee.recovery_code.reset.confirm( - recovery_code="x", - ) - assert_matches_type(ResetConfirmResponse, reset, path=["response"]) - - @parametrize - async def test_raw_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.recovery_code.reset.with_raw_response.confirm( - recovery_code="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - reset = await response.parse() - assert_matches_type(ResetConfirmResponse, reset, path=["response"]) - - @parametrize - async def test_streaming_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.recovery_code.reset.with_streaming_response.confirm( - recovery_code="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - reset = await response.parse() - assert_matches_type(ResetConfirmResponse, reset, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/e2ee/test_recovery_code.py b/tests/api_resources/app/e2ee/test_recovery_code.py deleted file mode 100644 index c7caaf9..0000000 --- a/tests/api_resources/app/e2ee/test_recovery_code.py +++ /dev/null @@ -1,139 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.app.e2ee import ( - RecoveryCodeVerifyResponse, - RecoveryCodeMarkBackedUpResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRecoveryCode: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_mark_backed_up(self, client: BeeperDesktop) -> None: - recovery_code = client.app.e2ee.recovery_code.mark_backed_up() - assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) - - @parametrize - def test_raw_response_mark_backed_up(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.recovery_code.with_raw_response.mark_backed_up() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - recovery_code = response.parse() - assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) - - @parametrize - def test_streaming_response_mark_backed_up(self, client: BeeperDesktop) -> None: - with client.app.e2ee.recovery_code.with_streaming_response.mark_backed_up() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - recovery_code = response.parse() - assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_verify(self, client: BeeperDesktop) -> None: - recovery_code = client.app.e2ee.recovery_code.verify( - recovery_code="x", - ) - assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) - - @parametrize - def test_raw_response_verify(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.recovery_code.with_raw_response.verify( - recovery_code="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - recovery_code = response.parse() - assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) - - @parametrize - def test_streaming_response_verify(self, client: BeeperDesktop) -> None: - with client.app.e2ee.recovery_code.with_streaming_response.verify( - recovery_code="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - recovery_code = response.parse() - assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncRecoveryCode: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_mark_backed_up(self, async_client: AsyncBeeperDesktop) -> None: - recovery_code = await async_client.app.e2ee.recovery_code.mark_backed_up() - assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) - - @parametrize - async def test_raw_response_mark_backed_up(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.recovery_code.with_raw_response.mark_backed_up() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - recovery_code = await response.parse() - assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) - - @parametrize - async def test_streaming_response_mark_backed_up(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.recovery_code.with_streaming_response.mark_backed_up() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - recovery_code = await response.parse() - assert_matches_type(RecoveryCodeMarkBackedUpResponse, recovery_code, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_verify(self, async_client: AsyncBeeperDesktop) -> None: - recovery_code = await async_client.app.e2ee.recovery_code.verify( - recovery_code="x", - ) - assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) - - @parametrize - async def test_raw_response_verify(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.recovery_code.with_raw_response.verify( - recovery_code="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - recovery_code = await response.parse() - assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) - - @parametrize - async def test_streaming_response_verify(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.recovery_code.with_streaming_response.verify( - recovery_code="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - recovery_code = await response.parse() - assert_matches_type(RecoveryCodeVerifyResponse, recovery_code, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/e2ee/test_verification.py b/tests/api_resources/app/e2ee/test_verification.py deleted file mode 100644 index 1700f2d..0000000 --- a/tests/api_resources/app/e2ee/test_verification.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.app.e2ee import ( - VerificationAcceptResponse, - VerificationCancelResponse, - VerificationCreateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestVerification: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: BeeperDesktop) -> None: - verification = client.app.e2ee.verification.create() - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: - verification = client.app.e2ee.verification.create( - user_id="userID", - ) - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.verification.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - verification = response.parse() - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: BeeperDesktop) -> None: - with client.app.e2ee.verification.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - verification = response.parse() - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_accept(self, client: BeeperDesktop) -> None: - verification = client.app.e2ee.verification.accept( - "x", - ) - assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) - - @parametrize - def test_raw_response_accept(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.verification.with_raw_response.accept( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - verification = response.parse() - assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) - - @parametrize - def test_streaming_response_accept(self, client: BeeperDesktop) -> None: - with client.app.e2ee.verification.with_streaming_response.accept( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - verification = response.parse() - assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_accept(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - client.app.e2ee.verification.with_raw_response.accept( - "", - ) - - @parametrize - def test_method_cancel(self, client: BeeperDesktop) -> None: - verification = client.app.e2ee.verification.cancel( - verification_id="x", - ) - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - @parametrize - def test_method_cancel_with_all_params(self, client: BeeperDesktop) -> None: - verification = client.app.e2ee.verification.cancel( - verification_id="x", - code="code", - reason="reason", - ) - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - @parametrize - def test_raw_response_cancel(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.verification.with_raw_response.cancel( - verification_id="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - verification = response.parse() - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - @parametrize - def test_streaming_response_cancel(self, client: BeeperDesktop) -> None: - with client.app.e2ee.verification.with_streaming_response.cancel( - verification_id="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - verification = response.parse() - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_cancel(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - client.app.e2ee.verification.with_raw_response.cancel( - verification_id="", - ) - - -class TestAsyncVerification: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: - verification = await async_client.app.e2ee.verification.create() - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - verification = await async_client.app.e2ee.verification.create( - user_id="userID", - ) - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.verification.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - verification = await response.parse() - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.verification.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - verification = await response.parse() - assert_matches_type(VerificationCreateResponse, verification, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_accept(self, async_client: AsyncBeeperDesktop) -> None: - verification = await async_client.app.e2ee.verification.accept( - "x", - ) - assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) - - @parametrize - async def test_raw_response_accept(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.verification.with_raw_response.accept( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - verification = await response.parse() - assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) - - @parametrize - async def test_streaming_response_accept(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.verification.with_streaming_response.accept( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - verification = await response.parse() - assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_accept(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - await async_client.app.e2ee.verification.with_raw_response.accept( - "", - ) - - @parametrize - async def test_method_cancel(self, async_client: AsyncBeeperDesktop) -> None: - verification = await async_client.app.e2ee.verification.cancel( - verification_id="x", - ) - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - @parametrize - async def test_method_cancel_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - verification = await async_client.app.e2ee.verification.cancel( - verification_id="x", - code="code", - reason="reason", - ) - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - @parametrize - async def test_raw_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.verification.with_raw_response.cancel( - verification_id="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - verification = await response.parse() - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - @parametrize - async def test_streaming_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.verification.with_streaming_response.cancel( - verification_id="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - verification = await response.parse() - assert_matches_type(VerificationCancelResponse, verification, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_cancel(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - await async_client.app.e2ee.verification.with_raw_response.cancel( - verification_id="", - ) diff --git a/tests/api_resources/app/e2ee/verification/test_qr.py b/tests/api_resources/app/e2ee/verification/test_qr.py deleted file mode 100644 index 9eb8e0c..0000000 --- a/tests/api_resources/app/e2ee/verification/test_qr.py +++ /dev/null @@ -1,162 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.app.e2ee.verification import QrScanResponse, QrConfirmScannedResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestQr: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_confirm_scanned(self, client: BeeperDesktop) -> None: - qr = client.app.e2ee.verification.qr.confirm_scanned( - "x", - ) - assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) - - @parametrize - def test_raw_response_confirm_scanned(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - qr = response.parse() - assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) - - @parametrize - def test_streaming_response_confirm_scanned(self, client: BeeperDesktop) -> None: - with client.app.e2ee.verification.qr.with_streaming_response.confirm_scanned( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - qr = response.parse() - assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_confirm_scanned(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( - "", - ) - - @parametrize - def test_method_scan(self, client: BeeperDesktop) -> None: - qr = client.app.e2ee.verification.qr.scan( - data="x", - ) - assert_matches_type(QrScanResponse, qr, path=["response"]) - - @parametrize - def test_raw_response_scan(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.verification.qr.with_raw_response.scan( - data="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - qr = response.parse() - assert_matches_type(QrScanResponse, qr, path=["response"]) - - @parametrize - def test_streaming_response_scan(self, client: BeeperDesktop) -> None: - with client.app.e2ee.verification.qr.with_streaming_response.scan( - data="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - qr = response.parse() - assert_matches_type(QrScanResponse, qr, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncQr: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: - qr = await async_client.app.e2ee.verification.qr.confirm_scanned( - "x", - ) - assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) - - @parametrize - async def test_raw_response_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - qr = await response.parse() - assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) - - @parametrize - async def test_streaming_response_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.verification.qr.with_streaming_response.confirm_scanned( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - qr = await response.parse() - assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - await async_client.app.e2ee.verification.qr.with_raw_response.confirm_scanned( - "", - ) - - @parametrize - async def test_method_scan(self, async_client: AsyncBeeperDesktop) -> None: - qr = await async_client.app.e2ee.verification.qr.scan( - data="x", - ) - assert_matches_type(QrScanResponse, qr, path=["response"]) - - @parametrize - async def test_raw_response_scan(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.verification.qr.with_raw_response.scan( - data="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - qr = await response.parse() - assert_matches_type(QrScanResponse, qr, path=["response"]) - - @parametrize - async def test_streaming_response_scan(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.verification.qr.with_streaming_response.scan( - data="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - qr = await response.parse() - assert_matches_type(QrScanResponse, qr, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/e2ee/verification/test_sas.py b/tests/api_resources/app/e2ee/verification/test_sas.py deleted file mode 100644 index 7a8c43c..0000000 --- a/tests/api_resources/app/e2ee/verification/test_sas.py +++ /dev/null @@ -1,176 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.app.e2ee.verification import SaStartResponse, SaConfirmResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSas: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_confirm(self, client: BeeperDesktop) -> None: - sa = client.app.e2ee.verification.sas.confirm( - "x", - ) - assert_matches_type(SaConfirmResponse, sa, path=["response"]) - - @parametrize - def test_raw_response_confirm(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.verification.sas.with_raw_response.confirm( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sa = response.parse() - assert_matches_type(SaConfirmResponse, sa, path=["response"]) - - @parametrize - def test_streaming_response_confirm(self, client: BeeperDesktop) -> None: - with client.app.e2ee.verification.sas.with_streaming_response.confirm( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sa = response.parse() - assert_matches_type(SaConfirmResponse, sa, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_confirm(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - client.app.e2ee.verification.sas.with_raw_response.confirm( - "", - ) - - @parametrize - def test_method_start(self, client: BeeperDesktop) -> None: - sa = client.app.e2ee.verification.sas.start( - "x", - ) - assert_matches_type(SaStartResponse, sa, path=["response"]) - - @parametrize - def test_raw_response_start(self, client: BeeperDesktop) -> None: - response = client.app.e2ee.verification.sas.with_raw_response.start( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sa = response.parse() - assert_matches_type(SaStartResponse, sa, path=["response"]) - - @parametrize - def test_streaming_response_start(self, client: BeeperDesktop) -> None: - with client.app.e2ee.verification.sas.with_streaming_response.start( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sa = response.parse() - assert_matches_type(SaStartResponse, sa, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_start(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - client.app.e2ee.verification.sas.with_raw_response.start( - "", - ) - - -class TestAsyncSas: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_confirm(self, async_client: AsyncBeeperDesktop) -> None: - sa = await async_client.app.e2ee.verification.sas.confirm( - "x", - ) - assert_matches_type(SaConfirmResponse, sa, path=["response"]) - - @parametrize - async def test_raw_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.verification.sas.with_raw_response.confirm( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sa = await response.parse() - assert_matches_type(SaConfirmResponse, sa, path=["response"]) - - @parametrize - async def test_streaming_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.verification.sas.with_streaming_response.confirm( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sa = await response.parse() - assert_matches_type(SaConfirmResponse, sa, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_confirm(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - await async_client.app.e2ee.verification.sas.with_raw_response.confirm( - "", - ) - - @parametrize - async def test_method_start(self, async_client: AsyncBeeperDesktop) -> None: - sa = await async_client.app.e2ee.verification.sas.start( - "x", - ) - assert_matches_type(SaStartResponse, sa, path=["response"]) - - @parametrize - async def test_raw_response_start(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.e2ee.verification.sas.with_raw_response.start( - "x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sa = await response.parse() - assert_matches_type(SaStartResponse, sa, path=["response"]) - - @parametrize - async def test_streaming_response_start(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.e2ee.verification.sas.with_streaming_response.start( - "x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sa = await response.parse() - assert_matches_type(SaStartResponse, sa, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_start(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): - await async_client.app.e2ee.verification.sas.with_raw_response.start( - "", - ) diff --git a/tests/api_resources/app/test_login.py b/tests/api_resources/app/test_login.py deleted file mode 100644 index 7963136..0000000 --- a/tests/api_resources/app/test_login.py +++ /dev/null @@ -1,294 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.app import ( - LoginStartResponse, - LoginRegisterResponse, - LoginResponseResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestLogin: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_email(self, client: BeeperDesktop) -> None: - login = client.app.login.email( - email="dev@stainless.com", - request="request", - ) - assert_matches_type(object, login, path=["response"]) - - @parametrize - def test_raw_response_email(self, client: BeeperDesktop) -> None: - response = client.app.login.with_raw_response.email( - email="dev@stainless.com", - request="request", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = response.parse() - assert_matches_type(object, login, path=["response"]) - - @parametrize - def test_streaming_response_email(self, client: BeeperDesktop) -> None: - with client.app.login.with_streaming_response.email( - email="dev@stainless.com", - request="request", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = response.parse() - assert_matches_type(object, login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_register(self, client: BeeperDesktop) -> None: - login = client.app.login.register( - accept_terms=True, - lead_token="leadToken", - request="request", - username="x", - ) - assert_matches_type(LoginRegisterResponse, login, path=["response"]) - - @parametrize - def test_raw_response_register(self, client: BeeperDesktop) -> None: - response = client.app.login.with_raw_response.register( - accept_terms=True, - lead_token="leadToken", - request="request", - username="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = response.parse() - assert_matches_type(LoginRegisterResponse, login, path=["response"]) - - @parametrize - def test_streaming_response_register(self, client: BeeperDesktop) -> None: - with client.app.login.with_streaming_response.register( - accept_terms=True, - lead_token="leadToken", - request="request", - username="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = response.parse() - assert_matches_type(LoginRegisterResponse, login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_response(self, client: BeeperDesktop) -> None: - login = client.app.login.response( - request="request", - response="response", - ) - assert_matches_type(LoginResponseResponse, login, path=["response"]) - - @parametrize - def test_raw_response_response(self, client: BeeperDesktop) -> None: - response = client.app.login.with_raw_response.response( - request="request", - response="response", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = response.parse() - assert_matches_type(LoginResponseResponse, login, path=["response"]) - - @parametrize - def test_streaming_response_response(self, client: BeeperDesktop) -> None: - with client.app.login.with_streaming_response.response( - request="request", - response="response", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = response.parse() - assert_matches_type(LoginResponseResponse, login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_start(self, client: BeeperDesktop) -> None: - login = client.app.login.start() - assert_matches_type(LoginStartResponse, login, path=["response"]) - - @parametrize - def test_raw_response_start(self, client: BeeperDesktop) -> None: - response = client.app.login.with_raw_response.start() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = response.parse() - assert_matches_type(LoginStartResponse, login, path=["response"]) - - @parametrize - def test_streaming_response_start(self, client: BeeperDesktop) -> None: - with client.app.login.with_streaming_response.start() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = response.parse() - assert_matches_type(LoginStartResponse, login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncLogin: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_email(self, async_client: AsyncBeeperDesktop) -> None: - login = await async_client.app.login.email( - email="dev@stainless.com", - request="request", - ) - assert_matches_type(object, login, path=["response"]) - - @parametrize - async def test_raw_response_email(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.login.with_raw_response.email( - email="dev@stainless.com", - request="request", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = await response.parse() - assert_matches_type(object, login, path=["response"]) - - @parametrize - async def test_streaming_response_email(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.login.with_streaming_response.email( - email="dev@stainless.com", - request="request", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = await response.parse() - assert_matches_type(object, login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_register(self, async_client: AsyncBeeperDesktop) -> None: - login = await async_client.app.login.register( - accept_terms=True, - lead_token="leadToken", - request="request", - username="x", - ) - assert_matches_type(LoginRegisterResponse, login, path=["response"]) - - @parametrize - async def test_raw_response_register(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.login.with_raw_response.register( - accept_terms=True, - lead_token="leadToken", - request="request", - username="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = await response.parse() - assert_matches_type(LoginRegisterResponse, login, path=["response"]) - - @parametrize - async def test_streaming_response_register(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.login.with_streaming_response.register( - accept_terms=True, - lead_token="leadToken", - request="request", - username="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = await response.parse() - assert_matches_type(LoginRegisterResponse, login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_response(self, async_client: AsyncBeeperDesktop) -> None: - login = await async_client.app.login.response( - request="request", - response="response", - ) - assert_matches_type(LoginResponseResponse, login, path=["response"]) - - @parametrize - async def test_raw_response_response(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.login.with_raw_response.response( - request="request", - response="response", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = await response.parse() - assert_matches_type(LoginResponseResponse, login, path=["response"]) - - @parametrize - async def test_streaming_response_response(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.login.with_streaming_response.response( - request="request", - response="response", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = await response.parse() - assert_matches_type(LoginResponseResponse, login, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_start(self, async_client: AsyncBeeperDesktop) -> None: - login = await async_client.app.login.start() - assert_matches_type(LoginStartResponse, login, path=["response"]) - - @parametrize - async def test_raw_response_start(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.login.with_raw_response.start() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - login = await response.parse() - assert_matches_type(LoginStartResponse, login, path=["response"]) - - @parametrize - async def test_streaming_response_start(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.login.with_streaming_response.start() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - login = await response.parse() - assert_matches_type(LoginStartResponse, login, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/__init__.py b/tests/api_resources/bridges/__init__.py similarity index 100% rename from tests/api_resources/app/__init__.py rename to tests/api_resources/bridges/__init__.py diff --git a/tests/api_resources/app/e2ee/__init__.py b/tests/api_resources/bridges/login_sessions/__init__.py similarity index 100% rename from tests/api_resources/app/e2ee/__init__.py rename to tests/api_resources/bridges/login_sessions/__init__.py diff --git a/tests/api_resources/bridges/login_sessions/test_steps.py b/tests/api_resources/bridges/login_sessions/test_steps.py new file mode 100644 index 0000000..7b8f9b4 --- /dev/null +++ b/tests/api_resources/bridges/login_sessions/test_steps.py @@ -0,0 +1,182 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types import LoginSession + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSteps: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_submit(self, client: BeeperDesktop) -> None: + step = client.bridges.login_sessions.steps.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) + assert_matches_type(LoginSession, step, path=["response"]) + + @parametrize + def test_method_submit_with_all_params(self, client: BeeperDesktop) -> None: + step = client.bridges.login_sessions.steps.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + fields={"foo": "string"}, + last_url="lastURL", + source="api", + ) + assert_matches_type(LoginSession, step, path=["response"]) + + @parametrize + def test_raw_response_submit(self, client: BeeperDesktop) -> None: + response = client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + step = response.parse() + assert_matches_type(LoginSession, step, path=["response"]) + + @parametrize + def test_streaming_response_submit(self, client: BeeperDesktop) -> None: + with client.bridges.login_sessions.steps.with_streaming_response.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + step = response.parse() + assert_matches_type(LoginSession, step, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_submit(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="x", + bridge_id="", + login_session_id="123", + type="user_input", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_session_id` but received ''"): + client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="", + type="user_input", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) + + +class TestAsyncSteps: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_submit(self, async_client: AsyncBeeperDesktop) -> None: + step = await async_client.bridges.login_sessions.steps.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) + assert_matches_type(LoginSession, step, path=["response"]) + + @parametrize + async def test_method_submit_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + step = await async_client.bridges.login_sessions.steps.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + fields={"foo": "string"}, + last_url="lastURL", + source="api", + ) + assert_matches_type(LoginSession, step, path=["response"]) + + @parametrize + async def test_raw_response_submit(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + step = await response.parse() + assert_matches_type(LoginSession, step, path=["response"]) + + @parametrize + async def test_streaming_response_submit(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.bridges.login_sessions.steps.with_streaming_response.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + step = await response.parse() + assert_matches_type(LoginSession, step, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="x", + bridge_id="", + login_session_id="123", + type="user_input", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_session_id` but received ''"): + await async_client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="x", + bridge_id="local-whatsapp", + login_session_id="", + type="user_input", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): + await async_client.bridges.login_sessions.steps.with_raw_response.submit( + step_id="", + bridge_id="local-whatsapp", + login_session_id="123", + type="user_input", + ) diff --git a/tests/api_resources/matrix/bridges/test_contacts.py b/tests/api_resources/bridges/test_login_flows.py similarity index 50% rename from tests/api_resources/matrix/bridges/test_contacts.py rename to tests/api_resources/bridges/test_login_flows.py index a5e9913..d14a6fb 100644 --- a/tests/api_resources/matrix/bridges/test_contacts.py +++ b/tests/api_resources/bridges/test_login_flows.py @@ -9,108 +9,92 @@ from tests.utils import assert_matches_type from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix.bridges import ContactListResponse +from beeper_desktop_api.types.bridges import LoginFlowListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestContacts: +class TestLoginFlows: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: BeeperDesktop) -> None: - contact = client.matrix.bridges.contacts.list( - bridge_id="bridgeID", + login_flow = client.bridges.login_flows.list( + "local-whatsapp", ) - assert_matches_type(ContactListResponse, contact, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: BeeperDesktop) -> None: - contact = client.matrix.bridges.contacts.list( - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - ) - assert_matches_type(ContactListResponse, contact, path=["response"]) + assert_matches_type(LoginFlowListResponse, login_flow, path=["response"]) @parametrize def test_raw_response_list(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.contacts.with_raw_response.list( - bridge_id="bridgeID", + response = client.bridges.login_flows.with_raw_response.list( + "local-whatsapp", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - contact = response.parse() - assert_matches_type(ContactListResponse, contact, path=["response"]) + login_flow = response.parse() + assert_matches_type(LoginFlowListResponse, login_flow, path=["response"]) @parametrize def test_streaming_response_list(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.contacts.with_streaming_response.list( - bridge_id="bridgeID", + with client.bridges.login_flows.with_streaming_response.list( + "local-whatsapp", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - contact = response.parse() - assert_matches_type(ContactListResponse, contact, path=["response"]) + login_flow = response.parse() + assert_matches_type(LoginFlowListResponse, login_flow, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: BeeperDesktop) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.contacts.with_raw_response.list( - bridge_id="", + client.bridges.login_flows.with_raw_response.list( + "", ) -class TestAsyncContacts: +class TestAsyncLoginFlows: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: - contact = await async_client.matrix.bridges.contacts.list( - bridge_id="bridgeID", - ) - assert_matches_type(ContactListResponse, contact, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - contact = await async_client.matrix.bridges.contacts.list( - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", + login_flow = await async_client.bridges.login_flows.list( + "local-whatsapp", ) - assert_matches_type(ContactListResponse, contact, path=["response"]) + assert_matches_type(LoginFlowListResponse, login_flow, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.contacts.with_raw_response.list( - bridge_id="bridgeID", + response = await async_client.bridges.login_flows.with_raw_response.list( + "local-whatsapp", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - contact = await response.parse() - assert_matches_type(ContactListResponse, contact, path=["response"]) + login_flow = await response.parse() + assert_matches_type(LoginFlowListResponse, login_flow, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.contacts.with_streaming_response.list( - bridge_id="bridgeID", + async with async_client.bridges.login_flows.with_streaming_response.list( + "local-whatsapp", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - contact = await response.parse() - assert_matches_type(ContactListResponse, contact, path=["response"]) + login_flow = await response.parse() + assert_matches_type(LoginFlowListResponse, login_flow, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncBeeperDesktop) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.contacts.with_raw_response.list( - bridge_id="", + await async_client.bridges.login_flows.with_raw_response.list( + "", ) diff --git a/tests/api_resources/bridges/test_login_sessions.py b/tests/api_resources/bridges/test_login_sessions.py new file mode 100644 index 0000000..adf87f8 --- /dev/null +++ b/tests/api_resources/bridges/test_login_sessions.py @@ -0,0 +1,313 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types import LoginSession +from beeper_desktop_api.types.bridges import LoginSessionCancelResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLoginSessions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: BeeperDesktop) -> None: + login_session = client.bridges.login_sessions.create( + bridge_id="local-whatsapp", + ) + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: + login_session = client.bridges.login_sessions.create( + bridge_id="local-whatsapp", + account_id="x", + flow_id="x", + login_id="x", + ) + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: BeeperDesktop) -> None: + response = client.bridges.login_sessions.with_raw_response.create( + bridge_id="local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login_session = response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: BeeperDesktop) -> None: + with client.bridges.login_sessions.with_streaming_response.create( + bridge_id="local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login_session = response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.bridges.login_sessions.with_raw_response.create( + bridge_id="", + ) + + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + login_session = client.bridges.login_sessions.retrieve( + login_session_id="123", + bridge_id="local-whatsapp", + ) + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.bridges.login_sessions.with_raw_response.retrieve( + login_session_id="123", + bridge_id="local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login_session = response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.bridges.login_sessions.with_streaming_response.retrieve( + login_session_id="123", + bridge_id="local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login_session = response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.bridges.login_sessions.with_raw_response.retrieve( + login_session_id="123", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_session_id` but received ''"): + client.bridges.login_sessions.with_raw_response.retrieve( + login_session_id="", + bridge_id="local-whatsapp", + ) + + @parametrize + def test_method_cancel(self, client: BeeperDesktop) -> None: + login_session = client.bridges.login_sessions.cancel( + login_session_id="123", + bridge_id="local-whatsapp", + ) + assert_matches_type(LoginSessionCancelResponse, login_session, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: BeeperDesktop) -> None: + response = client.bridges.login_sessions.with_raw_response.cancel( + login_session_id="123", + bridge_id="local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login_session = response.parse() + assert_matches_type(LoginSessionCancelResponse, login_session, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: BeeperDesktop) -> None: + with client.bridges.login_sessions.with_streaming_response.cancel( + login_session_id="123", + bridge_id="local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login_session = response.parse() + assert_matches_type(LoginSessionCancelResponse, login_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.bridges.login_sessions.with_raw_response.cancel( + login_session_id="123", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_session_id` but received ''"): + client.bridges.login_sessions.with_raw_response.cancel( + login_session_id="", + bridge_id="local-whatsapp", + ) + + +class TestAsyncLoginSessions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: + login_session = await async_client.bridges.login_sessions.create( + bridge_id="local-whatsapp", + ) + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + login_session = await async_client.bridges.login_sessions.create( + bridge_id="local-whatsapp", + account_id="x", + flow_id="x", + login_id="x", + ) + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.bridges.login_sessions.with_raw_response.create( + bridge_id="local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login_session = await response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.bridges.login_sessions.with_streaming_response.create( + bridge_id="local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login_session = await response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.bridges.login_sessions.with_raw_response.create( + bridge_id="", + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + login_session = await async_client.bridges.login_sessions.retrieve( + login_session_id="123", + bridge_id="local-whatsapp", + ) + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.bridges.login_sessions.with_raw_response.retrieve( + login_session_id="123", + bridge_id="local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login_session = await response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.bridges.login_sessions.with_streaming_response.retrieve( + login_session_id="123", + bridge_id="local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login_session = await response.parse() + assert_matches_type(LoginSession, login_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.bridges.login_sessions.with_raw_response.retrieve( + login_session_id="123", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_session_id` but received ''"): + await async_client.bridges.login_sessions.with_raw_response.retrieve( + login_session_id="", + bridge_id="local-whatsapp", + ) + + @parametrize + async def test_method_cancel(self, async_client: AsyncBeeperDesktop) -> None: + login_session = await async_client.bridges.login_sessions.cancel( + login_session_id="123", + bridge_id="local-whatsapp", + ) + assert_matches_type(LoginSessionCancelResponse, login_session, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.bridges.login_sessions.with_raw_response.cancel( + login_session_id="123", + bridge_id="local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login_session = await response.parse() + assert_matches_type(LoginSessionCancelResponse, login_session, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.bridges.login_sessions.with_streaming_response.cancel( + login_session_id="123", + bridge_id="local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login_session = await response.parse() + assert_matches_type(LoginSessionCancelResponse, login_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.bridges.login_sessions.with_raw_response.cancel( + login_session_id="123", + bridge_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_session_id` but received ''"): + await async_client.bridges.login_sessions.with_raw_response.cancel( + login_session_id="", + bridge_id="local-whatsapp", + ) diff --git a/tests/api_resources/matrix/bridges/test_auth.py b/tests/api_resources/matrix/bridges/test_auth.py deleted file mode 100644 index bdb57e4..0000000 --- a/tests/api_resources/matrix/bridges/test_auth.py +++ /dev/null @@ -1,854 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix.bridges import ( - AuthWhoamiResponse, - AuthListFlowsResponse, - AuthListLoginsResponse, - AuthStartLoginResponse, - AuthWaitForStepResponse, - AuthSubmitCookiesResponse, - AuthSubmitUserInputResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAuth: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list_flows(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.list_flows( - "bridgeID", - ) - assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) - - @parametrize - def test_raw_response_list_flows(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.list_flows( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) - - @parametrize - def test_streaming_response_list_flows(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.list_flows( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list_flows(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.list_flows( - "", - ) - - @parametrize - def test_method_list_logins(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.list_logins( - "bridgeID", - ) - assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) - - @parametrize - def test_raw_response_list_logins(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.list_logins( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) - - @parametrize - def test_streaming_response_list_logins(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.list_logins( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list_logins(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.list_logins( - "", - ) - - @parametrize - def test_method_logout(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="bridgeID", - ) - assert_matches_type(object, auth, path=["response"]) - - @parametrize - def test_raw_response_logout(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(object, auth, path=["response"]) - - @parametrize - def test_streaming_response_logout(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(object, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_logout(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.logout( - login_id="", - bridge_id="bridgeID", - ) - - @parametrize - def test_method_start_login(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.start_login( - flow_id="qr", - bridge_id="bridgeID", - ) - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - @parametrize - def test_method_start_login_with_all_params(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.start_login( - flow_id="qr", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - ) - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - @parametrize - def test_raw_response_start_login(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.start_login( - flow_id="qr", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - @parametrize - def test_streaming_response_start_login(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.start_login( - flow_id="qr", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_start_login(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.start_login( - flow_id="qr", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.start_login( - flow_id="", - bridge_id="bridgeID", - ) - - @parametrize - def test_method_submit_cookies(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) - - @parametrize - def test_raw_response_submit_cookies(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) - - @parametrize - def test_streaming_response_submit_cookies(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_submit_cookies(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="stepID", - bridge_id="", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - @parametrize - def test_method_submit_user_input(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) - - @parametrize - def test_raw_response_submit_user_input(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) - - @parametrize - def test_streaming_response_submit_user_input(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_submit_user_input(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="stepID", - bridge_id="", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - @parametrize - def test_method_wait_for_step(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) - assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) - - @parametrize - def test_raw_response_wait_for_step(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) - - @parametrize - def test_streaming_response_wait_for_step(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_wait_for_step(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="stepID", - bridge_id="", - login_process_id="loginProcessID", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) - - @parametrize - def test_method_whoami(self, client: BeeperDesktop) -> None: - auth = client.matrix.bridges.auth.whoami( - "bridgeID", - ) - assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) - - @parametrize - def test_raw_response_whoami(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.auth.with_raw_response.whoami( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = response.parse() - assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) - - @parametrize - def test_streaming_response_whoami(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.auth.with_streaming_response.whoami( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = response.parse() - assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_whoami(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.auth.with_raw_response.whoami( - "", - ) - - -class TestAsyncAuth: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_list_flows(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.list_flows( - "bridgeID", - ) - assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) - - @parametrize - async def test_raw_response_list_flows(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.list_flows( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) - - @parametrize - async def test_streaming_response_list_flows(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.list_flows( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(AuthListFlowsResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list_flows(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.list_flows( - "", - ) - - @parametrize - async def test_method_list_logins(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.list_logins( - "bridgeID", - ) - assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) - - @parametrize - async def test_raw_response_list_logins(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.list_logins( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) - - @parametrize - async def test_streaming_response_list_logins(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.list_logins( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(AuthListLoginsResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list_logins(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.list_logins( - "", - ) - - @parametrize - async def test_method_logout(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="bridgeID", - ) - assert_matches_type(object, auth, path=["response"]) - - @parametrize - async def test_raw_response_logout(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(object, auth, path=["response"]) - - @parametrize - async def test_streaming_response_logout(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(object, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_logout(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.logout( - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.logout( - login_id="", - bridge_id="bridgeID", - ) - - @parametrize - async def test_method_start_login(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.start_login( - flow_id="qr", - bridge_id="bridgeID", - ) - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - @parametrize - async def test_method_start_login_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.start_login( - flow_id="qr", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - ) - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - @parametrize - async def test_raw_response_start_login(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.start_login( - flow_id="qr", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - @parametrize - async def test_streaming_response_start_login(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.start_login( - flow_id="qr", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(AuthStartLoginResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_start_login(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.start_login( - flow_id="qr", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `flow_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.start_login( - flow_id="", - bridge_id="bridgeID", - ) - - @parametrize - async def test_method_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) - - @parametrize - async def test_raw_response_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) - - @parametrize - async def test_streaming_response_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(AuthSubmitCookiesResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_submit_cookies(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="stepID", - bridge_id="", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.submit_cookies( - step_id="", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - @parametrize - async def test_method_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) - - @parametrize - async def test_raw_response_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) - - @parametrize - async def test_streaming_response_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(AuthSubmitUserInputResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_submit_user_input(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="stepID", - bridge_id="", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="", - body={"foo": "string"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.submit_user_input( - step_id="", - bridge_id="bridgeID", - login_process_id="loginProcessID", - body={"foo": "string"}, - ) - - @parametrize - async def test_method_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) - assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) - - @parametrize - async def test_raw_response_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) - - @parametrize - async def test_streaming_response_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(AuthWaitForStepResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_wait_for_step(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="stepID", - bridge_id="", - login_process_id="loginProcessID", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `login_process_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="stepID", - bridge_id="bridgeID", - login_process_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.wait_for_step( - step_id="", - bridge_id="bridgeID", - login_process_id="loginProcessID", - ) - - @parametrize - async def test_method_whoami(self, async_client: AsyncBeeperDesktop) -> None: - auth = await async_client.matrix.bridges.auth.whoami( - "bridgeID", - ) - assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) - - @parametrize - async def test_raw_response_whoami(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.auth.with_raw_response.whoami( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - auth = await response.parse() - assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) - - @parametrize - async def test_streaming_response_whoami(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.auth.with_streaming_response.whoami( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - auth = await response.parse() - assert_matches_type(AuthWhoamiResponse, auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_whoami(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.auth.with_raw_response.whoami( - "", - ) diff --git a/tests/api_resources/matrix/bridges/test_capabilities.py b/tests/api_resources/matrix/bridges/test_capabilities.py deleted file mode 100644 index c1c6fc7..0000000 --- a/tests/api_resources/matrix/bridges/test_capabilities.py +++ /dev/null @@ -1,100 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix.bridges import CapabilityRetrieveResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCapabilities: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: BeeperDesktop) -> None: - capability = client.matrix.bridges.capabilities.retrieve( - "bridgeID", - ) - assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.capabilities.with_raw_response.retrieve( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - capability = response.parse() - assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.capabilities.with_streaming_response.retrieve( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - capability = response.parse() - assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.capabilities.with_raw_response.retrieve( - "", - ) - - -class TestAsyncCapabilities: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - capability = await async_client.matrix.bridges.capabilities.retrieve( - "bridgeID", - ) - assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.capabilities.with_raw_response.retrieve( - "bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - capability = await response.parse() - assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.capabilities.with_streaming_response.retrieve( - "bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - capability = await response.parse() - assert_matches_type(CapabilityRetrieveResponse, capability, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.capabilities.with_raw_response.retrieve( - "", - ) diff --git a/tests/api_resources/matrix/bridges/test_rooms.py b/tests/api_resources/matrix/bridges/test_rooms.py deleted file mode 100644 index d637533..0000000 --- a/tests/api_resources/matrix/bridges/test_rooms.py +++ /dev/null @@ -1,279 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix.bridges import ( - RoomCreateDmResponse, - RoomCreateGroupResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRooms: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create_dm(self, client: BeeperDesktop) -> None: - room = client.matrix.bridges.rooms.create_dm( - identifier="identifier", - bridge_id="bridgeID", - ) - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - @parametrize - def test_method_create_dm_with_all_params(self, client: BeeperDesktop) -> None: - room = client.matrix.bridges.rooms.create_dm( - identifier="identifier", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - ) - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - @parametrize - def test_raw_response_create_dm(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.rooms.with_raw_response.create_dm( - identifier="identifier", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = response.parse() - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - @parametrize - def test_streaming_response_create_dm(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.rooms.with_streaming_response.create_dm( - identifier="identifier", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = response.parse() - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create_dm(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.rooms.with_raw_response.create_dm( - identifier="identifier", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.matrix.bridges.rooms.with_raw_response.create_dm( - identifier="", - bridge_id="bridgeID", - ) - - @parametrize - def test_method_create_group(self, client: BeeperDesktop) -> None: - room = client.matrix.bridges.rooms.create_group( - group_type="groupType", - bridge_id="bridgeID", - ) - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - @parametrize - def test_method_create_group_with_all_params(self, client: BeeperDesktop) -> None: - room = client.matrix.bridges.rooms.create_group( - group_type="groupType", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - avatar={"url": "url"}, - disappear={ - "timer": 0, - "type": "type", - }, - name={"name": "name"}, - parent={}, - participants=["string"], - room_id="room_id", - topic={"topic": "topic"}, - type="channel", - username="username", - ) - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - @parametrize - def test_raw_response_create_group(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.rooms.with_raw_response.create_group( - group_type="groupType", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = response.parse() - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - @parametrize - def test_streaming_response_create_group(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.rooms.with_streaming_response.create_group( - group_type="groupType", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = response.parse() - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create_group(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.rooms.with_raw_response.create_group( - group_type="groupType", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_type` but received ''"): - client.matrix.bridges.rooms.with_raw_response.create_group( - group_type="", - bridge_id="bridgeID", - ) - - -class TestAsyncRooms: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create_dm(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.bridges.rooms.create_dm( - identifier="identifier", - bridge_id="bridgeID", - ) - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - @parametrize - async def test_method_create_dm_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.bridges.rooms.create_dm( - identifier="identifier", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - ) - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - @parametrize - async def test_raw_response_create_dm(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.rooms.with_raw_response.create_dm( - identifier="identifier", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = await response.parse() - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - @parametrize - async def test_streaming_response_create_dm(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.rooms.with_streaming_response.create_dm( - identifier="identifier", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = await response.parse() - assert_matches_type(RoomCreateDmResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create_dm(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.rooms.with_raw_response.create_dm( - identifier="identifier", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.matrix.bridges.rooms.with_raw_response.create_dm( - identifier="", - bridge_id="bridgeID", - ) - - @parametrize - async def test_method_create_group(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.bridges.rooms.create_group( - group_type="groupType", - bridge_id="bridgeID", - ) - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - @parametrize - async def test_method_create_group_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.bridges.rooms.create_group( - group_type="groupType", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - avatar={"url": "url"}, - disappear={ - "timer": 0, - "type": "type", - }, - name={"name": "name"}, - parent={}, - participants=["string"], - room_id="room_id", - topic={"topic": "topic"}, - type="channel", - username="username", - ) - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - @parametrize - async def test_raw_response_create_group(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.rooms.with_raw_response.create_group( - group_type="groupType", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = await response.parse() - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - @parametrize - async def test_streaming_response_create_group(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.rooms.with_streaming_response.create_group( - group_type="groupType", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = await response.parse() - assert_matches_type(RoomCreateGroupResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create_group(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.rooms.with_raw_response.create_group( - group_type="groupType", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_type` but received ''"): - await async_client.matrix.bridges.rooms.with_raw_response.create_group( - group_type="", - bridge_id="bridgeID", - ) diff --git a/tests/api_resources/matrix/bridges/test_users.py b/tests/api_resources/matrix/bridges/test_users.py deleted file mode 100644 index 2e6e69d..0000000 --- a/tests/api_resources/matrix/bridges/test_users.py +++ /dev/null @@ -1,235 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix.bridges import ( - UserSearchResponse, - UserResolveResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_resolve(self, client: BeeperDesktop) -> None: - user = client.matrix.bridges.users.resolve( - identifier="identifier", - bridge_id="bridgeID", - ) - assert_matches_type(UserResolveResponse, user, path=["response"]) - - @parametrize - def test_method_resolve_with_all_params(self, client: BeeperDesktop) -> None: - user = client.matrix.bridges.users.resolve( - identifier="identifier", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - ) - assert_matches_type(UserResolveResponse, user, path=["response"]) - - @parametrize - def test_raw_response_resolve(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.users.with_raw_response.resolve( - identifier="identifier", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(UserResolveResponse, user, path=["response"]) - - @parametrize - def test_streaming_response_resolve(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.users.with_streaming_response.resolve( - identifier="identifier", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(UserResolveResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_resolve(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.users.with_raw_response.resolve( - identifier="identifier", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.matrix.bridges.users.with_raw_response.resolve( - identifier="", - bridge_id="bridgeID", - ) - - @parametrize - def test_method_search(self, client: BeeperDesktop) -> None: - user = client.matrix.bridges.users.search( - bridge_id="bridgeID", - ) - assert_matches_type(UserSearchResponse, user, path=["response"]) - - @parametrize - def test_method_search_with_all_params(self, client: BeeperDesktop) -> None: - user = client.matrix.bridges.users.search( - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - query="query", - ) - assert_matches_type(UserSearchResponse, user, path=["response"]) - - @parametrize - def test_raw_response_search(self, client: BeeperDesktop) -> None: - response = client.matrix.bridges.users.with_raw_response.search( - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(UserSearchResponse, user, path=["response"]) - - @parametrize - def test_streaming_response_search(self, client: BeeperDesktop) -> None: - with client.matrix.bridges.users.with_streaming_response.search( - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(UserSearchResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_search(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - client.matrix.bridges.users.with_raw_response.search( - bridge_id="", - ) - - -class TestAsyncUsers: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_resolve(self, async_client: AsyncBeeperDesktop) -> None: - user = await async_client.matrix.bridges.users.resolve( - identifier="identifier", - bridge_id="bridgeID", - ) - assert_matches_type(UserResolveResponse, user, path=["response"]) - - @parametrize - async def test_method_resolve_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - user = await async_client.matrix.bridges.users.resolve( - identifier="identifier", - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - ) - assert_matches_type(UserResolveResponse, user, path=["response"]) - - @parametrize - async def test_raw_response_resolve(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.users.with_raw_response.resolve( - identifier="identifier", - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(UserResolveResponse, user, path=["response"]) - - @parametrize - async def test_streaming_response_resolve(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.users.with_streaming_response.resolve( - identifier="identifier", - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(UserResolveResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_resolve(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.users.with_raw_response.resolve( - identifier="identifier", - bridge_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.matrix.bridges.users.with_raw_response.resolve( - identifier="", - bridge_id="bridgeID", - ) - - @parametrize - async def test_method_search(self, async_client: AsyncBeeperDesktop) -> None: - user = await async_client.matrix.bridges.users.search( - bridge_id="bridgeID", - ) - assert_matches_type(UserSearchResponse, user, path=["response"]) - - @parametrize - async def test_method_search_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - user = await async_client.matrix.bridges.users.search( - bridge_id="bridgeID", - login_id="bcc68892-b180-414f-9516-b4aadf7d0496", - query="query", - ) - assert_matches_type(UserSearchResponse, user, path=["response"]) - - @parametrize - async def test_raw_response_search(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.bridges.users.with_raw_response.search( - bridge_id="bridgeID", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(UserSearchResponse, user, path=["response"]) - - @parametrize - async def test_streaming_response_search(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.bridges.users.with_streaming_response.search( - bridge_id="bridgeID", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(UserSearchResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_search(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): - await async_client.matrix.bridges.users.with_raw_response.search( - bridge_id="", - ) diff --git a/tests/api_resources/matrix/rooms/__init__.py b/tests/api_resources/matrix/rooms/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/matrix/rooms/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/matrix/rooms/test_account_data.py b/tests/api_resources/matrix/rooms/test_account_data.py deleted file mode 100644 index 913996c..0000000 --- a/tests/api_resources/matrix/rooms/test_account_data.py +++ /dev/null @@ -1,275 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAccountData: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: BeeperDesktop) -> None: - account_data = client.matrix.rooms.account_data.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.account_data.with_raw_response.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.account_data.with_streaming_response.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.matrix.rooms.account_data.with_raw_response.retrieve( - type="org.example.custom.room.config", - user_id="", - room_id="!726s6s6q:example.com", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - client.matrix.rooms.account_data.with_raw_response.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - client.matrix.rooms.account_data.with_raw_response.retrieve( - type="", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) - - @parametrize - def test_method_update(self, client: BeeperDesktop) -> None: - account_data = client.matrix.rooms.account_data.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.account_data.with_raw_response.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.account_data.with_streaming_response.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.matrix.rooms.account_data.with_raw_response.update( - type="org.example.custom.room.config", - user_id="", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - client.matrix.rooms.account_data.with_raw_response.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - client.matrix.rooms.account_data.with_raw_response.update( - type="", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - - -class TestAsyncAccountData: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - account_data = await async_client.matrix.rooms.account_data.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.account_data.with_raw_response.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.account_data.with_streaming_response.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.matrix.rooms.account_data.with_raw_response.retrieve( - type="org.example.custom.room.config", - user_id="", - room_id="!726s6s6q:example.com", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - await async_client.matrix.rooms.account_data.with_raw_response.retrieve( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - await async_client.matrix.rooms.account_data.with_raw_response.retrieve( - type="", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncBeeperDesktop) -> None: - account_data = await async_client.matrix.rooms.account_data.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.account_data.with_raw_response.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.account_data.with_streaming_response.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.matrix.rooms.account_data.with_raw_response.update( - type="org.example.custom.room.config", - user_id="", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - await async_client.matrix.rooms.account_data.with_raw_response.update( - type="org.example.custom.room.config", - user_id="@alice:example.com", - room_id="", - body={"custom_account_data_key": "custom_account_data_value"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - await async_client.matrix.rooms.account_data.with_raw_response.update( - type="", - user_id="@alice:example.com", - room_id="!726s6s6q:example.com", - body={"custom_account_data_key": "custom_account_data_value"}, - ) diff --git a/tests/api_resources/matrix/rooms/test_events.py b/tests/api_resources/matrix/rooms/test_events.py deleted file mode 100644 index 4610a72..0000000 --- a/tests/api_resources/matrix/rooms/test_events.py +++ /dev/null @@ -1,120 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix.rooms import EventRetrieveResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEvents: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: BeeperDesktop) -> None: - event = client.matrix.rooms.events.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="!636q39766251:matrix.org", - ) - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.events.with_raw_response.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="!636q39766251:matrix.org", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.events.with_streaming_response.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="!636q39766251:matrix.org", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - client.matrix.rooms.events.with_raw_response.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - client.matrix.rooms.events.with_raw_response.retrieve( - event_id="", - room_id="!636q39766251:matrix.org", - ) - - -class TestAsyncEvents: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - event = await async_client.matrix.rooms.events.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="!636q39766251:matrix.org", - ) - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.events.with_raw_response.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="!636q39766251:matrix.org", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.events.with_streaming_response.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="!636q39766251:matrix.org", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - await async_client.matrix.rooms.events.with_raw_response.retrieve( - event_id="$asfDuShaf7Gafaw:matrix.org", - room_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): - await async_client.matrix.rooms.events.with_raw_response.retrieve( - event_id="", - room_id="!636q39766251:matrix.org", - ) diff --git a/tests/api_resources/matrix/rooms/test_state.py b/tests/api_resources/matrix/rooms/test_state.py deleted file mode 100644 index 8749cff..0000000 --- a/tests/api_resources/matrix/rooms/test_state.py +++ /dev/null @@ -1,240 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix.rooms import StateListResponse, StateRetrieveResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestState: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: BeeperDesktop) -> None: - state = client.matrix.rooms.state.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: BeeperDesktop) -> None: - state = client.matrix.rooms.state.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - format="content", - ) - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.state.with_raw_response.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = response.parse() - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.state.with_streaming_response.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = response.parse() - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - client.matrix.rooms.state.with_raw_response.retrieve( - state_key="state_key", - room_id="", - event_type="m.room.name", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_type` but received ''"): - client.matrix.rooms.state.with_raw_response.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_key` but received ''"): - client.matrix.rooms.state.with_raw_response.retrieve( - state_key="", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) - - @parametrize - def test_method_list(self, client: BeeperDesktop) -> None: - state = client.matrix.rooms.state.list( - "!636q39766251:example.com", - ) - assert_matches_type(StateListResponse, state, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.state.with_raw_response.list( - "!636q39766251:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = response.parse() - assert_matches_type(StateListResponse, state, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.state.with_streaming_response.list( - "!636q39766251:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = response.parse() - assert_matches_type(StateListResponse, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - client.matrix.rooms.state.with_raw_response.list( - "", - ) - - -class TestAsyncState: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - state = await async_client.matrix.rooms.state.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - state = await async_client.matrix.rooms.state.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - format="content", - ) - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.state.with_raw_response.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = await response.parse() - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.state.with_streaming_response.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = await response.parse() - assert_matches_type(StateRetrieveResponse, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - await async_client.matrix.rooms.state.with_raw_response.retrieve( - state_key="state_key", - room_id="", - event_type="m.room.name", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_type` but received ''"): - await async_client.matrix.rooms.state.with_raw_response.retrieve( - state_key="state_key", - room_id="!636q39766251:example.com", - event_type="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_key` but received ''"): - await async_client.matrix.rooms.state.with_raw_response.retrieve( - state_key="", - room_id="!636q39766251:example.com", - event_type="m.room.name", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: - state = await async_client.matrix.rooms.state.list( - "!636q39766251:example.com", - ) - assert_matches_type(StateListResponse, state, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.state.with_raw_response.list( - "!636q39766251:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - state = await response.parse() - assert_matches_type(StateListResponse, state, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.state.with_streaming_response.list( - "!636q39766251:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - state = await response.parse() - assert_matches_type(StateListResponse, state, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - await async_client.matrix.rooms.state.with_raw_response.list( - "", - ) diff --git a/tests/api_resources/matrix/test_rooms.py b/tests/api_resources/matrix/test_rooms.py deleted file mode 100644 index 6c9f5a1..0000000 --- a/tests/api_resources/matrix/test_rooms.py +++ /dev/null @@ -1,337 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix import ( - RoomJoinResponse, - RoomCreateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRooms: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: BeeperDesktop) -> None: - room = client.matrix.rooms.create() - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: - room = client.matrix.rooms.create( - creation_content={"m.federate": False}, - initial_state=[ - { - "content": {}, - "type": "type", - "state_key": "state_key", - } - ], - invite=["string"], - invite_3pid=[ - { - "address": "cheeky@monkey.com", - "id_access_token": "abc123_OpaqueString", - "id_server": "matrix.org", - "medium": "email", - } - ], - is_direct=True, - name="The Grand Duke Pub", - power_level_content_override={}, - preset="public_chat", - room_alias_name="thepub", - room_version="1", - topic="All about happy hour", - visibility="public", - ) - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = response.parse() - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = response.parse() - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_join(self, client: BeeperDesktop) -> None: - room = client.matrix.rooms.join( - room_id_or_alias="!monkeys:matrix.org", - ) - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - @parametrize - def test_method_join_with_all_params(self, client: BeeperDesktop) -> None: - room = client.matrix.rooms.join( - room_id_or_alias="!monkeys:matrix.org", - via=["string"], - reason="Looking for support", - third_party_signed={ - "token": "random8nonce", - "mxid": "bob", - "sender": "alice", - "signatures": {"example.org": {"ed25519:0": "some9signature"}}, - }, - ) - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - @parametrize - def test_raw_response_join(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.with_raw_response.join( - room_id_or_alias="!monkeys:matrix.org", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = response.parse() - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - @parametrize - def test_streaming_response_join(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.with_streaming_response.join( - room_id_or_alias="!monkeys:matrix.org", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = response.parse() - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_join(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id_or_alias` but received ''"): - client.matrix.rooms.with_raw_response.join( - room_id_or_alias="", - ) - - @parametrize - def test_method_leave(self, client: BeeperDesktop) -> None: - room = client.matrix.rooms.leave( - room_id="!nkl290a:matrix.org", - ) - assert_matches_type(object, room, path=["response"]) - - @parametrize - def test_method_leave_with_all_params(self, client: BeeperDesktop) -> None: - room = client.matrix.rooms.leave( - room_id="!nkl290a:matrix.org", - reason="Saying farewell - thanks for the support!", - ) - assert_matches_type(object, room, path=["response"]) - - @parametrize - def test_raw_response_leave(self, client: BeeperDesktop) -> None: - response = client.matrix.rooms.with_raw_response.leave( - room_id="!nkl290a:matrix.org", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = response.parse() - assert_matches_type(object, room, path=["response"]) - - @parametrize - def test_streaming_response_leave(self, client: BeeperDesktop) -> None: - with client.matrix.rooms.with_streaming_response.leave( - room_id="!nkl290a:matrix.org", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = response.parse() - assert_matches_type(object, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_leave(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - client.matrix.rooms.with_raw_response.leave( - room_id="", - ) - - -class TestAsyncRooms: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.rooms.create() - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.rooms.create( - creation_content={"m.federate": False}, - initial_state=[ - { - "content": {}, - "type": "type", - "state_key": "state_key", - } - ], - invite=["string"], - invite_3pid=[ - { - "address": "cheeky@monkey.com", - "id_access_token": "abc123_OpaqueString", - "id_server": "matrix.org", - "medium": "email", - } - ], - is_direct=True, - name="The Grand Duke Pub", - power_level_content_override={}, - preset="public_chat", - room_alias_name="thepub", - room_version="1", - topic="All about happy hour", - visibility="public", - ) - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = await response.parse() - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = await response.parse() - assert_matches_type(RoomCreateResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_join(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.rooms.join( - room_id_or_alias="!monkeys:matrix.org", - ) - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - @parametrize - async def test_method_join_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.rooms.join( - room_id_or_alias="!monkeys:matrix.org", - via=["string"], - reason="Looking for support", - third_party_signed={ - "token": "random8nonce", - "mxid": "bob", - "sender": "alice", - "signatures": {"example.org": {"ed25519:0": "some9signature"}}, - }, - ) - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - @parametrize - async def test_raw_response_join(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.with_raw_response.join( - room_id_or_alias="!monkeys:matrix.org", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = await response.parse() - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - @parametrize - async def test_streaming_response_join(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.with_streaming_response.join( - room_id_or_alias="!monkeys:matrix.org", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = await response.parse() - assert_matches_type(RoomJoinResponse, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_join(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id_or_alias` but received ''"): - await async_client.matrix.rooms.with_raw_response.join( - room_id_or_alias="", - ) - - @parametrize - async def test_method_leave(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.rooms.leave( - room_id="!nkl290a:matrix.org", - ) - assert_matches_type(object, room, path=["response"]) - - @parametrize - async def test_method_leave_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: - room = await async_client.matrix.rooms.leave( - room_id="!nkl290a:matrix.org", - reason="Saying farewell - thanks for the support!", - ) - assert_matches_type(object, room, path=["response"]) - - @parametrize - async def test_raw_response_leave(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.rooms.with_raw_response.leave( - room_id="!nkl290a:matrix.org", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - room = await response.parse() - assert_matches_type(object, room, path=["response"]) - - @parametrize - async def test_streaming_response_leave(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.rooms.with_streaming_response.leave( - room_id="!nkl290a:matrix.org", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - room = await response.parse() - assert_matches_type(object, room, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_leave(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `room_id` but received ''"): - await async_client.matrix.rooms.with_raw_response.leave( - room_id="", - ) diff --git a/tests/api_resources/matrix/test_users.py b/tests/api_resources/matrix/test_users.py deleted file mode 100644 index 5b148a2..0000000 --- a/tests/api_resources/matrix/test_users.py +++ /dev/null @@ -1,100 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types.matrix import UserRetrieveProfileResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve_profile(self, client: BeeperDesktop) -> None: - user = client.matrix.users.retrieve_profile( - "@alice:example.com", - ) - assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) - - @parametrize - def test_raw_response_retrieve_profile(self, client: BeeperDesktop) -> None: - response = client.matrix.users.with_raw_response.retrieve_profile( - "@alice:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) - - @parametrize - def test_streaming_response_retrieve_profile(self, client: BeeperDesktop) -> None: - with client.matrix.users.with_streaming_response.retrieve_profile( - "@alice:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve_profile(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.matrix.users.with_raw_response.retrieve_profile( - "", - ) - - -class TestAsyncUsers: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: - user = await async_client.matrix.users.retrieve_profile( - "@alice:example.com", - ) - assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) - - @parametrize - async def test_raw_response_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.users.with_raw_response.retrieve_profile( - "@alice:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.users.with_streaming_response.retrieve_profile( - "@alice:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(UserRetrieveProfileResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve_profile(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.matrix.users.with_raw_response.retrieve_profile( - "", - ) diff --git a/tests/api_resources/matrix/users/__init__.py b/tests/api_resources/matrix/users/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/matrix/users/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/matrix/users/test_account_data.py b/tests/api_resources/matrix/users/test_account_data.py deleted file mode 100644 index 4e31b87..0000000 --- a/tests/api_resources/matrix/users/test_account_data.py +++ /dev/null @@ -1,225 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAccountData: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: BeeperDesktop) -> None: - account_data = client.matrix.users.account_data.retrieve( - type="org.example.custom.config", - user_id="@alice:example.com", - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: - response = client.matrix.users.account_data.with_raw_response.retrieve( - type="org.example.custom.config", - user_id="@alice:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: - with client.matrix.users.account_data.with_streaming_response.retrieve( - type="org.example.custom.config", - user_id="@alice:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.matrix.users.account_data.with_raw_response.retrieve( - type="org.example.custom.config", - user_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - client.matrix.users.account_data.with_raw_response.retrieve( - type="", - user_id="@alice:example.com", - ) - - @parametrize - def test_method_update(self, client: BeeperDesktop) -> None: - account_data = client.matrix.users.account_data.update( - type="org.example.custom.config", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: BeeperDesktop) -> None: - response = client.matrix.users.account_data.with_raw_response.update( - type="org.example.custom.config", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: BeeperDesktop) -> None: - with client.matrix.users.account_data.with_streaming_response.update( - type="org.example.custom.config", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: BeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.matrix.users.account_data.with_raw_response.update( - type="org.example.custom.config", - user_id="", - body={"custom_account_data_key": "custom_config_value"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - client.matrix.users.account_data.with_raw_response.update( - type="", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) - - -class TestAsyncAccountData: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - account_data = await async_client.matrix.users.account_data.retrieve( - type="org.example.custom.config", - user_id="@alice:example.com", - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.users.account_data.with_raw_response.retrieve( - type="org.example.custom.config", - user_id="@alice:example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.users.account_data.with_streaming_response.retrieve( - type="org.example.custom.config", - user_id="@alice:example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.matrix.users.account_data.with_raw_response.retrieve( - type="org.example.custom.config", - user_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - await async_client.matrix.users.account_data.with_raw_response.retrieve( - type="", - user_id="@alice:example.com", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncBeeperDesktop) -> None: - account_data = await async_client.matrix.users.account_data.update( - type="org.example.custom.config", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.matrix.users.account_data.with_raw_response.update( - type="org.example.custom.config", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.matrix.users.account_data.with_streaming_response.update( - type="org.example.custom.config", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - account_data = await response.parse() - assert_matches_type(object, account_data, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncBeeperDesktop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.matrix.users.account_data.with_raw_response.update( - type="org.example.custom.config", - user_id="", - body={"custom_account_data_key": "custom_config_value"}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `type` but received ''"): - await async_client.matrix.users.account_data.with_raw_response.update( - type="", - user_id="@alice:example.com", - body={"custom_account_data_key": "custom_config_value"}, - ) diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_accounts.py index 46ac702..dfe06af 100644 --- a/tests/api_resources/test_accounts.py +++ b/tests/api_resources/test_accounts.py @@ -9,7 +9,7 @@ from tests.utils import assert_matches_type from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types import AccountListResponse +from beeper_desktop_api.types import AccountListResponse, AccountRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,6 +17,44 @@ class TestAccounts: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + account = client.accounts.retrieve( + "accountID", + ) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.accounts.with_raw_response.retrieve( + "accountID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = response.parse() + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.accounts.with_streaming_response.retrieve( + "accountID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account = response.parse() + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.accounts.with_raw_response.retrieve( + "", + ) + @parametrize def test_method_list(self, client: BeeperDesktop) -> None: account = client.accounts.list() @@ -48,6 +86,44 @@ class TestAsyncAccounts: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + account = await async_client.accounts.retrieve( + "accountID", + ) + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.accounts.with_raw_response.retrieve( + "accountID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = await response.parse() + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.accounts.with_streaming_response.retrieve( + "accountID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account = await response.parse() + assert_matches_type(AccountRetrieveResponse, account, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.accounts.with_raw_response.retrieve( + "", + ) + @parametrize async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: account = await async_client.accounts.list() diff --git a/tests/api_resources/test_app.py b/tests/api_resources/test_app.py deleted file mode 100644 index ff78bb6..0000000 --- a/tests/api_resources/test_app.py +++ /dev/null @@ -1,74 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types import AppStatusResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestApp: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_status(self, client: BeeperDesktop) -> None: - app = client.app.status() - assert_matches_type(AppStatusResponse, app, path=["response"]) - - @parametrize - def test_raw_response_status(self, client: BeeperDesktop) -> None: - response = client.app.with_raw_response.status() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = response.parse() - assert_matches_type(AppStatusResponse, app, path=["response"]) - - @parametrize - def test_streaming_response_status(self, client: BeeperDesktop) -> None: - with client.app.with_streaming_response.status() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = response.parse() - assert_matches_type(AppStatusResponse, app, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncApp: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_status(self, async_client: AsyncBeeperDesktop) -> None: - app = await async_client.app.status() - assert_matches_type(AppStatusResponse, app, path=["response"]) - - @parametrize - async def test_raw_response_status(self, async_client: AsyncBeeperDesktop) -> None: - response = await async_client.app.with_raw_response.status() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - app = await response.parse() - assert_matches_type(AppStatusResponse, app, path=["response"]) - - @parametrize - async def test_streaming_response_status(self, async_client: AsyncBeeperDesktop) -> None: - async with async_client.app.with_streaming_response.status() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - app = await response.parse() - assert_matches_type(AppStatusResponse, app, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_bridges.py b/tests/api_resources/test_bridges.py index f5af604..91654f1 100644 --- a/tests/api_resources/test_bridges.py +++ b/tests/api_resources/test_bridges.py @@ -9,7 +9,7 @@ from tests.utils import assert_matches_type from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop -from beeper_desktop_api.types import BridgeListResponse +from beeper_desktop_api.types import BridgeListResponse, BridgeRetrieveResponse, ProvisioningCapabilities base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,6 +17,44 @@ class TestBridges: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + bridge = client.bridges.retrieve( + "local-whatsapp", + ) + assert_matches_type(BridgeRetrieveResponse, bridge, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.bridges.with_raw_response.retrieve( + "local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bridge = response.parse() + assert_matches_type(BridgeRetrieveResponse, bridge, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.bridges.with_streaming_response.retrieve( + "local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bridge = response.parse() + assert_matches_type(BridgeRetrieveResponse, bridge, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.bridges.with_raw_response.retrieve( + "", + ) + @parametrize def test_method_list(self, client: BeeperDesktop) -> None: bridge = client.bridges.list() @@ -42,12 +80,88 @@ def test_streaming_response_list(self, client: BeeperDesktop) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_retrieve_capabilities(self, client: BeeperDesktop) -> None: + bridge = client.bridges.retrieve_capabilities( + "local-whatsapp", + ) + assert_matches_type(ProvisioningCapabilities, bridge, path=["response"]) + + @parametrize + def test_raw_response_retrieve_capabilities(self, client: BeeperDesktop) -> None: + response = client.bridges.with_raw_response.retrieve_capabilities( + "local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bridge = response.parse() + assert_matches_type(ProvisioningCapabilities, bridge, path=["response"]) + + @parametrize + def test_streaming_response_retrieve_capabilities(self, client: BeeperDesktop) -> None: + with client.bridges.with_streaming_response.retrieve_capabilities( + "local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bridge = response.parse() + assert_matches_type(ProvisioningCapabilities, bridge, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve_capabilities(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + client.bridges.with_raw_response.retrieve_capabilities( + "", + ) + class TestAsyncBridges: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + bridge = await async_client.bridges.retrieve( + "local-whatsapp", + ) + assert_matches_type(BridgeRetrieveResponse, bridge, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.bridges.with_raw_response.retrieve( + "local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bridge = await response.parse() + assert_matches_type(BridgeRetrieveResponse, bridge, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.bridges.with_streaming_response.retrieve( + "local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bridge = await response.parse() + assert_matches_type(BridgeRetrieveResponse, bridge, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.bridges.with_raw_response.retrieve( + "", + ) + @parametrize async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: bridge = await async_client.bridges.list() @@ -72,3 +186,41 @@ async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) - assert_matches_type(BridgeListResponse, bridge, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve_capabilities(self, async_client: AsyncBeeperDesktop) -> None: + bridge = await async_client.bridges.retrieve_capabilities( + "local-whatsapp", + ) + assert_matches_type(ProvisioningCapabilities, bridge, path=["response"]) + + @parametrize + async def test_raw_response_retrieve_capabilities(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.bridges.with_raw_response.retrieve_capabilities( + "local-whatsapp", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bridge = await response.parse() + assert_matches_type(ProvisioningCapabilities, bridge, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve_capabilities(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.bridges.with_streaming_response.retrieve_capabilities( + "local-whatsapp", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bridge = await response.parse() + assert_matches_type(ProvisioningCapabilities, bridge, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve_capabilities(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bridge_id` but received ''"): + await async_client.bridges.with_raw_response.retrieve_capabilities( + "", + ) From 9868f77423a998bfc443bc60fc00d6c7d0e58f53 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 17 May 2026 16:35:45 +0000 Subject: [PATCH 10/11] feat(api): add app resource with login and verification endpoints --- .stats.yml | 6 +- api.md | 103 ++- src/beeper_desktop_api/_client.py | 45 +- src/beeper_desktop_api/resources/__init__.py | 14 + .../resources/app/__init__.py | 47 ++ src/beeper_desktop_api/resources/app/app.py | 223 +++++++ .../resources/app/login/__init__.py | 33 + .../resources/app/login/login.py | 552 ++++++++++++++++ .../app/login/verification/__init__.py | 33 + .../verification/recovery_key/__init__.py | 33 + .../verification/recovery_key/recovery_key.py | 227 +++++++ .../login/verification/recovery_key/reset.py | 260 ++++++++ .../app/login/verification/verification.py | 120 ++++ .../resources/app/verifications/__init__.py | 47 ++ .../resources/app/verifications/qr.py | 262 ++++++++ .../resources/app/verifications/sas.py | 259 ++++++++ .../app/verifications/verifications.py | 625 ++++++++++++++++++ src/beeper_desktop_api/types/__init__.py | 1 + src/beeper_desktop_api/types/app/__init__.py | 14 + .../types/app/login/verification/__init__.py | 3 + .../verification/recovery_key/__init__.py | 5 + .../recovery_key/reset_confirm_params.py | 14 + .../recovery_key/reset_confirm_response.py | 192 ++++++ .../recovery_key/reset_create_params.py | 14 + .../recovery_key/reset_create_response.py | 200 ++++++ .../recovery_key_verify_params.py | 14 + .../recovery_key_verify_response.py | 192 ++++++ .../types/app/login_email_params.py | 17 + .../types/app/login_register_params.py | 27 + .../types/app/login_register_response.py | 212 ++++++ .../types/app/login_response_params.py | 17 + .../types/app/login_response_response.py | 251 +++++++ .../types/app/login_start_response.py | 17 + .../types/app/verification_accept_response.py | 276 ++++++++ .../types/app/verification_cancel_params.py | 15 + .../types/app/verification_cancel_response.py | 276 ++++++++ .../types/app/verification_create_params.py | 17 + .../types/app/verification_create_response.py | 276 ++++++++ .../types/app/verification_list_response.py | 90 +++ .../app/verification_retrieve_response.py | 276 ++++++++ .../types/app/verifications/__init__.py | 6 + .../qr_confirm_scanned_response.py | 276 ++++++++ .../types/app/verifications/qr_scan_params.py | 12 + .../app/verifications/qr_scan_response.py | 276 ++++++++ .../app/verifications/sas_confirm_response.py | 276 ++++++++ .../app/verifications/sas_start_response.py | 276 ++++++++ .../types/app_session_response.py | 184 ++++++ tests/api_resources/app/__init__.py | 1 + tests/api_resources/app/login/__init__.py | 1 + .../app/login/verification/__init__.py | 1 + .../verification/recovery_key/__init__.py | 1 + .../verification/recovery_key/test_reset.py | 153 +++++ .../login/verification/test_recovery_key.py | 86 +++ tests/api_resources/app/test_login.py | 294 ++++++++ tests/api_resources/app/test_verifications.py | 392 +++++++++++ .../app/verifications/__init__.py | 1 + .../app/verifications/test_qr.py | 162 +++++ .../app/verifications/test_sas.py | 176 +++++ tests/api_resources/test_app.py | 74 +++ 59 files changed, 7948 insertions(+), 5 deletions(-) create mode 100644 src/beeper_desktop_api/resources/app/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/app.py create mode 100644 src/beeper_desktop_api/resources/app/login/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/login/login.py create mode 100644 src/beeper_desktop_api/resources/app/login/verification/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/login/verification/recovery_key/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/login/verification/recovery_key/recovery_key.py create mode 100644 src/beeper_desktop_api/resources/app/login/verification/recovery_key/reset.py create mode 100644 src/beeper_desktop_api/resources/app/login/verification/verification.py create mode 100644 src/beeper_desktop_api/resources/app/verifications/__init__.py create mode 100644 src/beeper_desktop_api/resources/app/verifications/qr.py create mode 100644 src/beeper_desktop_api/resources/app/verifications/sas.py create mode 100644 src/beeper_desktop_api/resources/app/verifications/verifications.py create mode 100644 src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_params.py create mode 100644 src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_response.py create mode 100644 src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_params.py create mode 100644 src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_response.py create mode 100644 src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_params.py create mode 100644 src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_response.py create mode 100644 src/beeper_desktop_api/types/app/login_email_params.py create mode 100644 src/beeper_desktop_api/types/app/login_register_params.py create mode 100644 src/beeper_desktop_api/types/app/login_register_response.py create mode 100644 src/beeper_desktop_api/types/app/login_response_params.py create mode 100644 src/beeper_desktop_api/types/app/login_response_response.py create mode 100644 src/beeper_desktop_api/types/app/login_start_response.py create mode 100644 src/beeper_desktop_api/types/app/verification_accept_response.py create mode 100644 src/beeper_desktop_api/types/app/verification_cancel_params.py create mode 100644 src/beeper_desktop_api/types/app/verification_cancel_response.py create mode 100644 src/beeper_desktop_api/types/app/verification_create_params.py create mode 100644 src/beeper_desktop_api/types/app/verification_create_response.py create mode 100644 src/beeper_desktop_api/types/app/verification_list_response.py create mode 100644 src/beeper_desktop_api/types/app/verification_retrieve_response.py create mode 100644 src/beeper_desktop_api/types/app/verifications/qr_confirm_scanned_response.py create mode 100644 src/beeper_desktop_api/types/app/verifications/qr_scan_params.py create mode 100644 src/beeper_desktop_api/types/app/verifications/qr_scan_response.py create mode 100644 src/beeper_desktop_api/types/app/verifications/sas_confirm_response.py create mode 100644 src/beeper_desktop_api/types/app/verifications/sas_start_response.py create mode 100644 src/beeper_desktop_api/types/app_session_response.py create mode 100644 tests/api_resources/app/__init__.py create mode 100644 tests/api_resources/app/login/__init__.py create mode 100644 tests/api_resources/app/login/verification/__init__.py create mode 100644 tests/api_resources/app/login/verification/recovery_key/__init__.py create mode 100644 tests/api_resources/app/login/verification/recovery_key/test_reset.py create mode 100644 tests/api_resources/app/login/verification/test_recovery_key.py create mode 100644 tests/api_resources/app/test_login.py create mode 100644 tests/api_resources/app/test_verifications.py create mode 100644 tests/api_resources/app/verifications/__init__.py create mode 100644 tests/api_resources/app/verifications/test_qr.py create mode 100644 tests/api_resources/app/verifications/test_sas.py create mode 100644 tests/api_resources/test_app.py diff --git a/.stats.yml b/.stats.yml index f8d6237..3e06ccc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 39 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-87df69f641d994f09669f77093988df0b13da380d36076964d4a2563e9ce202e.yml +configured_endpoints: 56 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-baac187842e51587134950c59c4d746bfcb59239f01919ed83b92c24c47d98f4.yml openapi_spec_hash: 9de80d05f7562b7ecd07c466f0fdf58b -config_hash: 2ebcc80e2cbd2342e132f4474ec24212 +config_hash: a8a4a8b869ccd5976fd4107e67d2ecae diff --git a/api.md b/api.md index 0828697..561079d 100644 --- a/api.md +++ b/api.md @@ -211,5 +211,106 @@ Methods: Types: ```python -from beeper_desktop_api.types import Verification +from beeper_desktop_api.types import Verification, AppSessionResponse ``` + +Methods: + +- client.app.session() -> AppSessionResponse + +## Login + +Types: + +```python +from beeper_desktop_api.types.app import ( + LoginRegisterResponse, + LoginResponseResponse, + LoginStartResponse, +) +``` + +Methods: + +- client.app.login.email(\*\*params) -> None +- client.app.login.register(\*\*params) -> LoginRegisterResponse +- client.app.login.response(\*\*params) -> LoginResponseResponse +- client.app.login.start() -> LoginStartResponse + +### Verification + +#### RecoveryKey + +Types: + +```python +from beeper_desktop_api.types.app.login.verification import RecoveryKeyVerifyResponse +``` + +Methods: + +- client.app.login.verification.recovery_key.verify(\*\*params) -> RecoveryKeyVerifyResponse + +##### Reset + +Types: + +```python +from beeper_desktop_api.types.app.login.verification.recovery_key import ( + ResetCreateResponse, + ResetConfirmResponse, +) +``` + +Methods: + +- client.app.login.verification.recovery_key.reset.create(\*\*params) -> ResetCreateResponse +- client.app.login.verification.recovery_key.reset.confirm(\*\*params) -> ResetConfirmResponse + +## Verifications + +Types: + +```python +from beeper_desktop_api.types.app import ( + VerificationCreateResponse, + VerificationRetrieveResponse, + VerificationListResponse, + VerificationAcceptResponse, + VerificationCancelResponse, +) +``` + +Methods: + +- client.app.verifications.create(\*\*params) -> VerificationCreateResponse +- client.app.verifications.retrieve(verification_id) -> VerificationRetrieveResponse +- client.app.verifications.list() -> VerificationListResponse +- client.app.verifications.accept(verification_id) -> VerificationAcceptResponse +- client.app.verifications.cancel(verification_id, \*\*params) -> VerificationCancelResponse + +### Qr + +Types: + +```python +from beeper_desktop_api.types.app.verifications import QrConfirmScannedResponse, QrScanResponse +``` + +Methods: + +- client.app.verifications.qr.confirm_scanned(verification_id) -> QrConfirmScannedResponse +- client.app.verifications.qr.scan(\*\*params) -> QrScanResponse + +### SAS + +Types: + +```python +from beeper_desktop_api.types.app.verifications import SASConfirmResponse, SASStartResponse +``` + +Methods: + +- client.app.verifications.sas.confirm(verification_id) -> SASConfirmResponse +- client.app.verifications.sas.start(verification_id) -> SASStartResponse diff --git a/src/beeper_desktop_api/_client.py b/src/beeper_desktop_api/_client.py index 11ba7a6..49220c9 100644 --- a/src/beeper_desktop_api/_client.py +++ b/src/beeper_desktop_api/_client.py @@ -52,9 +52,10 @@ from .types.search_response import SearchResponse if TYPE_CHECKING: - from .resources import info, chats, assets, bridges, accounts, messages + from .resources import app, info, chats, assets, bridges, accounts, messages from .resources.info import InfoResource, AsyncInfoResource from .resources.assets import AssetsResource, AsyncAssetsResource + from .resources.app.app import AppResource, AsyncAppResource from .resources.messages import MessagesResource, AsyncMessagesResource from .resources.chats.chats import ChatsResource, AsyncChatsResource from .resources.bridges.bridges import BridgesResource, AsyncBridgesResource @@ -181,6 +182,13 @@ def info(self) -> InfoResource: return InfoResource(self) + @cached_property + def app(self) -> AppResource: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResource + + return AppResource(self) + @cached_property def with_raw_response(self) -> BeeperDesktopWithRawResponse: return BeeperDesktopWithRawResponse(self) @@ -500,6 +508,13 @@ def info(self) -> AsyncInfoResource: return AsyncInfoResource(self) + @cached_property + def app(self) -> AsyncAppResource: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResource + + return AsyncAppResource(self) + @cached_property def with_raw_response(self) -> AsyncBeeperDesktopWithRawResponse: return AsyncBeeperDesktopWithRawResponse(self) @@ -768,6 +783,13 @@ def info(self) -> info.InfoResourceWithRawResponse: return InfoResourceWithRawResponse(self._client.info) + @cached_property + def app(self) -> app.AppResourceWithRawResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResourceWithRawResponse + + return AppResourceWithRawResponse(self._client.app) + class AsyncBeeperDesktopWithRawResponse: _client: AsyncBeeperDesktop @@ -827,6 +849,13 @@ def info(self) -> info.AsyncInfoResourceWithRawResponse: return AsyncInfoResourceWithRawResponse(self._client.info) + @cached_property + def app(self) -> app.AsyncAppResourceWithRawResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResourceWithRawResponse + + return AsyncAppResourceWithRawResponse(self._client.app) + class BeeperDesktopWithStreamedResponse: _client: BeeperDesktop @@ -886,6 +915,13 @@ def info(self) -> info.InfoResourceWithStreamingResponse: return InfoResourceWithStreamingResponse(self._client.info) + @cached_property + def app(self) -> app.AppResourceWithStreamingResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AppResourceWithStreamingResponse + + return AppResourceWithStreamingResponse(self._client.app) + class AsyncBeeperDesktopWithStreamedResponse: _client: AsyncBeeperDesktop @@ -945,6 +981,13 @@ def info(self) -> info.AsyncInfoResourceWithStreamingResponse: return AsyncInfoResourceWithStreamingResponse(self._client.info) + @cached_property + def app(self) -> app.AsyncAppResourceWithStreamingResponse: + """Manage Beeper app login and encrypted messaging setup""" + from .resources.app import AsyncAppResourceWithStreamingResponse + + return AsyncAppResourceWithStreamingResponse(self._client.app) + Client = BeeperDesktop diff --git a/src/beeper_desktop_api/resources/__init__.py b/src/beeper_desktop_api/resources/__init__.py index 7297cb8..528054c 100644 --- a/src/beeper_desktop_api/resources/__init__.py +++ b/src/beeper_desktop_api/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .app import ( + AppResource, + AsyncAppResource, + AppResourceWithRawResponse, + AsyncAppResourceWithRawResponse, + AppResourceWithStreamingResponse, + AsyncAppResourceWithStreamingResponse, +) from .info import ( InfoResource, AsyncInfoResource, @@ -86,4 +94,10 @@ "AsyncInfoResourceWithRawResponse", "InfoResourceWithStreamingResponse", "AsyncInfoResourceWithStreamingResponse", + "AppResource", + "AsyncAppResource", + "AppResourceWithRawResponse", + "AsyncAppResourceWithRawResponse", + "AppResourceWithStreamingResponse", + "AsyncAppResourceWithStreamingResponse", ] diff --git a/src/beeper_desktop_api/resources/app/__init__.py b/src/beeper_desktop_api/resources/app/__init__.py new file mode 100644 index 0000000..68b246e --- /dev/null +++ b/src/beeper_desktop_api/resources/app/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .app import ( + AppResource, + AsyncAppResource, + AppResourceWithRawResponse, + AsyncAppResourceWithRawResponse, + AppResourceWithStreamingResponse, + AsyncAppResourceWithStreamingResponse, +) +from .login import ( + LoginResource, + AsyncLoginResource, + LoginResourceWithRawResponse, + AsyncLoginResourceWithRawResponse, + LoginResourceWithStreamingResponse, + AsyncLoginResourceWithStreamingResponse, +) +from .verifications import ( + VerificationsResource, + AsyncVerificationsResource, + VerificationsResourceWithRawResponse, + AsyncVerificationsResourceWithRawResponse, + VerificationsResourceWithStreamingResponse, + AsyncVerificationsResourceWithStreamingResponse, +) + +__all__ = [ + "LoginResource", + "AsyncLoginResource", + "LoginResourceWithRawResponse", + "AsyncLoginResourceWithRawResponse", + "LoginResourceWithStreamingResponse", + "AsyncLoginResourceWithStreamingResponse", + "VerificationsResource", + "AsyncVerificationsResource", + "VerificationsResourceWithRawResponse", + "AsyncVerificationsResourceWithRawResponse", + "VerificationsResourceWithStreamingResponse", + "AsyncVerificationsResourceWithStreamingResponse", + "AppResource", + "AsyncAppResource", + "AppResourceWithRawResponse", + "AsyncAppResourceWithRawResponse", + "AppResourceWithStreamingResponse", + "AsyncAppResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/app.py b/src/beeper_desktop_api/resources/app/app.py new file mode 100644 index 0000000..e53e47f --- /dev/null +++ b/src/beeper_desktop_api/resources/app/app.py @@ -0,0 +1,223 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .login.login import ( + LoginResource, + AsyncLoginResource, + LoginResourceWithRawResponse, + AsyncLoginResourceWithRawResponse, + LoginResourceWithStreamingResponse, + AsyncLoginResourceWithStreamingResponse, +) +from ..._base_client import make_request_options +from .verifications.verifications import ( + VerificationsResource, + AsyncVerificationsResource, + VerificationsResourceWithRawResponse, + AsyncVerificationsResourceWithRawResponse, + VerificationsResourceWithStreamingResponse, + AsyncVerificationsResourceWithStreamingResponse, +) +from ...types.app_session_response import AppSessionResponse + +__all__ = ["AppResource", "AsyncAppResource"] + + +class AppResource(SyncAPIResource): + """Manage Beeper app login and encrypted messaging setup""" + + @cached_property + def login(self) -> LoginResource: + """Complete first-party Beeper app login""" + return LoginResource(self._client) + + @cached_property + def verifications(self) -> VerificationsResource: + """Manage device verification transactions""" + return VerificationsResource(self._client) + + @cached_property + def with_raw_response(self) -> AppResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AppResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AppResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AppResourceWithStreamingResponse(self) + + def session( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AppSessionResponse: + """ + Return the current Beeper Desktop or Beeper Server sign-in and encrypted + messaging setup state. This endpoint is public before sign-in so apps can + discover that sign-in is needed; after sign-in, pass a read token. + """ + return self._get( + "/v1/app/setup", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppSessionResponse, + ) + + +class AsyncAppResource(AsyncAPIResource): + """Manage Beeper app login and encrypted messaging setup""" + + @cached_property + def login(self) -> AsyncLoginResource: + """Complete first-party Beeper app login""" + return AsyncLoginResource(self._client) + + @cached_property + def verifications(self) -> AsyncVerificationsResource: + """Manage device verification transactions""" + return AsyncVerificationsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAppResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncAppResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAppResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncAppResourceWithStreamingResponse(self) + + async def session( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AppSessionResponse: + """ + Return the current Beeper Desktop or Beeper Server sign-in and encrypted + messaging setup state. This endpoint is public before sign-in so apps can + discover that sign-in is needed; after sign-in, pass a read token. + """ + return await self._get( + "/v1/app/setup", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppSessionResponse, + ) + + +class AppResourceWithRawResponse: + def __init__(self, app: AppResource) -> None: + self._app = app + + self.session = to_raw_response_wrapper( + app.session, + ) + + @cached_property + def login(self) -> LoginResourceWithRawResponse: + """Complete first-party Beeper app login""" + return LoginResourceWithRawResponse(self._app.login) + + @cached_property + def verifications(self) -> VerificationsResourceWithRawResponse: + """Manage device verification transactions""" + return VerificationsResourceWithRawResponse(self._app.verifications) + + +class AsyncAppResourceWithRawResponse: + def __init__(self, app: AsyncAppResource) -> None: + self._app = app + + self.session = async_to_raw_response_wrapper( + app.session, + ) + + @cached_property + def login(self) -> AsyncLoginResourceWithRawResponse: + """Complete first-party Beeper app login""" + return AsyncLoginResourceWithRawResponse(self._app.login) + + @cached_property + def verifications(self) -> AsyncVerificationsResourceWithRawResponse: + """Manage device verification transactions""" + return AsyncVerificationsResourceWithRawResponse(self._app.verifications) + + +class AppResourceWithStreamingResponse: + def __init__(self, app: AppResource) -> None: + self._app = app + + self.session = to_streamed_response_wrapper( + app.session, + ) + + @cached_property + def login(self) -> LoginResourceWithStreamingResponse: + """Complete first-party Beeper app login""" + return LoginResourceWithStreamingResponse(self._app.login) + + @cached_property + def verifications(self) -> VerificationsResourceWithStreamingResponse: + """Manage device verification transactions""" + return VerificationsResourceWithStreamingResponse(self._app.verifications) + + +class AsyncAppResourceWithStreamingResponse: + def __init__(self, app: AsyncAppResource) -> None: + self._app = app + + self.session = async_to_streamed_response_wrapper( + app.session, + ) + + @cached_property + def login(self) -> AsyncLoginResourceWithStreamingResponse: + """Complete first-party Beeper app login""" + return AsyncLoginResourceWithStreamingResponse(self._app.login) + + @cached_property + def verifications(self) -> AsyncVerificationsResourceWithStreamingResponse: + """Manage device verification transactions""" + return AsyncVerificationsResourceWithStreamingResponse(self._app.verifications) diff --git a/src/beeper_desktop_api/resources/app/login/__init__.py b/src/beeper_desktop_api/resources/app/login/__init__.py new file mode 100644 index 0000000..fa69ee9 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .login import ( + LoginResource, + AsyncLoginResource, + LoginResourceWithRawResponse, + AsyncLoginResourceWithRawResponse, + LoginResourceWithStreamingResponse, + AsyncLoginResourceWithStreamingResponse, +) +from .verification import ( + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, +) + +__all__ = [ + "VerificationResource", + "AsyncVerificationResource", + "VerificationResourceWithRawResponse", + "AsyncVerificationResourceWithRawResponse", + "VerificationResourceWithStreamingResponse", + "AsyncVerificationResourceWithStreamingResponse", + "LoginResource", + "AsyncLoginResource", + "LoginResourceWithRawResponse", + "AsyncLoginResourceWithRawResponse", + "LoginResourceWithStreamingResponse", + "AsyncLoginResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/login/login.py b/src/beeper_desktop_api/resources/app/login/login.py new file mode 100644 index 0000000..ed63a26 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login/login.py @@ -0,0 +1,552 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, cast +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Query, Headers, NoneType, NotGiven, 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 ....types.app import login_email_params, login_register_params, login_response_params +from ...._base_client import make_request_options +from .verification.verification import ( + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, +) +from ....types.app.login_start_response import LoginStartResponse +from ....types.app.login_register_response import LoginRegisterResponse +from ....types.app.login_response_response import LoginResponseResponse + +__all__ = ["LoginResource", "AsyncLoginResource"] + + +class LoginResource(SyncAPIResource): + """Complete first-party Beeper app login""" + + @cached_property + def verification(self) -> VerificationResource: + return VerificationResource(self._client) + + @cached_property + def with_raw_response(self) -> LoginResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return LoginResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LoginResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return LoginResourceWithStreamingResponse(self) + + def email( + self, + *, + email: str, + setup_request_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: + """ + Send a sign-in code to the user email address for app setup. + + Args: + email: Email address to send the sign-in code to. + + setup_request_id: Setup request ID returned by the start step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/v1/app/setup/email", + body=maybe_transform( + { + "email": email, + "setup_request_id": setup_request_id, + }, + login_email_params.LoginEmailParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=NoneType, + ) + + def register( + self, + *, + accept_terms: Literal[True], + lead_token: str, + setup_request_id: str, + username: 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, + ) -> LoginRegisterResponse: + """ + Create a Beeper account after the user chooses a username and accepts the Terms + of Use. + + Args: + accept_terms: Confirms that the user agreed to our + [terms of use](https://www.beeper.com/terms-onboarding) and has read our + [privacy policy](https://www.beeper.com/privacy). + + lead_token: Registration token returned by Beeper. + + setup_request_id: Setup request ID returned by the start step. + + username: Username selected by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/register", + body=maybe_transform( + { + "accept_terms": accept_terms, + "lead_token": lead_token, + "setup_request_id": setup_request_id, + "username": username, + }, + login_register_params.LoginRegisterParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginRegisterResponse, + ) + + def response( + self, + *, + response: str, + setup_request_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, + ) -> LoginResponseResponse: + """Finish setup sign-in with the code sent to the user email address. + + If the user + needs a new account, the response includes account creation copy and username + suggestions. + + Args: + response: Sign-in code from the user email. + + setup_request_id: Setup request ID returned by the start step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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 cast( + LoginResponseResponse, + self._post( + "/v1/app/setup/response", + body=maybe_transform( + { + "response": response, + "setup_request_id": setup_request_id, + }, + login_response_params.LoginResponseParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=cast( + Any, LoginResponseResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def start( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginStartResponse: + """Start setting up Beeper Desktop or Beeper Server. + + The flow supports existing + Beeper accounts and new account creation. + """ + return self._post( + "/v1/app/setup/start", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginStartResponse, + ) + + +class AsyncLoginResource(AsyncAPIResource): + """Complete first-party Beeper app login""" + + @cached_property + def verification(self) -> AsyncVerificationResource: + return AsyncVerificationResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLoginResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncLoginResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLoginResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncLoginResourceWithStreamingResponse(self) + + async def email( + self, + *, + email: str, + setup_request_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: + """ + Send a sign-in code to the user email address for app setup. + + Args: + email: Email address to send the sign-in code to. + + setup_request_id: Setup request ID returned by the start step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/v1/app/setup/email", + body=await async_maybe_transform( + { + "email": email, + "setup_request_id": setup_request_id, + }, + login_email_params.LoginEmailParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=NoneType, + ) + + async def register( + self, + *, + accept_terms: Literal[True], + lead_token: str, + setup_request_id: str, + username: 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, + ) -> LoginRegisterResponse: + """ + Create a Beeper account after the user chooses a username and accepts the Terms + of Use. + + Args: + accept_terms: Confirms that the user agreed to our + [terms of use](https://www.beeper.com/terms-onboarding) and has read our + [privacy policy](https://www.beeper.com/privacy). + + lead_token: Registration token returned by Beeper. + + setup_request_id: Setup request ID returned by the start step. + + username: Username selected by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/register", + body=await async_maybe_transform( + { + "accept_terms": accept_terms, + "lead_token": lead_token, + "setup_request_id": setup_request_id, + "username": username, + }, + login_register_params.LoginRegisterParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginRegisterResponse, + ) + + async def response( + self, + *, + response: str, + setup_request_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, + ) -> LoginResponseResponse: + """Finish setup sign-in with the code sent to the user email address. + + If the user + needs a new account, the response includes account creation copy and username + suggestions. + + Args: + response: Sign-in code from the user email. + + setup_request_id: Setup request ID returned by the start step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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 cast( + LoginResponseResponse, + await self._post( + "/v1/app/setup/response", + body=await async_maybe_transform( + { + "response": response, + "setup_request_id": setup_request_id, + }, + login_response_params.LoginResponseParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=cast( + Any, LoginResponseResponse + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def start( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoginStartResponse: + """Start setting up Beeper Desktop or Beeper Server. + + The flow supports existing + Beeper accounts and new account creation. + """ + return await self._post( + "/v1/app/setup/start", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + security={}, + ), + cast_to=LoginStartResponse, + ) + + +class LoginResourceWithRawResponse: + def __init__(self, login: LoginResource) -> None: + self._login = login + + self.email = to_raw_response_wrapper( + login.email, + ) + self.register = to_raw_response_wrapper( + login.register, + ) + self.response = to_raw_response_wrapper( + login.response, + ) + self.start = to_raw_response_wrapper( + login.start, + ) + + @cached_property + def verification(self) -> VerificationResourceWithRawResponse: + return VerificationResourceWithRawResponse(self._login.verification) + + +class AsyncLoginResourceWithRawResponse: + def __init__(self, login: AsyncLoginResource) -> None: + self._login = login + + self.email = async_to_raw_response_wrapper( + login.email, + ) + self.register = async_to_raw_response_wrapper( + login.register, + ) + self.response = async_to_raw_response_wrapper( + login.response, + ) + self.start = async_to_raw_response_wrapper( + login.start, + ) + + @cached_property + def verification(self) -> AsyncVerificationResourceWithRawResponse: + return AsyncVerificationResourceWithRawResponse(self._login.verification) + + +class LoginResourceWithStreamingResponse: + def __init__(self, login: LoginResource) -> None: + self._login = login + + self.email = to_streamed_response_wrapper( + login.email, + ) + self.register = to_streamed_response_wrapper( + login.register, + ) + self.response = to_streamed_response_wrapper( + login.response, + ) + self.start = to_streamed_response_wrapper( + login.start, + ) + + @cached_property + def verification(self) -> VerificationResourceWithStreamingResponse: + return VerificationResourceWithStreamingResponse(self._login.verification) + + +class AsyncLoginResourceWithStreamingResponse: + def __init__(self, login: AsyncLoginResource) -> None: + self._login = login + + self.email = async_to_streamed_response_wrapper( + login.email, + ) + self.register = async_to_streamed_response_wrapper( + login.register, + ) + self.response = async_to_streamed_response_wrapper( + login.response, + ) + self.start = async_to_streamed_response_wrapper( + login.start, + ) + + @cached_property + def verification(self) -> AsyncVerificationResourceWithStreamingResponse: + return AsyncVerificationResourceWithStreamingResponse(self._login.verification) diff --git a/src/beeper_desktop_api/resources/app/login/verification/__init__.py b/src/beeper_desktop_api/resources/app/login/verification/__init__.py new file mode 100644 index 0000000..05bb4b1 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login/verification/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .recovery_key import ( + RecoveryKeyResource, + AsyncRecoveryKeyResource, + RecoveryKeyResourceWithRawResponse, + AsyncRecoveryKeyResourceWithRawResponse, + RecoveryKeyResourceWithStreamingResponse, + AsyncRecoveryKeyResourceWithStreamingResponse, +) +from .verification import ( + VerificationResource, + AsyncVerificationResource, + VerificationResourceWithRawResponse, + AsyncVerificationResourceWithRawResponse, + VerificationResourceWithStreamingResponse, + AsyncVerificationResourceWithStreamingResponse, +) + +__all__ = [ + "RecoveryKeyResource", + "AsyncRecoveryKeyResource", + "RecoveryKeyResourceWithRawResponse", + "AsyncRecoveryKeyResourceWithRawResponse", + "RecoveryKeyResourceWithStreamingResponse", + "AsyncRecoveryKeyResourceWithStreamingResponse", + "VerificationResource", + "AsyncVerificationResource", + "VerificationResourceWithRawResponse", + "AsyncVerificationResourceWithRawResponse", + "VerificationResourceWithStreamingResponse", + "AsyncVerificationResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/login/verification/recovery_key/__init__.py b/src/beeper_desktop_api/resources/app/login/verification/recovery_key/__init__.py new file mode 100644 index 0000000..ec6a210 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login/verification/recovery_key/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .reset import ( + ResetResource, + AsyncResetResource, + ResetResourceWithRawResponse, + AsyncResetResourceWithRawResponse, + ResetResourceWithStreamingResponse, + AsyncResetResourceWithStreamingResponse, +) +from .recovery_key import ( + RecoveryKeyResource, + AsyncRecoveryKeyResource, + RecoveryKeyResourceWithRawResponse, + AsyncRecoveryKeyResourceWithRawResponse, + RecoveryKeyResourceWithStreamingResponse, + AsyncRecoveryKeyResourceWithStreamingResponse, +) + +__all__ = [ + "ResetResource", + "AsyncResetResource", + "ResetResourceWithRawResponse", + "AsyncResetResourceWithRawResponse", + "ResetResourceWithStreamingResponse", + "AsyncResetResourceWithStreamingResponse", + "RecoveryKeyResource", + "AsyncRecoveryKeyResource", + "RecoveryKeyResourceWithRawResponse", + "AsyncRecoveryKeyResourceWithRawResponse", + "RecoveryKeyResourceWithStreamingResponse", + "AsyncRecoveryKeyResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/login/verification/recovery_key/recovery_key.py b/src/beeper_desktop_api/resources/app/login/verification/recovery_key/recovery_key.py new file mode 100644 index 0000000..ba347a5 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login/verification/recovery_key/recovery_key.py @@ -0,0 +1,227 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .reset import ( + ResetResource, + AsyncResetResource, + ResetResourceWithRawResponse, + AsyncResetResourceWithRawResponse, + ResetResourceWithStreamingResponse, + AsyncResetResourceWithStreamingResponse, +) +from ......_types import Body, Query, Headers, NotGiven, 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.app.login.verification import recovery_key_verify_params +from ......types.app.login.verification.recovery_key_verify_response import RecoveryKeyVerifyResponse + +__all__ = ["RecoveryKeyResource", "AsyncRecoveryKeyResource"] + + +class RecoveryKeyResource(SyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def reset(self) -> ResetResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return ResetResource(self._client) + + @cached_property + def with_raw_response(self) -> RecoveryKeyResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return RecoveryKeyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RecoveryKeyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return RecoveryKeyResourceWithStreamingResponse(self) + + def verify( + self, + *, + recovery_key: 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, + ) -> RecoveryKeyVerifyResponse: + """ + Unlock encrypted messages with the user recovery key. + + Args: + recovery_key: Recovery key saved by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verification/recovery-key", + body=maybe_transform({"recovery_key": recovery_key}, recovery_key_verify_params.RecoveryKeyVerifyParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RecoveryKeyVerifyResponse, + ) + + +class AsyncRecoveryKeyResource(AsyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def reset(self) -> AsyncResetResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncResetResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncRecoveryKeyResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncRecoveryKeyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRecoveryKeyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncRecoveryKeyResourceWithStreamingResponse(self) + + async def verify( + self, + *, + recovery_key: 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, + ) -> RecoveryKeyVerifyResponse: + """ + Unlock encrypted messages with the user recovery key. + + Args: + recovery_key: Recovery key saved by the user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verification/recovery-key", + body=await async_maybe_transform( + {"recovery_key": recovery_key}, recovery_key_verify_params.RecoveryKeyVerifyParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RecoveryKeyVerifyResponse, + ) + + +class RecoveryKeyResourceWithRawResponse: + def __init__(self, recovery_key: RecoveryKeyResource) -> None: + self._recovery_key = recovery_key + + self.verify = to_raw_response_wrapper( + recovery_key.verify, + ) + + @cached_property + def reset(self) -> ResetResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return ResetResourceWithRawResponse(self._recovery_key.reset) + + +class AsyncRecoveryKeyResourceWithRawResponse: + def __init__(self, recovery_key: AsyncRecoveryKeyResource) -> None: + self._recovery_key = recovery_key + + self.verify = async_to_raw_response_wrapper( + recovery_key.verify, + ) + + @cached_property + def reset(self) -> AsyncResetResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncResetResourceWithRawResponse(self._recovery_key.reset) + + +class RecoveryKeyResourceWithStreamingResponse: + def __init__(self, recovery_key: RecoveryKeyResource) -> None: + self._recovery_key = recovery_key + + self.verify = to_streamed_response_wrapper( + recovery_key.verify, + ) + + @cached_property + def reset(self) -> ResetResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return ResetResourceWithStreamingResponse(self._recovery_key.reset) + + +class AsyncRecoveryKeyResourceWithStreamingResponse: + def __init__(self, recovery_key: AsyncRecoveryKeyResource) -> None: + self._recovery_key = recovery_key + + self.verify = async_to_streamed_response_wrapper( + recovery_key.verify, + ) + + @cached_property + def reset(self) -> AsyncResetResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncResetResourceWithStreamingResponse(self._recovery_key.reset) diff --git a/src/beeper_desktop_api/resources/app/login/verification/recovery_key/reset.py b/src/beeper_desktop_api/resources/app/login/verification/recovery_key/reset.py new file mode 100644 index 0000000..0272f0f --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login/verification/recovery_key/reset.py @@ -0,0 +1,260 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ......_types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ......_utils import 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.app.login.verification.recovery_key import reset_create_params, reset_confirm_params +from ......types.app.login.verification.recovery_key.reset_create_response import ResetCreateResponse +from ......types.app.login.verification.recovery_key.reset_confirm_response import ResetConfirmResponse + +__all__ = ["ResetResource", "AsyncResetResource"] + + +class ResetResource(SyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def with_raw_response(self) -> ResetResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return ResetResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ResetResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return ResetResourceWithStreamingResponse(self) + + def create( + self, + *, + existing_recovery_key: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResetCreateResponse: + """ + Create a new recovery key when the user cannot use the existing one. + + Args: + existing_recovery_key: Existing recovery key, if the user has it. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verification/recovery-key/reset", + body=maybe_transform( + {"existing_recovery_key": existing_recovery_key}, reset_create_params.ResetCreateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetCreateResponse, + ) + + def confirm( + self, + *, + recovery_key: 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, + ) -> ResetConfirmResponse: + """ + Confirm that the new recovery key should be used for this account. + + Args: + recovery_key: New recovery key returned by the reset step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verification/recovery-key/reset/confirm", + body=maybe_transform({"recovery_key": recovery_key}, reset_confirm_params.ResetConfirmParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetConfirmResponse, + ) + + +class AsyncResetResource(AsyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def with_raw_response(self) -> AsyncResetResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncResetResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncResetResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncResetResourceWithStreamingResponse(self) + + async def create( + self, + *, + existing_recovery_key: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResetCreateResponse: + """ + Create a new recovery key when the user cannot use the existing one. + + Args: + existing_recovery_key: Existing recovery key, if the user has it. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verification/recovery-key/reset", + body=await async_maybe_transform( + {"existing_recovery_key": existing_recovery_key}, reset_create_params.ResetCreateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetCreateResponse, + ) + + async def confirm( + self, + *, + recovery_key: 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, + ) -> ResetConfirmResponse: + """ + Confirm that the new recovery key should be used for this account. + + Args: + recovery_key: New recovery key returned by the reset step. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verification/recovery-key/reset/confirm", + body=await async_maybe_transform({"recovery_key": recovery_key}, reset_confirm_params.ResetConfirmParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResetConfirmResponse, + ) + + +class ResetResourceWithRawResponse: + def __init__(self, reset: ResetResource) -> None: + self._reset = reset + + self.create = to_raw_response_wrapper( + reset.create, + ) + self.confirm = to_raw_response_wrapper( + reset.confirm, + ) + + +class AsyncResetResourceWithRawResponse: + def __init__(self, reset: AsyncResetResource) -> None: + self._reset = reset + + self.create = async_to_raw_response_wrapper( + reset.create, + ) + self.confirm = async_to_raw_response_wrapper( + reset.confirm, + ) + + +class ResetResourceWithStreamingResponse: + def __init__(self, reset: ResetResource) -> None: + self._reset = reset + + self.create = to_streamed_response_wrapper( + reset.create, + ) + self.confirm = to_streamed_response_wrapper( + reset.confirm, + ) + + +class AsyncResetResourceWithStreamingResponse: + def __init__(self, reset: AsyncResetResource) -> None: + self._reset = reset + + self.create = async_to_streamed_response_wrapper( + reset.create, + ) + self.confirm = async_to_streamed_response_wrapper( + reset.confirm, + ) diff --git a/src/beeper_desktop_api/resources/app/login/verification/verification.py b/src/beeper_desktop_api/resources/app/login/verification/verification.py new file mode 100644 index 0000000..9c940ce --- /dev/null +++ b/src/beeper_desktop_api/resources/app/login/verification/verification.py @@ -0,0 +1,120 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from .recovery_key.recovery_key import ( + RecoveryKeyResource, + AsyncRecoveryKeyResource, + RecoveryKeyResourceWithRawResponse, + AsyncRecoveryKeyResourceWithRawResponse, + RecoveryKeyResourceWithStreamingResponse, + AsyncRecoveryKeyResourceWithStreamingResponse, +) + +__all__ = ["VerificationResource", "AsyncVerificationResource"] + + +class VerificationResource(SyncAPIResource): + @cached_property + def recovery_key(self) -> RecoveryKeyResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return RecoveryKeyResource(self._client) + + @cached_property + def with_raw_response(self) -> VerificationResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return VerificationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VerificationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return VerificationResourceWithStreamingResponse(self) + + +class AsyncVerificationResource(AsyncAPIResource): + @cached_property + def recovery_key(self) -> AsyncRecoveryKeyResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncRecoveryKeyResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncVerificationResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncVerificationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVerificationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncVerificationResourceWithStreamingResponse(self) + + +class VerificationResourceWithRawResponse: + def __init__(self, verification: VerificationResource) -> None: + self._verification = verification + + @cached_property + def recovery_key(self) -> RecoveryKeyResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return RecoveryKeyResourceWithRawResponse(self._verification.recovery_key) + + +class AsyncVerificationResourceWithRawResponse: + def __init__(self, verification: AsyncVerificationResource) -> None: + self._verification = verification + + @cached_property + def recovery_key(self) -> AsyncRecoveryKeyResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncRecoveryKeyResourceWithRawResponse(self._verification.recovery_key) + + +class VerificationResourceWithStreamingResponse: + def __init__(self, verification: VerificationResource) -> None: + self._verification = verification + + @cached_property + def recovery_key(self) -> RecoveryKeyResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return RecoveryKeyResourceWithStreamingResponse(self._verification.recovery_key) + + +class AsyncVerificationResourceWithStreamingResponse: + def __init__(self, verification: AsyncVerificationResource) -> None: + self._verification = verification + + @cached_property + def recovery_key(self) -> AsyncRecoveryKeyResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncRecoveryKeyResourceWithStreamingResponse(self._verification.recovery_key) diff --git a/src/beeper_desktop_api/resources/app/verifications/__init__.py b/src/beeper_desktop_api/resources/app/verifications/__init__.py new file mode 100644 index 0000000..b57241e --- /dev/null +++ b/src/beeper_desktop_api/resources/app/verifications/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .qr import ( + QrResource, + AsyncQrResource, + QrResourceWithRawResponse, + AsyncQrResourceWithRawResponse, + QrResourceWithStreamingResponse, + AsyncQrResourceWithStreamingResponse, +) +from .sas import ( + SASResource, + AsyncSASResource, + SASResourceWithRawResponse, + AsyncSASResourceWithRawResponse, + SASResourceWithStreamingResponse, + AsyncSASResourceWithStreamingResponse, +) +from .verifications import ( + VerificationsResource, + AsyncVerificationsResource, + VerificationsResourceWithRawResponse, + AsyncVerificationsResourceWithRawResponse, + VerificationsResourceWithStreamingResponse, + AsyncVerificationsResourceWithStreamingResponse, +) + +__all__ = [ + "QrResource", + "AsyncQrResource", + "QrResourceWithRawResponse", + "AsyncQrResourceWithRawResponse", + "QrResourceWithStreamingResponse", + "AsyncQrResourceWithStreamingResponse", + "SASResource", + "AsyncSASResource", + "SASResourceWithRawResponse", + "AsyncSASResourceWithRawResponse", + "SASResourceWithStreamingResponse", + "AsyncSASResourceWithStreamingResponse", + "VerificationsResource", + "AsyncVerificationsResource", + "VerificationsResourceWithRawResponse", + "AsyncVerificationsResourceWithRawResponse", + "VerificationsResourceWithStreamingResponse", + "AsyncVerificationsResourceWithStreamingResponse", +] diff --git a/src/beeper_desktop_api/resources/app/verifications/qr.py b/src/beeper_desktop_api/resources/app/verifications/qr.py new file mode 100644 index 0000000..d01a234 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/verifications/qr.py @@ -0,0 +1,262 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template, 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.app.verifications import qr_scan_params +from ....types.app.verifications.qr_scan_response import QrScanResponse +from ....types.app.verifications.qr_confirm_scanned_response import QrConfirmScannedResponse + +__all__ = ["QrResource", "AsyncQrResource"] + + +class QrResource(SyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def with_raw_response(self) -> QrResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return QrResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> QrResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return QrResourceWithStreamingResponse(self) + + def confirm_scanned( + self, + verification_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, + ) -> QrConfirmScannedResponse: + """ + Confirm that another device scanned this device QR code. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template( + "/v1/app/setup/verifications/{verification_id}/qr/confirm-scanned", verification_id=verification_id + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrConfirmScannedResponse, + ) + + def scan( + self, + *, + data: 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, + ) -> QrScanResponse: + """ + Submit the QR code scanned from another signed-in device. + + Args: + data: QR code payload scanned from the other device. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verifications/qr/scan", + body=maybe_transform({"data": data}, qr_scan_params.QrScanParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrScanResponse, + ) + + +class AsyncQrResource(AsyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def with_raw_response(self) -> AsyncQrResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncQrResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncQrResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncQrResourceWithStreamingResponse(self) + + async def confirm_scanned( + self, + verification_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, + ) -> QrConfirmScannedResponse: + """ + Confirm that another device scanned this device QR code. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template( + "/v1/app/setup/verifications/{verification_id}/qr/confirm-scanned", verification_id=verification_id + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrConfirmScannedResponse, + ) + + async def scan( + self, + *, + data: 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, + ) -> QrScanResponse: + """ + Submit the QR code scanned from another signed-in device. + + Args: + data: QR code payload scanned from the other device. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verifications/qr/scan", + body=await async_maybe_transform({"data": data}, qr_scan_params.QrScanParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QrScanResponse, + ) + + +class QrResourceWithRawResponse: + def __init__(self, qr: QrResource) -> None: + self._qr = qr + + self.confirm_scanned = to_raw_response_wrapper( + qr.confirm_scanned, + ) + self.scan = to_raw_response_wrapper( + qr.scan, + ) + + +class AsyncQrResourceWithRawResponse: + def __init__(self, qr: AsyncQrResource) -> None: + self._qr = qr + + self.confirm_scanned = async_to_raw_response_wrapper( + qr.confirm_scanned, + ) + self.scan = async_to_raw_response_wrapper( + qr.scan, + ) + + +class QrResourceWithStreamingResponse: + def __init__(self, qr: QrResource) -> None: + self._qr = qr + + self.confirm_scanned = to_streamed_response_wrapper( + qr.confirm_scanned, + ) + self.scan = to_streamed_response_wrapper( + qr.scan, + ) + + +class AsyncQrResourceWithStreamingResponse: + def __init__(self, qr: AsyncQrResource) -> None: + self._qr = qr + + self.confirm_scanned = async_to_streamed_response_wrapper( + qr.confirm_scanned, + ) + self.scan = async_to_streamed_response_wrapper( + qr.scan, + ) diff --git a/src/beeper_desktop_api/resources/app/verifications/sas.py b/src/beeper_desktop_api/resources/app/verifications/sas.py new file mode 100644 index 0000000..f5e5143 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/verifications/sas.py @@ -0,0 +1,259 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import path_template +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.app.verifications.sas_start_response import SASStartResponse +from ....types.app.verifications.sas_confirm_response import SASConfirmResponse + +__all__ = ["SASResource", "AsyncSASResource"] + + +class SASResource(SyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def with_raw_response(self) -> SASResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return SASResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SASResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return SASResourceWithStreamingResponse(self) + + def confirm( + self, + verification_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, + ) -> SASConfirmResponse: + """ + Confirm that the emoji or number sequence matches on both devices. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/setup/verifications/{verification_id}/sas/confirm", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SASConfirmResponse, + ) + + def start( + self, + verification_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, + ) -> SASStartResponse: + """ + Start emoji comparison for device verification. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/setup/verifications/{verification_id}/sas/start", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SASStartResponse, + ) + + +class AsyncSASResource(AsyncAPIResource): + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + + @cached_property + def with_raw_response(self) -> AsyncSASResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncSASResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSASResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncSASResourceWithStreamingResponse(self) + + async def confirm( + self, + verification_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, + ) -> SASConfirmResponse: + """ + Confirm that the emoji or number sequence matches on both devices. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/setup/verifications/{verification_id}/sas/confirm", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SASConfirmResponse, + ) + + async def start( + self, + verification_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, + ) -> SASStartResponse: + """ + Start emoji comparison for device verification. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/setup/verifications/{verification_id}/sas/start", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SASStartResponse, + ) + + +class SASResourceWithRawResponse: + def __init__(self, sas: SASResource) -> None: + self._sas = sas + + self.confirm = to_raw_response_wrapper( + sas.confirm, + ) + self.start = to_raw_response_wrapper( + sas.start, + ) + + +class AsyncSASResourceWithRawResponse: + def __init__(self, sas: AsyncSASResource) -> None: + self._sas = sas + + self.confirm = async_to_raw_response_wrapper( + sas.confirm, + ) + self.start = async_to_raw_response_wrapper( + sas.start, + ) + + +class SASResourceWithStreamingResponse: + def __init__(self, sas: SASResource) -> None: + self._sas = sas + + self.confirm = to_streamed_response_wrapper( + sas.confirm, + ) + self.start = to_streamed_response_wrapper( + sas.start, + ) + + +class AsyncSASResourceWithStreamingResponse: + def __init__(self, sas: AsyncSASResource) -> None: + self._sas = sas + + self.confirm = async_to_streamed_response_wrapper( + sas.confirm, + ) + self.start = async_to_streamed_response_wrapper( + sas.start, + ) diff --git a/src/beeper_desktop_api/resources/app/verifications/verifications.py b/src/beeper_desktop_api/resources/app/verifications/verifications.py new file mode 100644 index 0000000..3854036 --- /dev/null +++ b/src/beeper_desktop_api/resources/app/verifications/verifications.py @@ -0,0 +1,625 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from .qr import ( + QrResource, + AsyncQrResource, + QrResourceWithRawResponse, + AsyncQrResourceWithRawResponse, + QrResourceWithStreamingResponse, + AsyncQrResourceWithStreamingResponse, +) +from .sas import ( + SASResource, + AsyncSASResource, + SASResourceWithRawResponse, + AsyncSASResourceWithRawResponse, + SASResourceWithStreamingResponse, + AsyncSASResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import path_template, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.app import verification_cancel_params, verification_create_params +from ...._base_client import make_request_options +from ....types.app.verification_list_response import VerificationListResponse +from ....types.app.verification_accept_response import VerificationAcceptResponse +from ....types.app.verification_cancel_response import VerificationCancelResponse +from ....types.app.verification_create_response import VerificationCreateResponse +from ....types.app.verification_retrieve_response import VerificationRetrieveResponse + +__all__ = ["VerificationsResource", "AsyncVerificationsResource"] + + +class VerificationsResource(SyncAPIResource): + """Manage device verification transactions""" + + @cached_property + def qr(self) -> QrResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return QrResource(self._client) + + @cached_property + def sas(self) -> SASResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return SASResource(self._client) + + @cached_property + def with_raw_response(self) -> VerificationsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return VerificationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VerificationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return VerificationsResourceWithStreamingResponse(self) + + def create( + self, + *, + purpose: Literal["login", "device"] | Omit = omit, + user_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> VerificationCreateResponse: + """ + Start verifying this device from another signed-in device. + + Args: + purpose: Why this verification is being started. + + user_id: Beeper user ID to verify. Defaults to the signed-in user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verifications", + body=maybe_transform( + { + "purpose": purpose, + "user_id": user_id, + }, + verification_create_params.VerificationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCreateResponse, + ) + + def retrieve( + self, + verification_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, + ) -> VerificationRetrieveResponse: + """ + Get the current state of a device verification transaction. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._get( + path_template("/v1/app/setup/verifications/{verification_id}", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationRetrieveResponse, + ) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> VerificationListResponse: + """List pending and active device verifications. + + Use this to recover state without + a WebSocket connection. + """ + return self._get( + "/v1/app/setup/verifications", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationListResponse, + ) + + def accept( + self, + verification_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, + ) -> VerificationAcceptResponse: + """ + Accept an incoming device verification request. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/setup/verifications/{verification_id}/accept", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationAcceptResponse, + ) + + def cancel( + self, + verification_id: str, + *, + code: str | Omit = omit, + reason: 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, + ) -> VerificationCancelResponse: + """ + Cancel an active device verification request. + + Args: + verification_id: Verification ID. + + code: Optional cancellation code. + + reason: Optional user-facing cancellation reason. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return self._post( + path_template("/v1/app/setup/verifications/{verification_id}/cancel", verification_id=verification_id), + body=maybe_transform( + { + "code": code, + "reason": reason, + }, + verification_cancel_params.VerificationCancelParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCancelResponse, + ) + + +class AsyncVerificationsResource(AsyncAPIResource): + """Manage device verification transactions""" + + @cached_property + def qr(self) -> AsyncQrResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncQrResource(self._client) + + @cached_property + def sas(self) -> AsyncSASResource: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncSASResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncVerificationsResourceWithRawResponse: + """ + 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/beeper/desktop-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncVerificationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVerificationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/beeper/desktop-api-python#with_streaming_response + """ + return AsyncVerificationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + purpose: Literal["login", "device"] | Omit = omit, + user_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> VerificationCreateResponse: + """ + Start verifying this device from another signed-in device. + + Args: + purpose: Why this verification is being started. + + user_id: Beeper user ID to verify. Defaults to the signed-in user. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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( + "/v1/app/setup/verifications", + body=await async_maybe_transform( + { + "purpose": purpose, + "user_id": user_id, + }, + verification_create_params.VerificationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCreateResponse, + ) + + async def retrieve( + self, + verification_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, + ) -> VerificationRetrieveResponse: + """ + Get the current state of a device verification transaction. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._get( + path_template("/v1/app/setup/verifications/{verification_id}", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationRetrieveResponse, + ) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> VerificationListResponse: + """List pending and active device verifications. + + Use this to recover state without + a WebSocket connection. + """ + return await self._get( + "/v1/app/setup/verifications", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationListResponse, + ) + + async def accept( + self, + verification_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, + ) -> VerificationAcceptResponse: + """ + Accept an incoming device verification request. + + Args: + verification_id: Verification ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/setup/verifications/{verification_id}/accept", verification_id=verification_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationAcceptResponse, + ) + + async def cancel( + self, + verification_id: str, + *, + code: str | Omit = omit, + reason: 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, + ) -> VerificationCancelResponse: + """ + Cancel an active device verification request. + + Args: + verification_id: Verification ID. + + code: Optional cancellation code. + + reason: Optional user-facing cancellation reason. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not verification_id: + raise ValueError(f"Expected a non-empty value for `verification_id` but received {verification_id!r}") + return await self._post( + path_template("/v1/app/setup/verifications/{verification_id}/cancel", verification_id=verification_id), + body=await async_maybe_transform( + { + "code": code, + "reason": reason, + }, + verification_cancel_params.VerificationCancelParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VerificationCancelResponse, + ) + + +class VerificationsResourceWithRawResponse: + def __init__(self, verifications: VerificationsResource) -> None: + self._verifications = verifications + + self.create = to_raw_response_wrapper( + verifications.create, + ) + self.retrieve = to_raw_response_wrapper( + verifications.retrieve, + ) + self.list = to_raw_response_wrapper( + verifications.list, + ) + self.accept = to_raw_response_wrapper( + verifications.accept, + ) + self.cancel = to_raw_response_wrapper( + verifications.cancel, + ) + + @cached_property + def qr(self) -> QrResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return QrResourceWithRawResponse(self._verifications.qr) + + @cached_property + def sas(self) -> SASResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return SASResourceWithRawResponse(self._verifications.sas) + + +class AsyncVerificationsResourceWithRawResponse: + def __init__(self, verifications: AsyncVerificationsResource) -> None: + self._verifications = verifications + + self.create = async_to_raw_response_wrapper( + verifications.create, + ) + self.retrieve = async_to_raw_response_wrapper( + verifications.retrieve, + ) + self.list = async_to_raw_response_wrapper( + verifications.list, + ) + self.accept = async_to_raw_response_wrapper( + verifications.accept, + ) + self.cancel = async_to_raw_response_wrapper( + verifications.cancel, + ) + + @cached_property + def qr(self) -> AsyncQrResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncQrResourceWithRawResponse(self._verifications.qr) + + @cached_property + def sas(self) -> AsyncSASResourceWithRawResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncSASResourceWithRawResponse(self._verifications.sas) + + +class VerificationsResourceWithStreamingResponse: + def __init__(self, verifications: VerificationsResource) -> None: + self._verifications = verifications + + self.create = to_streamed_response_wrapper( + verifications.create, + ) + self.retrieve = to_streamed_response_wrapper( + verifications.retrieve, + ) + self.list = to_streamed_response_wrapper( + verifications.list, + ) + self.accept = to_streamed_response_wrapper( + verifications.accept, + ) + self.cancel = to_streamed_response_wrapper( + verifications.cancel, + ) + + @cached_property + def qr(self) -> QrResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return QrResourceWithStreamingResponse(self._verifications.qr) + + @cached_property + def sas(self) -> SASResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return SASResourceWithStreamingResponse(self._verifications.sas) + + +class AsyncVerificationsResourceWithStreamingResponse: + def __init__(self, verifications: AsyncVerificationsResource) -> None: + self._verifications = verifications + + self.create = async_to_streamed_response_wrapper( + verifications.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + verifications.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + verifications.list, + ) + self.accept = async_to_streamed_response_wrapper( + verifications.accept, + ) + self.cancel = async_to_streamed_response_wrapper( + verifications.cancel, + ) + + @cached_property + def qr(self) -> AsyncQrResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncQrResourceWithStreamingResponse(self._verifications.qr) + + @cached_property + def sas(self) -> AsyncSASResourceWithStreamingResponse: + """ + First-party sign-in and encrypted messaging setup for Beeper Desktop and Beeper Server. + """ + return AsyncSASResourceWithStreamingResponse(self._verifications.sas) diff --git a/src/beeper_desktop_api/types/__init__.py b/src/beeper_desktop_api/types/__init__.py index 61b5559..137c214 100644 --- a/src/beeper_desktop_api/types/__init__.py +++ b/src/beeper_desktop_api/types/__init__.py @@ -34,6 +34,7 @@ from .client_focus_params import ClientFocusParams as ClientFocusParams from .message_list_params import MessageListParams as MessageListParams from .message_send_params import MessageSendParams as MessageSendParams +from .app_session_response import AppSessionResponse as AppSessionResponse from .bridge_list_response import BridgeListResponse as BridgeListResponse from .chat_create_response import ChatCreateResponse as ChatCreateResponse from .chat_retrieve_params import ChatRetrieveParams as ChatRetrieveParams diff --git a/src/beeper_desktop_api/types/app/__init__.py b/src/beeper_desktop_api/types/app/__init__.py index f8ee8b1..2944080 100644 --- a/src/beeper_desktop_api/types/app/__init__.py +++ b/src/beeper_desktop_api/types/app/__init__.py @@ -1,3 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .login_email_params import LoginEmailParams as LoginEmailParams +from .login_start_response import LoginStartResponse as LoginStartResponse +from .login_register_params import LoginRegisterParams as LoginRegisterParams +from .login_response_params import LoginResponseParams as LoginResponseParams +from .login_register_response import LoginRegisterResponse as LoginRegisterResponse +from .login_response_response import LoginResponseResponse as LoginResponseResponse +from .verification_cancel_params import VerificationCancelParams as VerificationCancelParams +from .verification_create_params import VerificationCreateParams as VerificationCreateParams +from .verification_list_response import VerificationListResponse as VerificationListResponse +from .verification_accept_response import VerificationAcceptResponse as VerificationAcceptResponse +from .verification_cancel_response import VerificationCancelResponse as VerificationCancelResponse +from .verification_create_response import VerificationCreateResponse as VerificationCreateResponse +from .verification_retrieve_response import VerificationRetrieveResponse as VerificationRetrieveResponse diff --git a/src/beeper_desktop_api/types/app/login/verification/__init__.py b/src/beeper_desktop_api/types/app/login/verification/__init__.py index f8ee8b1..d979259 100644 --- a/src/beeper_desktop_api/types/app/login/verification/__init__.py +++ b/src/beeper_desktop_api/types/app/login/verification/__init__.py @@ -1,3 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .recovery_key_verify_params import RecoveryKeyVerifyParams as RecoveryKeyVerifyParams +from .recovery_key_verify_response import RecoveryKeyVerifyResponse as RecoveryKeyVerifyResponse diff --git a/src/beeper_desktop_api/types/app/login/verification/recovery_key/__init__.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key/__init__.py index f8ee8b1..0299c46 100644 --- a/src/beeper_desktop_api/types/app/login/verification/recovery_key/__init__.py +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key/__init__.py @@ -1,3 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .reset_create_params import ResetCreateParams as ResetCreateParams +from .reset_confirm_params import ResetConfirmParams as ResetConfirmParams +from .reset_create_response import ResetCreateResponse as ResetCreateResponse +from .reset_confirm_response import ResetConfirmResponse as ResetConfirmResponse diff --git a/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_params.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_params.py new file mode 100644 index 0000000..8c5ce40 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ......_utils import PropertyInfo + +__all__ = ["ResetConfirmParams"] + + +class ResetConfirmParams(TypedDict, total=False): + recovery_key: Required[Annotated[str, PropertyInfo(alias="recoveryKey")]] + """New recovery key returned by the reset step.""" diff --git a/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_response.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_response.py new file mode 100644 index 0000000..bc6cb66 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_confirm_response.py @@ -0,0 +1,192 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ......_models import BaseModel + +__all__ = [ + "ResetConfirmResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class ResetConfirmResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" diff --git a/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_params.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_params.py new file mode 100644 index 0000000..5d9fd5b --- /dev/null +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_params.py @@ -0,0 +1,14 @@ +# 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__ = ["ResetCreateParams"] + + +class ResetCreateParams(TypedDict, total=False): + existing_recovery_key: Annotated[str, PropertyInfo(alias="existingRecoveryKey")] + """Existing recovery key, if the user has it.""" diff --git a/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_response.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_response.py new file mode 100644 index 0000000..166f642 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key/reset_create_response.py @@ -0,0 +1,200 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ......_models import BaseModel + +__all__ = [ + "ResetCreateResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """ + Current app sign-in and encrypted messaging setup state after creating the new recovery key. + """ + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class ResetCreateResponse(BaseModel): + recovery_key: str = FieldInfo(alias="recoveryKey") + """New recovery key. Show it once and ask the user to save it.""" + + session: Session + """ + Current app sign-in and encrypted messaging setup state after creating the new + recovery key. + """ diff --git a/src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_params.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_params.py new file mode 100644 index 0000000..cdb0e08 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["RecoveryKeyVerifyParams"] + + +class RecoveryKeyVerifyParams(TypedDict, total=False): + recovery_key: Required[Annotated[str, PropertyInfo(alias="recoveryKey")]] + """Recovery key saved by the user.""" diff --git a/src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_response.py b/src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_response.py new file mode 100644 index 0000000..1c3baaa --- /dev/null +++ b/src/beeper_desktop_api/types/app/login/verification/recovery_key_verify_response.py @@ -0,0 +1,192 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "RecoveryKeyVerifyResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class RecoveryKeyVerifyResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" diff --git a/src/beeper_desktop_api/types/app/login_email_params.py b/src/beeper_desktop_api/types/app/login_email_params.py new file mode 100644 index 0000000..30062dd --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_email_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LoginEmailParams"] + + +class LoginEmailParams(TypedDict, total=False): + email: Required[str] + """Email address to send the sign-in code to.""" + + setup_request_id: Required[Annotated[str, PropertyInfo(alias="setupRequestID")]] + """Setup request ID returned by the start step.""" diff --git a/src/beeper_desktop_api/types/app/login_register_params.py b/src/beeper_desktop_api/types/app/login_register_params.py new file mode 100644 index 0000000..7848626 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_register_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LoginRegisterParams"] + + +class LoginRegisterParams(TypedDict, total=False): + accept_terms: Required[Annotated[Literal[True], PropertyInfo(alias="acceptTerms")]] + """ + Confirms that the user agreed to our + [terms of use](https://www.beeper.com/terms-onboarding) and has read our + [privacy policy](https://www.beeper.com/privacy). + """ + + lead_token: Required[Annotated[str, PropertyInfo(alias="leadToken")]] + """Registration token returned by Beeper.""" + + setup_request_id: Required[Annotated[str, PropertyInfo(alias="setupRequestID")]] + """Setup request ID returned by the start step.""" + + username: Required[str] + """Username selected by the user.""" diff --git a/src/beeper_desktop_api/types/app/login_register_response.py b/src/beeper_desktop_api/types/app/login_register_response.py new file mode 100644 index 0000000..c67f552 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_register_response.py @@ -0,0 +1,212 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "LoginRegisterResponse", + "Matrix", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", +] + + +class Matrix(BaseModel): + """Account credentials for first-party app setup.""" + + access_token: str = FieldInfo(alias="accessToken") + """Beeper account access token. Returned once for first-party app setup.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state after sign-in.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class LoginRegisterResponse(BaseModel): + matrix: Matrix + """Account credentials for first-party app setup.""" + + session: Session + """Current app sign-in and encrypted messaging setup state after sign-in.""" diff --git a/src/beeper_desktop_api/types/app/login_response_params.py b/src/beeper_desktop_api/types/app/login_response_params.py new file mode 100644 index 0000000..72a2b3a --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_response_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LoginResponseParams"] + + +class LoginResponseParams(TypedDict, total=False): + response: Required[str] + """Sign-in code from the user email.""" + + setup_request_id: Required[Annotated[str, PropertyInfo(alias="setupRequestID")]] + """Setup request ID returned by the start step.""" diff --git a/src/beeper_desktop_api/types/app/login_response_response.py b/src/beeper_desktop_api/types/app/login_response_response.py new file mode 100644 index 0000000..fb75746 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_response_response.py @@ -0,0 +1,251 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "LoginResponseResponse", + "Success", + "SuccessMatrix", + "SuccessSession", + "SuccessSessionE2EE", + "SuccessSessionE2EESecrets", + "SuccessSessionMatrix", + "SuccessSessionVerification", + "SuccessSessionVerificationError", + "SuccessSessionVerificationOtherDevice", + "SuccessSessionVerificationQr", + "SuccessSessionVerificationSAS", + "RegistrationRequired", + "RegistrationRequiredCopy", +] + + +class SuccessMatrix(BaseModel): + """Account credentials for first-party app setup.""" + + access_token: str = FieldInfo(alias="accessToken") + """Beeper account access token. Returned once for first-party app setup.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SuccessSessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SuccessSessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SuccessSessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SuccessSessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SuccessSessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SuccessSessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SuccessSessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SuccessSessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SuccessSessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SuccessSessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SuccessSessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SuccessSessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SuccessSessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class SuccessSession(BaseModel): + """Current app sign-in and encrypted messaging setup state after sign-in.""" + + e2ee: SuccessSessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SuccessSessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SuccessSessionVerification] = None + """Trusted device verification progress.""" + + +class Success(BaseModel): + matrix: SuccessMatrix + """Account credentials for first-party app setup.""" + + session: SuccessSession + """Current app sign-in and encrypted messaging setup state after sign-in.""" + + +class RegistrationRequiredCopy(BaseModel): + """Copy to display during account creation.""" + + submit: Literal["Continue"] + """Submit button label.""" + + terms: Literal["By continuing, you agree to the Terms of Use and acknowledge the Privacy Policy."] + """Terms and privacy notice to show before account creation.""" + + title: Literal["Choose your username"] + """Title for the username step.""" + + username_placeholder: Literal["Username"] = FieldInfo(alias="usernamePlaceholder") + """Placeholder for the username field.""" + + +class RegistrationRequired(BaseModel): + copy_: RegistrationRequiredCopy = FieldInfo(alias="copy") + """Copy to display during account creation.""" + + lead_token: str = FieldInfo(alias="leadToken") + """Registration token returned by Beeper.""" + + registration_required: Literal[True] = FieldInfo(alias="registrationRequired") + """Indicates that the user needs to create a Beeper account.""" + + setup_request_id: str = FieldInfo(alias="setupRequestID") + """Setup request ID to use when creating the account.""" + + username_suggestions: Optional[List[str]] = FieldInfo(alias="usernameSuggestions", default=None) + """Suggested usernames for the new account.""" + + +LoginResponseResponse: TypeAlias = Union[Success, RegistrationRequired] diff --git a/src/beeper_desktop_api/types/app/login_start_response.py b/src/beeper_desktop_api/types/app/login_start_response.py new file mode 100644 index 0000000..7a2d5d9 --- /dev/null +++ b/src/beeper_desktop_api/types/app/login_start_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LoginStartResponse"] + + +class LoginStartResponse(BaseModel): + setup_request_id: str = FieldInfo(alias="setupRequestID") + """Setup request ID to use in the next sign-in step.""" + + sign_in_methods: List[str] = FieldInfo(alias="signInMethods") + """Available sign-in methods for this setup request.""" diff --git a/src/beeper_desktop_api/types/app/verification_accept_response.py b/src/beeper_desktop_api/types/app/verification_accept_response.py new file mode 100644 index 0000000..4691a54 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verification_accept_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "VerificationAcceptResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class VerificationAcceptResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app/verification_cancel_params.py b/src/beeper_desktop_api/types/app/verification_cancel_params.py new file mode 100644 index 0000000..d954b97 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verification_cancel_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["VerificationCancelParams"] + + +class VerificationCancelParams(TypedDict, total=False): + code: str + """Optional cancellation code.""" + + reason: str + """Optional user-facing cancellation reason.""" diff --git a/src/beeper_desktop_api/types/app/verification_cancel_response.py b/src/beeper_desktop_api/types/app/verification_cancel_response.py new file mode 100644 index 0000000..68dfc2f --- /dev/null +++ b/src/beeper_desktop_api/types/app/verification_cancel_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "VerificationCancelResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class VerificationCancelResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app/verification_create_params.py b/src/beeper_desktop_api/types/app/verification_create_params.py new file mode 100644 index 0000000..6359e67 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verification_create_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["VerificationCreateParams"] + + +class VerificationCreateParams(TypedDict, total=False): + purpose: Literal["login", "device"] + """Why this verification is being started.""" + + user_id: Annotated[str, PropertyInfo(alias="userID")] + """Beeper user ID to verify. Defaults to the signed-in user.""" diff --git a/src/beeper_desktop_api/types/app/verification_create_response.py b/src/beeper_desktop_api/types/app/verification_create_response.py new file mode 100644 index 0000000..a88c143 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verification_create_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "VerificationCreateResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class VerificationCreateResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app/verification_list_response.py b/src/beeper_desktop_api/types/app/verification_list_response.py new file mode 100644 index 0000000..8b138f4 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verification_list_response.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["VerificationListResponse", "Item", "ItemError", "ItemOtherDevice", "ItemQr", "ItemSAS"] + + +class ItemError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class ItemOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class ItemQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class ItemSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Item(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[ItemError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[ItemOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[ItemQr] = None + """QR verification data.""" + + sas: Optional[ItemSAS] = None + """Emoji or number comparison data for verification.""" + + +class VerificationListResponse(BaseModel): + items: List[Item] diff --git a/src/beeper_desktop_api/types/app/verification_retrieve_response.py b/src/beeper_desktop_api/types/app/verification_retrieve_response.py new file mode 100644 index 0000000..baff10c --- /dev/null +++ b/src/beeper_desktop_api/types/app/verification_retrieve_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "VerificationRetrieveResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class VerificationRetrieveResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app/verifications/__init__.py b/src/beeper_desktop_api/types/app/verifications/__init__.py index f8ee8b1..72e2812 100644 --- a/src/beeper_desktop_api/types/app/verifications/__init__.py +++ b/src/beeper_desktop_api/types/app/verifications/__init__.py @@ -1,3 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .qr_scan_params import QrScanParams as QrScanParams +from .qr_scan_response import QrScanResponse as QrScanResponse +from .sas_start_response import SASStartResponse as SASStartResponse +from .sas_confirm_response import SASConfirmResponse as SASConfirmResponse +from .qr_confirm_scanned_response import QrConfirmScannedResponse as QrConfirmScannedResponse diff --git a/src/beeper_desktop_api/types/app/verifications/qr_confirm_scanned_response.py b/src/beeper_desktop_api/types/app/verifications/qr_confirm_scanned_response.py new file mode 100644 index 0000000..c63b4f9 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verifications/qr_confirm_scanned_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "QrConfirmScannedResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class QrConfirmScannedResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app/verifications/qr_scan_params.py b/src/beeper_desktop_api/types/app/verifications/qr_scan_params.py new file mode 100644 index 0000000..a16f78e --- /dev/null +++ b/src/beeper_desktop_api/types/app/verifications/qr_scan_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["QrScanParams"] + + +class QrScanParams(TypedDict, total=False): + data: Required[str] + """QR code payload scanned from the other device.""" diff --git a/src/beeper_desktop_api/types/app/verifications/qr_scan_response.py b/src/beeper_desktop_api/types/app/verifications/qr_scan_response.py new file mode 100644 index 0000000..46c3399 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verifications/qr_scan_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "QrScanResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class QrScanResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app/verifications/sas_confirm_response.py b/src/beeper_desktop_api/types/app/verifications/sas_confirm_response.py new file mode 100644 index 0000000..340de20 --- /dev/null +++ b/src/beeper_desktop_api/types/app/verifications/sas_confirm_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "SASConfirmResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class SASConfirmResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app/verifications/sas_start_response.py b/src/beeper_desktop_api/types/app/verifications/sas_start_response.py new file mode 100644 index 0000000..544c4ad --- /dev/null +++ b/src/beeper_desktop_api/types/app/verifications/sas_start_response.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "SASStartResponse", + "Session", + "SessionE2EE", + "SessionE2EESecrets", + "SessionMatrix", + "SessionVerification", + "SessionVerificationError", + "SessionVerificationOtherDevice", + "SessionVerificationQr", + "SessionVerificationSAS", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class SessionE2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class SessionE2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: SessionE2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class SessionMatrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class SessionVerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class SessionVerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class SessionVerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class SessionVerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class SessionVerification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[SessionVerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[SessionVerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[SessionVerificationQr] = None + """QR verification data.""" + + sas: Optional[SessionVerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class Session(BaseModel): + """Current app sign-in and encrypted messaging setup state.""" + + e2ee: SessionE2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[SessionMatrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[SessionVerification] = None + """Trusted device verification progress.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class SASStartResponse(BaseModel): + session: Session + """Current app sign-in and encrypted messaging setup state.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/src/beeper_desktop_api/types/app_session_response.py b/src/beeper_desktop_api/types/app_session_response.py new file mode 100644 index 0000000..1b5deee --- /dev/null +++ b/src/beeper_desktop_api/types/app_session_response.py @@ -0,0 +1,184 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = [ + "AppSessionResponse", + "E2EE", + "E2EESecrets", + "Matrix", + "Verification", + "VerificationError", + "VerificationOtherDevice", + "VerificationQr", + "VerificationSAS", +] + + +class E2EESecrets(BaseModel): + """Encrypted messaging keys available on this device.""" + + master_key: bool = FieldInfo(alias="masterKey") + """Whether the account identity key is available.""" + + megolm_backup_key: bool = FieldInfo(alias="megolmBackupKey") + """Whether the encrypted message backup key is available.""" + + recovery_key: bool = FieldInfo(alias="recoveryKey") + """Whether a recovery key is available.""" + + self_signing_key: bool = FieldInfo(alias="selfSigningKey") + """Whether the device trust key is available.""" + + user_signing_key: bool = FieldInfo(alias="userSigningKey") + """Whether the user trust key is available.""" + + +class E2EE(BaseModel): + """Encrypted messaging setup status.""" + + cross_signing: bool = FieldInfo(alias="crossSigning") + """Whether this account can verify trusted devices.""" + + first_sync_done: bool = FieldInfo(alias="firstSyncDone") + """Whether the first encrypted message sync is complete.""" + + has_backed_up_recovery_key: bool = FieldInfo(alias="hasBackedUpRecoveryKey") + """Whether the user confirmed that they saved their recovery key.""" + + initialized: bool + """Whether encrypted messaging setup has started.""" + + key_backup: bool = FieldInfo(alias="keyBackup") + """Whether encrypted message backup is available.""" + + secrets: E2EESecrets + """Encrypted messaging keys available on this device.""" + + secret_storage: bool = FieldInfo(alias="secretStorage") + """Whether secure key storage is available.""" + + verified: bool + """Whether this device is trusted for encrypted messages.""" + + recovery_key_generated_at: Optional[float] = FieldInfo(alias="recoveryKeyGeneratedAt", default=None) + """Unix timestamp for when the recovery key was created.""" + + +class Matrix(BaseModel): + """Signed-in account details. Omitted until sign-in is complete.""" + + device_id: str = FieldInfo(alias="deviceID") + """Current device ID.""" + + homeserver: str + """Beeper homeserver URL for this account.""" + + user_id: str = FieldInfo(alias="userID") + """Signed-in Beeper user ID.""" + + +class VerificationError(BaseModel): + """Verification error details, if verification stopped.""" + + code: str + """Verification error code.""" + + reason: str + """User-facing verification error message.""" + + +class VerificationOtherDevice(BaseModel): + """Other device participating in verification.""" + + id: str + """Other device ID.""" + + name: Optional[str] = None + """Other device display name, if known.""" + + +class VerificationQr(BaseModel): + """QR verification data.""" + + data: str + """QR code payload to display for verification.""" + + +class VerificationSAS(BaseModel): + """Emoji or number comparison data for verification.""" + + emojis: str + """Emoji sequence to compare on both devices.""" + + decimals: Optional[str] = None + """Number sequence to compare on both devices.""" + + +class Verification(BaseModel): + """Trusted device verification progress.""" + + id: str + """Verification ID to pass in verification action paths.""" + + available_actions: List[Literal["accept", "cancel", "qr.confirmScanned", "sas.start", "sas.confirm"]] = FieldInfo( + alias="availableActions" + ) + """Verification actions that are valid for the current state.""" + + direction: Literal["incoming", "outgoing"] + """Whether this device started or received the verification.""" + + methods: List[Literal["qr", "sas"]] + """Verification methods supported for this transaction.""" + + purpose: Literal["login", "device"] + """Why this verification exists.""" + + state: Literal["requested", "ready", "sas_ready", "qr_scanned", "done", "cancelled", "error"] + """Current trusted-device verification state.""" + + error: Optional[VerificationError] = None + """Verification error details, if verification stopped.""" + + other_device: Optional[VerificationOtherDevice] = FieldInfo(alias="otherDevice", default=None) + """Other device participating in verification.""" + + other_user_id: Optional[str] = FieldInfo(alias="otherUserID", default=None) + """Other Beeper user participating in verification.""" + + qr: Optional[VerificationQr] = None + """QR verification data.""" + + sas: Optional[VerificationSAS] = None + """Emoji or number comparison data for verification.""" + + +class AppSessionResponse(BaseModel): + e2ee: E2EE + """Encrypted messaging setup status.""" + + state: Literal[ + "needs-login", + "initializing", + "needs-cross-signing-setup", + "needs-verification", + "needs-secrets", + "needs-first-sync", + "ready", + ] + """ + Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper + Server. + """ + + matrix: Optional[Matrix] = None + """Signed-in account details. Omitted until sign-in is complete.""" + + verification: Optional[Verification] = None + """Trusted device verification progress.""" diff --git a/tests/api_resources/app/__init__.py b/tests/api_resources/app/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/login/__init__.py b/tests/api_resources/app/login/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/login/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/login/verification/__init__.py b/tests/api_resources/app/login/verification/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/login/verification/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/login/verification/recovery_key/__init__.py b/tests/api_resources/app/login/verification/recovery_key/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/login/verification/recovery_key/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/login/verification/recovery_key/test_reset.py b/tests/api_resources/app/login/verification/recovery_key/test_reset.py new file mode 100644 index 0000000..9b96cbd --- /dev/null +++ b/tests/api_resources/app/login/verification/recovery_key/test_reset.py @@ -0,0 +1,153 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.login.verification.recovery_key import ( + ResetCreateResponse, + ResetConfirmResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestReset: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: BeeperDesktop) -> None: + reset = client.app.login.verification.recovery_key.reset.create() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: + reset = client.app.login.verification.recovery_key.reset.create( + existing_recovery_key="existingRecoveryKey", + ) + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: BeeperDesktop) -> None: + response = client.app.login.verification.recovery_key.reset.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: BeeperDesktop) -> None: + with client.app.login.verification.recovery_key.reset.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_confirm(self, client: BeeperDesktop) -> None: + reset = client.app.login.verification.recovery_key.reset.confirm( + recovery_key="x", + ) + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + def test_raw_response_confirm(self, client: BeeperDesktop) -> None: + response = client.app.login.verification.recovery_key.reset.with_raw_response.confirm( + recovery_key="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + def test_streaming_response_confirm(self, client: BeeperDesktop) -> None: + with client.app.login.verification.recovery_key.reset.with_streaming_response.confirm( + recovery_key="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncReset: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: + reset = await async_client.app.login.verification.recovery_key.reset.create() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + reset = await async_client.app.login.verification.recovery_key.reset.create( + existing_recovery_key="existingRecoveryKey", + ) + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.verification.recovery_key.reset.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = await response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.verification.recovery_key.reset.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = await response.parse() + assert_matches_type(ResetCreateResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_confirm(self, async_client: AsyncBeeperDesktop) -> None: + reset = await async_client.app.login.verification.recovery_key.reset.confirm( + recovery_key="x", + ) + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + async def test_raw_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.verification.recovery_key.reset.with_raw_response.confirm( + recovery_key="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reset = await response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + @parametrize + async def test_streaming_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.verification.recovery_key.reset.with_streaming_response.confirm( + recovery_key="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reset = await response.parse() + assert_matches_type(ResetConfirmResponse, reset, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/login/verification/test_recovery_key.py b/tests/api_resources/app/login/verification/test_recovery_key.py new file mode 100644 index 0000000..5778b2a --- /dev/null +++ b/tests/api_resources/app/login/verification/test_recovery_key.py @@ -0,0 +1,86 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.login.verification import RecoveryKeyVerifyResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRecoveryKey: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_verify(self, client: BeeperDesktop) -> None: + recovery_key = client.app.login.verification.recovery_key.verify( + recovery_key="x", + ) + assert_matches_type(RecoveryKeyVerifyResponse, recovery_key, path=["response"]) + + @parametrize + def test_raw_response_verify(self, client: BeeperDesktop) -> None: + response = client.app.login.verification.recovery_key.with_raw_response.verify( + recovery_key="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + recovery_key = response.parse() + assert_matches_type(RecoveryKeyVerifyResponse, recovery_key, path=["response"]) + + @parametrize + def test_streaming_response_verify(self, client: BeeperDesktop) -> None: + with client.app.login.verification.recovery_key.with_streaming_response.verify( + recovery_key="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + recovery_key = response.parse() + assert_matches_type(RecoveryKeyVerifyResponse, recovery_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRecoveryKey: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_verify(self, async_client: AsyncBeeperDesktop) -> None: + recovery_key = await async_client.app.login.verification.recovery_key.verify( + recovery_key="x", + ) + assert_matches_type(RecoveryKeyVerifyResponse, recovery_key, path=["response"]) + + @parametrize + async def test_raw_response_verify(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.verification.recovery_key.with_raw_response.verify( + recovery_key="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + recovery_key = await response.parse() + assert_matches_type(RecoveryKeyVerifyResponse, recovery_key, path=["response"]) + + @parametrize + async def test_streaming_response_verify(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.verification.recovery_key.with_streaming_response.verify( + recovery_key="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + recovery_key = await response.parse() + assert_matches_type(RecoveryKeyVerifyResponse, recovery_key, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/test_login.py b/tests/api_resources/app/test_login.py new file mode 100644 index 0000000..343ef54 --- /dev/null +++ b/tests/api_resources/app/test_login.py @@ -0,0 +1,294 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app import ( + LoginStartResponse, + LoginRegisterResponse, + LoginResponseResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLogin: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_email(self, client: BeeperDesktop) -> None: + login = client.app.login.email( + email="dev@stainless.com", + setup_request_id="setupRequestID", + ) + assert login is None + + @parametrize + def test_raw_response_email(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.email( + email="dev@stainless.com", + setup_request_id="setupRequestID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert login is None + + @parametrize + def test_streaming_response_email(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.email( + email="dev@stainless.com", + setup_request_id="setupRequestID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert login is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_register(self, client: BeeperDesktop) -> None: + login = client.app.login.register( + accept_terms=True, + lead_token="leadToken", + setup_request_id="setupRequestID", + username="x", + ) + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + def test_raw_response_register(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.register( + accept_terms=True, + lead_token="leadToken", + setup_request_id="setupRequestID", + username="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + def test_streaming_response_register(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.register( + accept_terms=True, + lead_token="leadToken", + setup_request_id="setupRequestID", + username="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_response(self, client: BeeperDesktop) -> None: + login = client.app.login.response( + response="response", + setup_request_id="setupRequestID", + ) + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + def test_raw_response_response(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.response( + response="response", + setup_request_id="setupRequestID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + def test_streaming_response_response(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.response( + response="response", + setup_request_id="setupRequestID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_start(self, client: BeeperDesktop) -> None: + login = client.app.login.start() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + def test_raw_response_start(self, client: BeeperDesktop) -> None: + response = client.app.login.with_raw_response.start() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + def test_streaming_response_start(self, client: BeeperDesktop) -> None: + with client.app.login.with_streaming_response.start() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncLogin: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_email(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.email( + email="dev@stainless.com", + setup_request_id="setupRequestID", + ) + assert login is None + + @parametrize + async def test_raw_response_email(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.email( + email="dev@stainless.com", + setup_request_id="setupRequestID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert login is None + + @parametrize + async def test_streaming_response_email(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.email( + email="dev@stainless.com", + setup_request_id="setupRequestID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert login is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_register(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.register( + accept_terms=True, + lead_token="leadToken", + setup_request_id="setupRequestID", + username="x", + ) + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + async def test_raw_response_register(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.register( + accept_terms=True, + lead_token="leadToken", + setup_request_id="setupRequestID", + username="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + @parametrize + async def test_streaming_response_register(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.register( + accept_terms=True, + lead_token="leadToken", + setup_request_id="setupRequestID", + username="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert_matches_type(LoginRegisterResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_response(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.response( + response="response", + setup_request_id="setupRequestID", + ) + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + async def test_raw_response_response(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.response( + response="response", + setup_request_id="setupRequestID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + @parametrize + async def test_streaming_response_response(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.response( + response="response", + setup_request_id="setupRequestID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert_matches_type(LoginResponseResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_start(self, async_client: AsyncBeeperDesktop) -> None: + login = await async_client.app.login.start() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + async def test_raw_response_start(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.login.with_raw_response.start() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + login = await response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + @parametrize + async def test_streaming_response_start(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.login.with_streaming_response.start() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + login = await response.parse() + assert_matches_type(LoginStartResponse, login, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/test_verifications.py b/tests/api_resources/app/test_verifications.py new file mode 100644 index 0000000..b94df48 --- /dev/null +++ b/tests/api_resources/app/test_verifications.py @@ -0,0 +1,392 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app import ( + VerificationListResponse, + VerificationAcceptResponse, + VerificationCancelResponse, + VerificationCreateResponse, + VerificationRetrieveResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVerifications: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: BeeperDesktop) -> None: + verification = client.app.verifications.create() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: BeeperDesktop) -> None: + verification = client.app.verifications.create( + purpose="login", + user_id="userID", + ) + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: BeeperDesktop) -> None: + response = client.app.verifications.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: BeeperDesktop) -> None: + with client.app.verifications.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: BeeperDesktop) -> None: + verification = client.app.verifications.retrieve( + "x", + ) + assert_matches_type(VerificationRetrieveResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: BeeperDesktop) -> None: + response = client.app.verifications.with_raw_response.retrieve( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationRetrieveResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: BeeperDesktop) -> None: + with client.app.verifications.with_streaming_response.retrieve( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationRetrieveResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.verifications.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: BeeperDesktop) -> None: + verification = client.app.verifications.list() + assert_matches_type(VerificationListResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: BeeperDesktop) -> None: + response = client.app.verifications.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationListResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: BeeperDesktop) -> None: + with client.app.verifications.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationListResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_accept(self, client: BeeperDesktop) -> None: + verification = client.app.verifications.accept( + "x", + ) + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_accept(self, client: BeeperDesktop) -> None: + response = client.app.verifications.with_raw_response.accept( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_accept(self, client: BeeperDesktop) -> None: + with client.app.verifications.with_streaming_response.accept( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_accept(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.verifications.with_raw_response.accept( + "", + ) + + @parametrize + def test_method_cancel(self, client: BeeperDesktop) -> None: + verification = client.app.verifications.cancel( + verification_id="x", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + def test_method_cancel_with_all_params(self, client: BeeperDesktop) -> None: + verification = client.app.verifications.cancel( + verification_id="x", + code="code", + reason="reason", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: BeeperDesktop) -> None: + response = client.app.verifications.with_raw_response.cancel( + verification_id="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: BeeperDesktop) -> None: + with client.app.verifications.with_streaming_response.cancel( + verification_id="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.verifications.with_raw_response.cancel( + verification_id="", + ) + + +class TestAsyncVerifications: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.verifications.create() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.verifications.create( + purpose="login", + user_id="userID", + ) + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationCreateResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.verifications.retrieve( + "x", + ) + assert_matches_type(VerificationRetrieveResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.with_raw_response.retrieve( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationRetrieveResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.with_streaming_response.retrieve( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationRetrieveResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.verifications.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.verifications.list() + assert_matches_type(VerificationListResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationListResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationListResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_accept(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.verifications.accept( + "x", + ) + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_accept(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.with_raw_response.accept( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_accept(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.with_streaming_response.accept( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationAcceptResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_accept(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.verifications.with_raw_response.accept( + "", + ) + + @parametrize + async def test_method_cancel(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.verifications.cancel( + verification_id="x", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + async def test_method_cancel_with_all_params(self, async_client: AsyncBeeperDesktop) -> None: + verification = await async_client.app.verifications.cancel( + verification_id="x", + code="code", + reason="reason", + ) + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.with_raw_response.cancel( + verification_id="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + verification = await response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.with_streaming_response.cancel( + verification_id="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + verification = await response.parse() + assert_matches_type(VerificationCancelResponse, verification, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.verifications.with_raw_response.cancel( + verification_id="", + ) diff --git a/tests/api_resources/app/verifications/__init__.py b/tests/api_resources/app/verifications/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/app/verifications/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/app/verifications/test_qr.py b/tests/api_resources/app/verifications/test_qr.py new file mode 100644 index 0000000..2678078 --- /dev/null +++ b/tests/api_resources/app/verifications/test_qr.py @@ -0,0 +1,162 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.verifications import QrScanResponse, QrConfirmScannedResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestQr: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_confirm_scanned(self, client: BeeperDesktop) -> None: + qr = client.app.verifications.qr.confirm_scanned( + "x", + ) + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + def test_raw_response_confirm_scanned(self, client: BeeperDesktop) -> None: + response = client.app.verifications.qr.with_raw_response.confirm_scanned( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + def test_streaming_response_confirm_scanned(self, client: BeeperDesktop) -> None: + with client.app.verifications.qr.with_streaming_response.confirm_scanned( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_confirm_scanned(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.verifications.qr.with_raw_response.confirm_scanned( + "", + ) + + @parametrize + def test_method_scan(self, client: BeeperDesktop) -> None: + qr = client.app.verifications.qr.scan( + data="x", + ) + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + def test_raw_response_scan(self, client: BeeperDesktop) -> None: + response = client.app.verifications.qr.with_raw_response.scan( + data="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + def test_streaming_response_scan(self, client: BeeperDesktop) -> None: + with client.app.verifications.qr.with_streaming_response.scan( + data="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncQr: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + qr = await async_client.app.verifications.qr.confirm_scanned( + "x", + ) + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + async def test_raw_response_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.qr.with_raw_response.confirm_scanned( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = await response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + @parametrize + async def test_streaming_response_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.qr.with_streaming_response.confirm_scanned( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = await response.parse() + assert_matches_type(QrConfirmScannedResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_confirm_scanned(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.verifications.qr.with_raw_response.confirm_scanned( + "", + ) + + @parametrize + async def test_method_scan(self, async_client: AsyncBeeperDesktop) -> None: + qr = await async_client.app.verifications.qr.scan( + data="x", + ) + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + async def test_raw_response_scan(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.qr.with_raw_response.scan( + data="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + qr = await response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + @parametrize + async def test_streaming_response_scan(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.qr.with_streaming_response.scan( + data="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + qr = await response.parse() + assert_matches_type(QrScanResponse, qr, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/app/verifications/test_sas.py b/tests/api_resources/app/verifications/test_sas.py new file mode 100644 index 0000000..020880b --- /dev/null +++ b/tests/api_resources/app/verifications/test_sas.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types.app.verifications import SASStartResponse, SASConfirmResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSAS: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_confirm(self, client: BeeperDesktop) -> None: + sas = client.app.verifications.sas.confirm( + "x", + ) + assert_matches_type(SASConfirmResponse, sas, path=["response"]) + + @parametrize + def test_raw_response_confirm(self, client: BeeperDesktop) -> None: + response = client.app.verifications.sas.with_raw_response.confirm( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sas = response.parse() + assert_matches_type(SASConfirmResponse, sas, path=["response"]) + + @parametrize + def test_streaming_response_confirm(self, client: BeeperDesktop) -> None: + with client.app.verifications.sas.with_streaming_response.confirm( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sas = response.parse() + assert_matches_type(SASConfirmResponse, sas, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_confirm(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.verifications.sas.with_raw_response.confirm( + "", + ) + + @parametrize + def test_method_start(self, client: BeeperDesktop) -> None: + sas = client.app.verifications.sas.start( + "x", + ) + assert_matches_type(SASStartResponse, sas, path=["response"]) + + @parametrize + def test_raw_response_start(self, client: BeeperDesktop) -> None: + response = client.app.verifications.sas.with_raw_response.start( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sas = response.parse() + assert_matches_type(SASStartResponse, sas, path=["response"]) + + @parametrize + def test_streaming_response_start(self, client: BeeperDesktop) -> None: + with client.app.verifications.sas.with_streaming_response.start( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sas = response.parse() + assert_matches_type(SASStartResponse, sas, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_start(self, client: BeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + client.app.verifications.sas.with_raw_response.start( + "", + ) + + +class TestAsyncSAS: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_confirm(self, async_client: AsyncBeeperDesktop) -> None: + sas = await async_client.app.verifications.sas.confirm( + "x", + ) + assert_matches_type(SASConfirmResponse, sas, path=["response"]) + + @parametrize + async def test_raw_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.sas.with_raw_response.confirm( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sas = await response.parse() + assert_matches_type(SASConfirmResponse, sas, path=["response"]) + + @parametrize + async def test_streaming_response_confirm(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.sas.with_streaming_response.confirm( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sas = await response.parse() + assert_matches_type(SASConfirmResponse, sas, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_confirm(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.verifications.sas.with_raw_response.confirm( + "", + ) + + @parametrize + async def test_method_start(self, async_client: AsyncBeeperDesktop) -> None: + sas = await async_client.app.verifications.sas.start( + "x", + ) + assert_matches_type(SASStartResponse, sas, path=["response"]) + + @parametrize + async def test_raw_response_start(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.verifications.sas.with_raw_response.start( + "x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + sas = await response.parse() + assert_matches_type(SASStartResponse, sas, path=["response"]) + + @parametrize + async def test_streaming_response_start(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.verifications.sas.with_streaming_response.start( + "x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + sas = await response.parse() + assert_matches_type(SASStartResponse, sas, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_start(self, async_client: AsyncBeeperDesktop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `verification_id` but received ''"): + await async_client.app.verifications.sas.with_raw_response.start( + "", + ) diff --git a/tests/api_resources/test_app.py b/tests/api_resources/test_app.py new file mode 100644 index 0000000..5fe739f --- /dev/null +++ b/tests/api_resources/test_app.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from tests.utils import assert_matches_type +from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop +from beeper_desktop_api.types import AppSessionResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestApp: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_session(self, client: BeeperDesktop) -> None: + app = client.app.session() + assert_matches_type(AppSessionResponse, app, path=["response"]) + + @parametrize + def test_raw_response_session(self, client: BeeperDesktop) -> None: + response = client.app.with_raw_response.session() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(AppSessionResponse, app, path=["response"]) + + @parametrize + def test_streaming_response_session(self, client: BeeperDesktop) -> None: + with client.app.with_streaming_response.session() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(AppSessionResponse, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncApp: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_session(self, async_client: AsyncBeeperDesktop) -> None: + app = await async_client.app.session() + assert_matches_type(AppSessionResponse, app, path=["response"]) + + @parametrize + async def test_raw_response_session(self, async_client: AsyncBeeperDesktop) -> None: + response = await async_client.app.with_raw_response.session() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(AppSessionResponse, app, path=["response"]) + + @parametrize + async def test_streaming_response_session(self, async_client: AsyncBeeperDesktop) -> None: + async with async_client.app.with_streaming_response.session() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(AppSessionResponse, app, path=["response"]) + + assert cast(Any, response.is_closed) is True From 97eaedc70589abf75941a6e428e456e766e5e1e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 17 May 2026 16:36:08 +0000 Subject: [PATCH 11/11] release: 5.1.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ pyproject.toml | 2 +- src/beeper_desktop_api/_version.py | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8e76abb..4808d97 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.0.0" + ".": "5.1.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 03fd832..81afe40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 5.1.0 (2026-05-17) + +Full Changelog: [v5.0.0...v5.1.0](https://github.com/beeper/desktop-api-python/compare/v5.0.0...v5.1.0) + +### Features + +* **api:** add app resource with login and verification endpoints ([9868f77](https://github.com/beeper/desktop-api-python/commit/9868f77423a998bfc443bc60fc00d6c7d0e58f53)) +* **api:** api update ([9c92ab4](https://github.com/beeper/desktop-api-python/commit/9c92ab490194b4640b4c152e197df698b87d465b)) +* **internal/types:** support eagerly validating pydantic iterators ([1850c8a](https://github.com/beeper/desktop-api-python/commit/1850c8a7b7d3e45407524a6ebffe902d4a3f8a71)) + + +### Bug Fixes + +* **client:** add missing f-string prefix in file type error message ([78424e2](https://github.com/beeper/desktop-api-python/commit/78424e24ad4e1f336f843222ff19bf70a50f073f)) + ## 5.0.0 (2026-05-06) Full Changelog: [v4.3.0...v5.0.0](https://github.com/beeper/desktop-api-python/compare/v4.3.0...v5.0.0) diff --git a/pyproject.toml b/pyproject.toml index 83d327e..5ce2088 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "beeper_desktop_api" -version = "5.0.0" +version = "5.1.0" description = "The official Python library for the beeperdesktop API" dynamic = ["readme"] license = "MIT" diff --git a/src/beeper_desktop_api/_version.py b/src/beeper_desktop_api/_version.py index 60fb169..701658d 100644 --- a/src/beeper_desktop_api/_version.py +++ b/src/beeper_desktop_api/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "beeper_desktop_api" -__version__ = "5.0.0" # x-release-please-version +__version__ = "5.1.0" # x-release-please-version