-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpdp_api_client.py
More file actions
39 lines (28 loc) · 1.12 KB
/
pdp_api_client.py
File metadata and controls
39 lines (28 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from permit.utils.sync import SyncClass
from ..config import PermitConfig
from .role_assignments import RoleAssignmentsApi
class SyncRoleAssignmentsApi(RoleAssignmentsApi, metaclass=SyncClass):
pass
class PermitPdpApiClient:
def __init__(self, config: PermitConfig):
"""
Constructs a new instance of the PdpApiClient class with the specified SDK configuration.
Args:
config: The configuration for the Permit SDK.
"""
self._config = config
self._headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {self._config.token}",
}
self._base_url = self._config.pdp
self._role_assignments = RoleAssignmentsApi(config)
@property
def role_assignments(self) -> RoleAssignmentsApi:
return self._role_assignments
class SyncPDPApi(PermitPdpApiClient):
def __init__(self, config: PermitConfig):
self._role_assignments = SyncRoleAssignmentsApi(config)
@property
def role_assignments(self) -> SyncRoleAssignmentsApi:
return self._role_assignments # type: ignore[return-value]