33from __future__ import annotations
44
55import os
6- from typing import Any , Mapping
6+ from typing import TYPE_CHECKING , Any , Mapping
77from typing_extensions import Self , override
88
99import httpx
3030 get_async_library ,
3131 async_maybe_transform ,
3232)
33+ from ._compat import cached_property
3334from ._version import __version__
3435from ._response import (
3536 to_raw_response_wrapper ,
3637 to_streamed_response_wrapper ,
3738 async_to_raw_response_wrapper ,
3839 async_to_streamed_response_wrapper ,
3940)
40- from .resources import assets , messages
4141from ._streaming import Stream as Stream , AsyncStream as AsyncStream
4242from ._exceptions import APIStatusError , BeeperDesktopError
4343from ._base_client import (
4646 AsyncAPIClient ,
4747 make_request_options ,
4848)
49- from .resources .chats import chats
50- from .resources .accounts import accounts
5149from .types .focus_response import FocusResponse
5250from .types .search_response import SearchResponse
5351
52+ if TYPE_CHECKING :
53+ from .resources import chats , assets , accounts , messages
54+ from .resources .assets import AssetsResource , AsyncAssetsResource
55+ from .resources .messages import MessagesResource , AsyncMessagesResource
56+ from .resources .chats .chats import ChatsResource , AsyncChatsResource
57+ from .resources .accounts .accounts import AccountsResource , AsyncAccountsResource
58+
5459__all__ = [
5560 "Timeout" ,
5661 "Transport" ,
6469
6570
6671class BeeperDesktop (SyncAPIClient ):
67- accounts : accounts .AccountsResource
68- chats : chats .ChatsResource
69- messages : messages .MessagesResource
70- assets : assets .AssetsResource
71- with_raw_response : BeeperDesktopWithRawResponse
72- with_streaming_response : BeeperDesktopWithStreamedResponse
73-
7472 # client options
7573 access_token : str
7674
@@ -125,12 +123,41 @@ def __init__(
125123 _strict_response_validation = _strict_response_validation ,
126124 )
127125
128- self .accounts = accounts .AccountsResource (self )
129- self .chats = chats .ChatsResource (self )
130- self .messages = messages .MessagesResource (self )
131- self .assets = assets .AssetsResource (self )
132- self .with_raw_response = BeeperDesktopWithRawResponse (self )
133- self .with_streaming_response = BeeperDesktopWithStreamedResponse (self )
126+ @cached_property
127+ def accounts (self ) -> AccountsResource :
128+ """Manage connected chat accounts"""
129+ from .resources .accounts import AccountsResource
130+
131+ return AccountsResource (self )
132+
133+ @cached_property
134+ def chats (self ) -> ChatsResource :
135+ """Manage chats"""
136+ from .resources .chats import ChatsResource
137+
138+ return ChatsResource (self )
139+
140+ @cached_property
141+ def messages (self ) -> MessagesResource :
142+ """Manage messages in chats"""
143+ from .resources .messages import MessagesResource
144+
145+ return MessagesResource (self )
146+
147+ @cached_property
148+ def assets (self ) -> AssetsResource :
149+ """Manage assets in Beeper Desktop, like message attachments"""
150+ from .resources .assets import AssetsResource
151+
152+ return AssetsResource (self )
153+
154+ @cached_property
155+ def with_raw_response (self ) -> BeeperDesktopWithRawResponse :
156+ return BeeperDesktopWithRawResponse (self )
157+
158+ @cached_property
159+ def with_streaming_response (self ) -> BeeperDesktopWithStreamedResponse :
160+ return BeeperDesktopWithStreamedResponse (self )
134161
135162 @property
136163 @override
@@ -330,13 +357,6 @@ def _make_status_error(
330357
331358
332359class AsyncBeeperDesktop (AsyncAPIClient ):
333- accounts : accounts .AsyncAccountsResource
334- chats : chats .AsyncChatsResource
335- messages : messages .AsyncMessagesResource
336- assets : assets .AsyncAssetsResource
337- with_raw_response : AsyncBeeperDesktopWithRawResponse
338- with_streaming_response : AsyncBeeperDesktopWithStreamedResponse
339-
340360 # client options
341361 access_token : str
342362
@@ -391,12 +411,41 @@ def __init__(
391411 _strict_response_validation = _strict_response_validation ,
392412 )
393413
394- self .accounts = accounts .AsyncAccountsResource (self )
395- self .chats = chats .AsyncChatsResource (self )
396- self .messages = messages .AsyncMessagesResource (self )
397- self .assets = assets .AsyncAssetsResource (self )
398- self .with_raw_response = AsyncBeeperDesktopWithRawResponse (self )
399- self .with_streaming_response = AsyncBeeperDesktopWithStreamedResponse (self )
414+ @cached_property
415+ def accounts (self ) -> AsyncAccountsResource :
416+ """Manage connected chat accounts"""
417+ from .resources .accounts import AsyncAccountsResource
418+
419+ return AsyncAccountsResource (self )
420+
421+ @cached_property
422+ def chats (self ) -> AsyncChatsResource :
423+ """Manage chats"""
424+ from .resources .chats import AsyncChatsResource
425+
426+ return AsyncChatsResource (self )
427+
428+ @cached_property
429+ def messages (self ) -> AsyncMessagesResource :
430+ """Manage messages in chats"""
431+ from .resources .messages import AsyncMessagesResource
432+
433+ return AsyncMessagesResource (self )
434+
435+ @cached_property
436+ def assets (self ) -> AsyncAssetsResource :
437+ """Manage assets in Beeper Desktop, like message attachments"""
438+ from .resources .assets import AsyncAssetsResource
439+
440+ return AsyncAssetsResource (self )
441+
442+ @cached_property
443+ def with_raw_response (self ) -> AsyncBeeperDesktopWithRawResponse :
444+ return AsyncBeeperDesktopWithRawResponse (self )
445+
446+ @cached_property
447+ def with_streaming_response (self ) -> AsyncBeeperDesktopWithStreamedResponse :
448+ return AsyncBeeperDesktopWithStreamedResponse (self )
400449
401450 @property
402451 @override
@@ -596,11 +645,10 @@ def _make_status_error(
596645
597646
598647class BeeperDesktopWithRawResponse :
648+ _client : BeeperDesktop
649+
599650 def __init__ (self , client : BeeperDesktop ) -> None :
600- self .accounts = accounts .AccountsResourceWithRawResponse (client .accounts )
601- self .chats = chats .ChatsResourceWithRawResponse (client .chats )
602- self .messages = messages .MessagesResourceWithRawResponse (client .messages )
603- self .assets = assets .AssetsResourceWithRawResponse (client .assets )
651+ self ._client = client
604652
605653 self .focus = to_raw_response_wrapper (
606654 client .focus ,
@@ -609,13 +657,40 @@ def __init__(self, client: BeeperDesktop) -> None:
609657 client .search ,
610658 )
611659
660+ @cached_property
661+ def accounts (self ) -> accounts .AccountsResourceWithRawResponse :
662+ """Manage connected chat accounts"""
663+ from .resources .accounts import AccountsResourceWithRawResponse
664+
665+ return AccountsResourceWithRawResponse (self ._client .accounts )
666+
667+ @cached_property
668+ def chats (self ) -> chats .ChatsResourceWithRawResponse :
669+ """Manage chats"""
670+ from .resources .chats import ChatsResourceWithRawResponse
671+
672+ return ChatsResourceWithRawResponse (self ._client .chats )
673+
674+ @cached_property
675+ def messages (self ) -> messages .MessagesResourceWithRawResponse :
676+ """Manage messages in chats"""
677+ from .resources .messages import MessagesResourceWithRawResponse
678+
679+ return MessagesResourceWithRawResponse (self ._client .messages )
680+
681+ @cached_property
682+ def assets (self ) -> assets .AssetsResourceWithRawResponse :
683+ """Manage assets in Beeper Desktop, like message attachments"""
684+ from .resources .assets import AssetsResourceWithRawResponse
685+
686+ return AssetsResourceWithRawResponse (self ._client .assets )
687+
612688
613689class AsyncBeeperDesktopWithRawResponse :
690+ _client : AsyncBeeperDesktop
691+
614692 def __init__ (self , client : AsyncBeeperDesktop ) -> None :
615- self .accounts = accounts .AsyncAccountsResourceWithRawResponse (client .accounts )
616- self .chats = chats .AsyncChatsResourceWithRawResponse (client .chats )
617- self .messages = messages .AsyncMessagesResourceWithRawResponse (client .messages )
618- self .assets = assets .AsyncAssetsResourceWithRawResponse (client .assets )
693+ self ._client = client
619694
620695 self .focus = async_to_raw_response_wrapper (
621696 client .focus ,
@@ -624,13 +699,40 @@ def __init__(self, client: AsyncBeeperDesktop) -> None:
624699 client .search ,
625700 )
626701
702+ @cached_property
703+ def accounts (self ) -> accounts .AsyncAccountsResourceWithRawResponse :
704+ """Manage connected chat accounts"""
705+ from .resources .accounts import AsyncAccountsResourceWithRawResponse
706+
707+ return AsyncAccountsResourceWithRawResponse (self ._client .accounts )
708+
709+ @cached_property
710+ def chats (self ) -> chats .AsyncChatsResourceWithRawResponse :
711+ """Manage chats"""
712+ from .resources .chats import AsyncChatsResourceWithRawResponse
713+
714+ return AsyncChatsResourceWithRawResponse (self ._client .chats )
715+
716+ @cached_property
717+ def messages (self ) -> messages .AsyncMessagesResourceWithRawResponse :
718+ """Manage messages in chats"""
719+ from .resources .messages import AsyncMessagesResourceWithRawResponse
720+
721+ return AsyncMessagesResourceWithRawResponse (self ._client .messages )
722+
723+ @cached_property
724+ def assets (self ) -> assets .AsyncAssetsResourceWithRawResponse :
725+ """Manage assets in Beeper Desktop, like message attachments"""
726+ from .resources .assets import AsyncAssetsResourceWithRawResponse
727+
728+ return AsyncAssetsResourceWithRawResponse (self ._client .assets )
729+
627730
628731class BeeperDesktopWithStreamedResponse :
732+ _client : BeeperDesktop
733+
629734 def __init__ (self , client : BeeperDesktop ) -> None :
630- self .accounts = accounts .AccountsResourceWithStreamingResponse (client .accounts )
631- self .chats = chats .ChatsResourceWithStreamingResponse (client .chats )
632- self .messages = messages .MessagesResourceWithStreamingResponse (client .messages )
633- self .assets = assets .AssetsResourceWithStreamingResponse (client .assets )
735+ self ._client = client
634736
635737 self .focus = to_streamed_response_wrapper (
636738 client .focus ,
@@ -639,13 +741,40 @@ def __init__(self, client: BeeperDesktop) -> None:
639741 client .search ,
640742 )
641743
744+ @cached_property
745+ def accounts (self ) -> accounts .AccountsResourceWithStreamingResponse :
746+ """Manage connected chat accounts"""
747+ from .resources .accounts import AccountsResourceWithStreamingResponse
748+
749+ return AccountsResourceWithStreamingResponse (self ._client .accounts )
750+
751+ @cached_property
752+ def chats (self ) -> chats .ChatsResourceWithStreamingResponse :
753+ """Manage chats"""
754+ from .resources .chats import ChatsResourceWithStreamingResponse
755+
756+ return ChatsResourceWithStreamingResponse (self ._client .chats )
757+
758+ @cached_property
759+ def messages (self ) -> messages .MessagesResourceWithStreamingResponse :
760+ """Manage messages in chats"""
761+ from .resources .messages import MessagesResourceWithStreamingResponse
762+
763+ return MessagesResourceWithStreamingResponse (self ._client .messages )
764+
765+ @cached_property
766+ def assets (self ) -> assets .AssetsResourceWithStreamingResponse :
767+ """Manage assets in Beeper Desktop, like message attachments"""
768+ from .resources .assets import AssetsResourceWithStreamingResponse
769+
770+ return AssetsResourceWithStreamingResponse (self ._client .assets )
771+
642772
643773class AsyncBeeperDesktopWithStreamedResponse :
774+ _client : AsyncBeeperDesktop
775+
644776 def __init__ (self , client : AsyncBeeperDesktop ) -> None :
645- self .accounts = accounts .AsyncAccountsResourceWithStreamingResponse (client .accounts )
646- self .chats = chats .AsyncChatsResourceWithStreamingResponse (client .chats )
647- self .messages = messages .AsyncMessagesResourceWithStreamingResponse (client .messages )
648- self .assets = assets .AsyncAssetsResourceWithStreamingResponse (client .assets )
777+ self ._client = client
649778
650779 self .focus = async_to_streamed_response_wrapper (
651780 client .focus ,
@@ -654,6 +783,34 @@ def __init__(self, client: AsyncBeeperDesktop) -> None:
654783 client .search ,
655784 )
656785
786+ @cached_property
787+ def accounts (self ) -> accounts .AsyncAccountsResourceWithStreamingResponse :
788+ """Manage connected chat accounts"""
789+ from .resources .accounts import AsyncAccountsResourceWithStreamingResponse
790+
791+ return AsyncAccountsResourceWithStreamingResponse (self ._client .accounts )
792+
793+ @cached_property
794+ def chats (self ) -> chats .AsyncChatsResourceWithStreamingResponse :
795+ """Manage chats"""
796+ from .resources .chats import AsyncChatsResourceWithStreamingResponse
797+
798+ return AsyncChatsResourceWithStreamingResponse (self ._client .chats )
799+
800+ @cached_property
801+ def messages (self ) -> messages .AsyncMessagesResourceWithStreamingResponse :
802+ """Manage messages in chats"""
803+ from .resources .messages import AsyncMessagesResourceWithStreamingResponse
804+
805+ return AsyncMessagesResourceWithStreamingResponse (self ._client .messages )
806+
807+ @cached_property
808+ def assets (self ) -> assets .AsyncAssetsResourceWithStreamingResponse :
809+ """Manage assets in Beeper Desktop, like message attachments"""
810+ from .resources .assets import AsyncAssetsResourceWithStreamingResponse
811+
812+ return AsyncAssetsResourceWithStreamingResponse (self ._client .assets )
813+
657814
658815Client = BeeperDesktop
659816
0 commit comments