|
2 | 2 | from typing import Callable, List, Optional, Tuple, Type |
3 | 3 |
|
4 | 4 | from .connection import Connection, MSGraphProtocol, Protocol |
5 | | -from .subscriptions import Subscriptions |
6 | 5 | from .utils import ME_RESOURCE, consent_input_token |
7 | 6 |
|
8 | 7 |
|
9 | | -class Account: |
10 | | - connection_constructor: Type = Connection #: :meta private: |
11 | | - subscriptions_constructor: Type = Subscriptions |
12 | | - |
13 | | - def __init__(self, credentials: Tuple[str, str], *, |
14 | | - username: Optional[str] = None, |
15 | | - protocol: Optional[Protocol] = None, |
16 | | - main_resource: Optional[str] = None, **kwargs): |
| 8 | +class Account: |
| 9 | + connection_constructor: Type = Connection #: :meta private: |
| 10 | + |
| 11 | + def __init__(self, credentials: Tuple[str, str], *, |
| 12 | + username: Optional[str] = None, |
| 13 | + protocol: Optional[Protocol] = None, |
| 14 | + main_resource: Optional[str] = None, **kwargs): |
17 | 15 | """ Creates an object which is used to access resources related to the specified credentials. |
18 | 16 |
|
19 | 17 | :param credentials: a tuple containing the client_id and client_secret |
@@ -62,7 +60,6 @@ def __init__(self, credentials: Tuple[str, str], *, |
62 | 60 | self.con = self.connection_constructor(credentials, **kwargs) |
63 | 61 | #: The resource in use for the account. |br| **Type:** str |
64 | 62 | self.main_resource: str = main_resource or self.protocol.default_resource |
65 | | - self.subscriptions = self.subscriptions_constructor(parent=self) |
66 | 63 |
|
67 | 64 | def __repr__(self): |
68 | 65 | if self.con.auth: |
@@ -369,3 +366,9 @@ def groups(self, *, resource: str = ''): |
369 | 366 |
|
370 | 367 | from .groups import Groups |
371 | 368 | return Groups(parent=self, main_resource=resource) |
| 369 | + |
| 370 | + def subscriptions(self, *, resource: str = ''): |
| 371 | + """ Get an instance to manage MS Graph subscriptions """ |
| 372 | + |
| 373 | + from .subscriptions import Subscriptions |
| 374 | + return Subscriptions(parent=self, main_resource=resource) |
0 commit comments