-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathcollaboration.py
More file actions
220 lines (191 loc) · 8.67 KB
/
collaboration.py
File metadata and controls
220 lines (191 loc) · 8.67 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
from enum import Enum
from typing import Optional
from box_sdk_gen.internal.base_object import BaseObject
from typing import Union
from box_sdk_gen.schemas.file import File
from box_sdk_gen.schemas.folder import Folder
from box_sdk_gen.schemas.web_link import WebLink
from box_sdk_gen.schemas.app_item import AppItem
from box_sdk_gen.schemas.user_collaborations import UserCollaborations
from box_sdk_gen.schemas.group_mini import GroupMini
from box_sdk_gen.schemas.terms_of_service_base import TermsOfServiceBase
from box_sdk_gen.box.errors import BoxSDKError
from box_sdk_gen.internal.utils import DateTime
class CollaborationTypeField(str, Enum):
COLLABORATION = 'collaboration'
class CollaborationRoleField(str, Enum):
EDITOR = 'editor'
VIEWER = 'viewer'
PREVIEWER = 'previewer'
UPLOADER = 'uploader'
PREVIEWER_UPLOADER = 'previewer uploader'
VIEWER_UPLOADER = 'viewer uploader'
CO_OWNER = 'co-owner'
OWNER = 'owner'
class CollaborationStatusField(str, Enum):
ACCEPTED = 'accepted'
PENDING = 'pending'
REJECTED = 'rejected'
class CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField(
BaseObject
):
def __init__(
self,
*,
is_accepted: Optional[bool] = None,
terms_of_service: Optional[TermsOfServiceBase] = None,
**kwargs
):
"""
:param is_accepted: Whether or not the terms of service have been accepted. The
field is `null` when there is no terms of service required., defaults to None
:type is_accepted: Optional[bool], optional
"""
super().__init__(**kwargs)
self.is_accepted = is_accepted
self.terms_of_service = terms_of_service
class CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField(
BaseObject
):
def __init__(
self,
*,
enterprise_has_strong_password_required_for_external_users: Optional[
bool
] = None,
user_has_strong_password: Optional[bool] = None,
**kwargs
):
"""
:param enterprise_has_strong_password_required_for_external_users: Whether or not the enterprise that owns the content requires
a strong password to collaborate on the content, or enforces
an exposed password detection for the external collaborators., defaults to None
:type enterprise_has_strong_password_required_for_external_users: Optional[bool], optional
:param user_has_strong_password: Whether or not the user has a strong and not exposed password set
for their account. The field is `null` when a strong password is
not required., defaults to None
:type user_has_strong_password: Optional[bool], optional
"""
super().__init__(**kwargs)
self.enterprise_has_strong_password_required_for_external_users = (
enterprise_has_strong_password_required_for_external_users
)
self.user_has_strong_password = user_has_strong_password
class CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField(
BaseObject
):
def __init__(
self,
*,
enterprise_has_two_factor_auth_enabled: Optional[bool] = None,
user_has_two_factor_authentication_enabled: Optional[bool] = None,
**kwargs
):
"""
:param enterprise_has_two_factor_auth_enabled: Whether or not the enterprise that owns the content requires
two-factor authentication to be enabled in order to
collaborate on the content., defaults to None
:type enterprise_has_two_factor_auth_enabled: Optional[bool], optional
:param user_has_two_factor_authentication_enabled: Whether or not the user has two-factor authentication
enabled. The field is `null` when two-factor
authentication is not required., defaults to None
:type user_has_two_factor_authentication_enabled: Optional[bool], optional
"""
super().__init__(**kwargs)
self.enterprise_has_two_factor_auth_enabled = (
enterprise_has_two_factor_auth_enabled
)
self.user_has_two_factor_authentication_enabled = (
user_has_two_factor_authentication_enabled
)
class CollaborationAcceptanceRequirementsStatusField(BaseObject):
def __init__(
self,
*,
terms_of_service_requirement: Optional[
CollaborationAcceptanceRequirementsStatusTermsOfServiceRequirementField
] = None,
strong_password_requirement: Optional[
CollaborationAcceptanceRequirementsStatusStrongPasswordRequirementField
] = None,
two_factor_authentication_requirement: Optional[
CollaborationAcceptanceRequirementsStatusTwoFactorAuthenticationRequirementField
] = None,
**kwargs
):
super().__init__(**kwargs)
self.terms_of_service_requirement = terms_of_service_requirement
self.strong_password_requirement = strong_password_requirement
self.two_factor_authentication_requirement = (
two_factor_authentication_requirement
)
class Collaboration(BaseObject):
_discriminator = 'type', {'collaboration'}
def __init__(
self,
id: str,
*,
type: CollaborationTypeField = CollaborationTypeField.COLLABORATION,
item: Optional[Union[File, Folder, WebLink]] = None,
app_item: Optional[AppItem] = None,
accessible_by: Optional[Union[UserCollaborations, GroupMini]] = None,
invite_email: Optional[str] = None,
role: Optional[CollaborationRoleField] = None,
expires_at: Optional[DateTime] = None,
is_access_only: Optional[bool] = None,
status: Optional[CollaborationStatusField] = None,
acknowledged_at: Optional[DateTime] = None,
created_by: Optional[UserCollaborations] = None,
created_at: Optional[DateTime] = None,
modified_at: Optional[DateTime] = None,
acceptance_requirements_status: Optional[
CollaborationAcceptanceRequirementsStatusField
] = None,
**kwargs
):
"""
:param id: The unique identifier for this collaboration.
:type id: str
:param type: The value will always be `collaboration`., defaults to CollaborationTypeField.COLLABORATION
:type type: CollaborationTypeField, optional
:param invite_email: The email address used to invite an unregistered collaborator, if
they are not a registered user., defaults to None
:type invite_email: Optional[str], optional
:param role: The level of access granted., defaults to None
:type role: Optional[CollaborationRoleField], optional
:param expires_at: When the collaboration will expire, or `null` if no expiration
date is set., defaults to None
:type expires_at: Optional[DateTime], optional
:param is_access_only: If set to `true`, collaborators have access to
shared items, but such items won't be visible in the
All Files list. Additionally, collaborators won't
see the the path to the root folder for the
shared item., defaults to None
:type is_access_only: Optional[bool], optional
:param status: The status of the collaboration invitation. If the status
is `pending`, `login` and `name` return an empty string., defaults to None
:type status: Optional[CollaborationStatusField], optional
:param acknowledged_at: When the `status` of the collaboration object changed to
`accepted` or `rejected`., defaults to None
:type acknowledged_at: Optional[DateTime], optional
:param created_at: When the collaboration object was created., defaults to None
:type created_at: Optional[DateTime], optional
:param modified_at: When the collaboration object was last modified., defaults to None
:type modified_at: Optional[DateTime], optional
"""
super().__init__(**kwargs)
self.id = id
self.type = type
self.item = item
self.app_item = app_item
self.accessible_by = accessible_by
self.invite_email = invite_email
self.role = role
self.expires_at = expires_at
self.is_access_only = is_access_only
self.status = status
self.acknowledged_at = acknowledged_at
self.created_by = created_by
self.created_at = created_at
self.modified_at = modified_at
self.acceptance_requirements_status = acceptance_requirements_status