-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaccess_codes_unmanaged.py
More file actions
120 lines (98 loc) · 3.96 KB
/
access_codes_unmanaged.py
File metadata and controls
120 lines (98 loc) · 3.96 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
from typing import Optional, Any, List, Dict, Union
from ..client import SeamHttpClient
from .models import AbstractAccessCodesUnmanaged, UnmanagedAccessCode
class AccessCodesUnmanaged(AbstractAccessCodesUnmanaged):
def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]):
self.client = client
self.defaults = defaults
def convert_to_managed(
self,
*,
access_code_id: str,
allow_external_modification: Optional[bool] = None,
force: Optional[bool] = None,
is_external_modification_allowed: Optional[bool] = None
) -> None:
json_payload = {}
if access_code_id is not None:
json_payload["access_code_id"] = access_code_id
if allow_external_modification is not None:
json_payload["allow_external_modification"] = allow_external_modification
if force is not None:
json_payload["force"] = force
if is_external_modification_allowed is not None:
json_payload["is_external_modification_allowed"] = (
is_external_modification_allowed
)
self.client.post(
"/access_codes/unmanaged/convert_to_managed", json=json_payload
)
return None
def delete(self, *, access_code_id: str) -> None:
json_payload = {}
if access_code_id is not None:
json_payload["access_code_id"] = access_code_id
self.client.post("/access_codes/unmanaged/delete", json=json_payload)
return None
def get(
self,
*,
access_code_id: Optional[str] = None,
code: Optional[str] = None,
device_id: Optional[str] = None
) -> UnmanagedAccessCode:
json_payload = {}
if access_code_id is not None:
json_payload["access_code_id"] = access_code_id
if code is not None:
json_payload["code"] = code
if device_id is not None:
json_payload["device_id"] = device_id
res = self.client.post("/access_codes/unmanaged/get", json=json_payload)
return UnmanagedAccessCode.from_dict(res["access_code"])
def list(
self,
*,
device_id: str,
limit: Optional[float] = None,
page_cursor: Optional[str] = None,
search: Optional[str] = None,
user_identifier_key: Optional[str] = None
) -> List[UnmanagedAccessCode]:
json_payload = {}
if device_id is not None:
json_payload["device_id"] = device_id
if limit is not None:
json_payload["limit"] = limit
if page_cursor is not None:
json_payload["page_cursor"] = page_cursor
if search is not None:
json_payload["search"] = search
if user_identifier_key is not None:
json_payload["user_identifier_key"] = user_identifier_key
res = self.client.post("/access_codes/unmanaged/list", json=json_payload)
return [UnmanagedAccessCode.from_dict(item) for item in res["access_codes"]]
def update(
self,
*,
access_code_id: str,
is_managed: bool,
allow_external_modification: Optional[bool] = None,
force: Optional[bool] = None,
is_external_modification_allowed: Optional[bool] = None
) -> None:
json_payload = {}
if access_code_id is not None:
json_payload["access_code_id"] = access_code_id
if is_managed is not None:
json_payload["is_managed"] = is_managed
if allow_external_modification is not None:
json_payload["allow_external_modification"] = allow_external_modification
if force is not None:
json_payload["force"] = force
if is_external_modification_allowed is not None:
json_payload["is_external_modification_allowed"] = (
is_external_modification_allowed
)
self.client.post("/access_codes/unmanaged/update", json=json_payload)
return None