-
Notifications
You must be signed in to change notification settings - Fork 317
/
users.py
1430 lines (1159 loc) · 47.3 KB
/
users.py
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
"""
This namespace contains endpoints and data types for user management.
"""
from __future__ import unicode_literals
from stone.backends.python_rsrc import stone_base as bb
from stone.backends.python_rsrc import stone_validators as bv
from dropbox import common
from dropbox import team_common
from dropbox import team_policies
from dropbox import users_common
class Account(bb.Struct):
"""
The amount of detail revealed about an account depends on the user being
queried and the user making the query.
:ivar users.Account.account_id: The user's unique Dropbox ID.
:ivar users.Account.name: Details of a user's name.
:ivar users.Account.email: The user's email address. Do not rely on this
without checking the ``email_verified`` field. Even then, it's possible
that the user has since lost access to their email.
:ivar users.Account.email_verified: Whether the user has verified their
email address.
:ivar users.Account.profile_photo_url: URL for the photo representing the
user, if one is set.
:ivar users.Account.disabled: Whether the user has been disabled.
"""
__slots__ = [
'_account_id_value',
'_name_value',
'_email_value',
'_email_verified_value',
'_profile_photo_url_value',
'_disabled_value',
]
_has_required_fields = True
def __init__(self,
account_id=None,
name=None,
email=None,
email_verified=None,
disabled=None,
profile_photo_url=None):
self._account_id_value = bb.NOT_SET
self._name_value = bb.NOT_SET
self._email_value = bb.NOT_SET
self._email_verified_value = bb.NOT_SET
self._profile_photo_url_value = bb.NOT_SET
self._disabled_value = bb.NOT_SET
if account_id is not None:
self.account_id = account_id
if name is not None:
self.name = name
if email is not None:
self.email = email
if email_verified is not None:
self.email_verified = email_verified
if profile_photo_url is not None:
self.profile_photo_url = profile_photo_url
if disabled is not None:
self.disabled = disabled
# Instance attribute type: str (validator is set below)
account_id = bb.Attribute("account_id")
# Instance attribute type: Name (validator is set below)
name = bb.Attribute("name", user_defined=True)
# Instance attribute type: str (validator is set below)
email = bb.Attribute("email")
# Instance attribute type: bool (validator is set below)
email_verified = bb.Attribute("email_verified")
# Instance attribute type: str (validator is set below)
profile_photo_url = bb.Attribute("profile_photo_url", nullable=True)
# Instance attribute type: bool (validator is set below)
disabled = bb.Attribute("disabled")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(Account, self)._process_custom_annotations(annotation_type, field_path, processor)
Account_validator = bv.Struct(Account)
class BasicAccount(Account):
"""
Basic information about any account.
:ivar users.BasicAccount.is_teammate: Whether this user is a teammate of the
current user. If this account is the current user's account, then this
will be ``True``.
:ivar users.BasicAccount.team_member_id: The user's unique team member id.
This field will only be present if the user is part of a team and
``is_teammate`` is ``True``.
"""
__slots__ = [
'_is_teammate_value',
'_team_member_id_value',
]
_has_required_fields = True
def __init__(self,
account_id=None,
name=None,
email=None,
email_verified=None,
disabled=None,
is_teammate=None,
profile_photo_url=None,
team_member_id=None):
super(BasicAccount, self).__init__(account_id,
name,
email,
email_verified,
disabled,
profile_photo_url)
self._is_teammate_value = bb.NOT_SET
self._team_member_id_value = bb.NOT_SET
if is_teammate is not None:
self.is_teammate = is_teammate
if team_member_id is not None:
self.team_member_id = team_member_id
# Instance attribute type: bool (validator is set below)
is_teammate = bb.Attribute("is_teammate")
# Instance attribute type: str (validator is set below)
team_member_id = bb.Attribute("team_member_id", nullable=True)
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(BasicAccount, self)._process_custom_annotations(annotation_type, field_path, processor)
BasicAccount_validator = bv.Struct(BasicAccount)
class FileLockingValue(bb.Union):
"""
The value for ``UserFeature.file_locking``.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar bool users.FileLockingValue.enabled: When this value is True, the user
can lock files in shared directories. When the value is False the user
can unlock the files they have locked or request to unlock files locked
by others.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
other = None
@classmethod
def enabled(cls, val):
"""
Create an instance of this class set to the ``enabled`` tag with value
``val``.
:param bool val:
:rtype: FileLockingValue
"""
return cls('enabled', val)
def is_enabled(self):
"""
Check if the union tag is ``enabled``.
:rtype: bool
"""
return self._tag == 'enabled'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def get_enabled(self):
"""
When this value is True, the user can lock files in shared directories.
When the value is False the user can unlock the files they have locked
or request to unlock files locked by others.
Only call this if :meth:`is_enabled` is true.
:rtype: bool
"""
if not self.is_enabled():
raise AttributeError("tag 'enabled' not set")
return self._value
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(FileLockingValue, self)._process_custom_annotations(annotation_type, field_path, processor)
FileLockingValue_validator = bv.Union(FileLockingValue)
class FullAccount(Account):
"""
Detailed information about the current user's account.
:ivar users.FullAccount.country: The user's two-letter country code, if
available. Country codes are based on `ISO 3166-1
<http://en.wikipedia.org/wiki/ISO_3166-1>`_.
:ivar users.FullAccount.locale: The language that the user specified. Locale
tags will be `IETF language tags
<http://en.wikipedia.org/wiki/IETF_language_tag>`_.
:ivar users.FullAccount.referral_link: The user's `referral link
<https://www.dropbox.com/referrals>`_.
:ivar users.FullAccount.team: If this account is a member of a team,
information about that team.
:ivar users.FullAccount.team_member_id: This account's unique team member
id. This field will only be present if ``team`` is present.
:ivar users.FullAccount.is_paired: Whether the user has a personal and work
account. If the current account is personal, then ``team`` will always
be None, but ``is_paired`` will indicate if a work account is linked.
:ivar users.FullAccount.account_type: What type of account this user has.
:ivar users.FullAccount.root_info: The root info for this account.
"""
__slots__ = [
'_country_value',
'_locale_value',
'_referral_link_value',
'_team_value',
'_team_member_id_value',
'_is_paired_value',
'_account_type_value',
'_root_info_value',
]
_has_required_fields = True
def __init__(self,
account_id=None,
name=None,
email=None,
email_verified=None,
disabled=None,
locale=None,
referral_link=None,
is_paired=None,
account_type=None,
root_info=None,
profile_photo_url=None,
country=None,
team=None,
team_member_id=None):
super(FullAccount, self).__init__(account_id,
name,
email,
email_verified,
disabled,
profile_photo_url)
self._country_value = bb.NOT_SET
self._locale_value = bb.NOT_SET
self._referral_link_value = bb.NOT_SET
self._team_value = bb.NOT_SET
self._team_member_id_value = bb.NOT_SET
self._is_paired_value = bb.NOT_SET
self._account_type_value = bb.NOT_SET
self._root_info_value = bb.NOT_SET
if country is not None:
self.country = country
if locale is not None:
self.locale = locale
if referral_link is not None:
self.referral_link = referral_link
if team is not None:
self.team = team
if team_member_id is not None:
self.team_member_id = team_member_id
if is_paired is not None:
self.is_paired = is_paired
if account_type is not None:
self.account_type = account_type
if root_info is not None:
self.root_info = root_info
# Instance attribute type: str (validator is set below)
country = bb.Attribute("country", nullable=True)
# Instance attribute type: str (validator is set below)
locale = bb.Attribute("locale")
# Instance attribute type: str (validator is set below)
referral_link = bb.Attribute("referral_link")
# Instance attribute type: FullTeam (validator is set below)
team = bb.Attribute("team", nullable=True, user_defined=True)
# Instance attribute type: str (validator is set below)
team_member_id = bb.Attribute("team_member_id", nullable=True)
# Instance attribute type: bool (validator is set below)
is_paired = bb.Attribute("is_paired")
# Instance attribute type: users_common.AccountType (validator is set below)
account_type = bb.Attribute("account_type", user_defined=True)
# Instance attribute type: common.RootInfo (validator is set below)
root_info = bb.Attribute("root_info", user_defined=True)
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(FullAccount, self)._process_custom_annotations(annotation_type, field_path, processor)
FullAccount_validator = bv.Struct(FullAccount)
class Team(bb.Struct):
"""
Information about a team.
:ivar users.Team.id: The team's unique ID.
:ivar users.Team.name: The name of the team.
"""
__slots__ = [
'_id_value',
'_name_value',
]
_has_required_fields = True
def __init__(self,
id=None,
name=None):
self._id_value = bb.NOT_SET
self._name_value = bb.NOT_SET
if id is not None:
self.id = id
if name is not None:
self.name = name
# Instance attribute type: str (validator is set below)
id = bb.Attribute("id")
# Instance attribute type: str (validator is set below)
name = bb.Attribute("name")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(Team, self)._process_custom_annotations(annotation_type, field_path, processor)
Team_validator = bv.Struct(Team)
class FullTeam(Team):
"""
Detailed information about a team.
:ivar users.FullTeam.sharing_policies: Team policies governing sharing.
:ivar users.FullTeam.office_addin_policy: Team policy governing the use of
the Office Add-In.
"""
__slots__ = [
'_sharing_policies_value',
'_office_addin_policy_value',
]
_has_required_fields = True
def __init__(self,
id=None,
name=None,
sharing_policies=None,
office_addin_policy=None):
super(FullTeam, self).__init__(id,
name)
self._sharing_policies_value = bb.NOT_SET
self._office_addin_policy_value = bb.NOT_SET
if sharing_policies is not None:
self.sharing_policies = sharing_policies
if office_addin_policy is not None:
self.office_addin_policy = office_addin_policy
# Instance attribute type: team_policies.TeamSharingPolicies (validator is set below)
sharing_policies = bb.Attribute("sharing_policies", user_defined=True)
# Instance attribute type: team_policies.OfficeAddInPolicy (validator is set below)
office_addin_policy = bb.Attribute("office_addin_policy", user_defined=True)
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(FullTeam, self)._process_custom_annotations(annotation_type, field_path, processor)
FullTeam_validator = bv.Struct(FullTeam)
class GetAccountArg(bb.Struct):
"""
:ivar users.GetAccountArg.account_id: A user's account identifier.
"""
__slots__ = [
'_account_id_value',
]
_has_required_fields = True
def __init__(self,
account_id=None):
self._account_id_value = bb.NOT_SET
if account_id is not None:
self.account_id = account_id
# Instance attribute type: str (validator is set below)
account_id = bb.Attribute("account_id")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(GetAccountArg, self)._process_custom_annotations(annotation_type, field_path, processor)
GetAccountArg_validator = bv.Struct(GetAccountArg)
class GetAccountBatchArg(bb.Struct):
"""
:ivar users.GetAccountBatchArg.account_ids: List of user account
identifiers. Should not contain any duplicate account IDs.
"""
__slots__ = [
'_account_ids_value',
]
_has_required_fields = True
def __init__(self,
account_ids=None):
self._account_ids_value = bb.NOT_SET
if account_ids is not None:
self.account_ids = account_ids
# Instance attribute type: list of [str] (validator is set below)
account_ids = bb.Attribute("account_ids")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(GetAccountBatchArg, self)._process_custom_annotations(annotation_type, field_path, processor)
GetAccountBatchArg_validator = bv.Struct(GetAccountBatchArg)
class GetAccountBatchError(bb.Union):
"""
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar str users.GetAccountBatchError.no_account: The value is an account ID
specified in :field:`GetAccountBatchArg.account_ids` that does not
exist.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
other = None
@classmethod
def no_account(cls, val):
"""
Create an instance of this class set to the ``no_account`` tag with
value ``val``.
:param str val:
:rtype: GetAccountBatchError
"""
return cls('no_account', val)
def is_no_account(self):
"""
Check if the union tag is ``no_account``.
:rtype: bool
"""
return self._tag == 'no_account'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def get_no_account(self):
"""
The value is an account ID specified in
``GetAccountBatchArg.account_ids`` that does not exist.
Only call this if :meth:`is_no_account` is true.
:rtype: str
"""
if not self.is_no_account():
raise AttributeError("tag 'no_account' not set")
return self._value
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(GetAccountBatchError, self)._process_custom_annotations(annotation_type, field_path, processor)
GetAccountBatchError_validator = bv.Union(GetAccountBatchError)
class GetAccountError(bb.Union):
"""
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar users.GetAccountError.no_account: The specified
``GetAccountArg.account_id`` does not exist.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
no_account = None
# Attribute is overwritten below the class definition
other = None
def is_no_account(self):
"""
Check if the union tag is ``no_account``.
:rtype: bool
"""
return self._tag == 'no_account'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(GetAccountError, self)._process_custom_annotations(annotation_type, field_path, processor)
GetAccountError_validator = bv.Union(GetAccountError)
class IndividualSpaceAllocation(bb.Struct):
"""
:ivar users.IndividualSpaceAllocation.allocated: The total space allocated
to the user's account (bytes).
"""
__slots__ = [
'_allocated_value',
]
_has_required_fields = True
def __init__(self,
allocated=None):
self._allocated_value = bb.NOT_SET
if allocated is not None:
self.allocated = allocated
# Instance attribute type: int (validator is set below)
allocated = bb.Attribute("allocated")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(IndividualSpaceAllocation, self)._process_custom_annotations(annotation_type, field_path, processor)
IndividualSpaceAllocation_validator = bv.Struct(IndividualSpaceAllocation)
class Name(bb.Struct):
"""
Representations for a person's name to assist with internationalization.
:ivar users.Name.given_name: Also known as a first name.
:ivar users.Name.surname: Also known as a last name or family name.
:ivar users.Name.familiar_name: Locale-dependent name. In the US, a person's
familiar name is their ``given_name``, but elsewhere, it could be any
combination of a person's ``given_name`` and ``surname``.
:ivar users.Name.display_name: A name that can be used directly to represent
the name of a user's Dropbox account.
:ivar users.Name.abbreviated_name: An abbreviated form of the person's name.
Their initials in most locales.
"""
__slots__ = [
'_given_name_value',
'_surname_value',
'_familiar_name_value',
'_display_name_value',
'_abbreviated_name_value',
]
_has_required_fields = True
def __init__(self,
given_name=None,
surname=None,
familiar_name=None,
display_name=None,
abbreviated_name=None):
self._given_name_value = bb.NOT_SET
self._surname_value = bb.NOT_SET
self._familiar_name_value = bb.NOT_SET
self._display_name_value = bb.NOT_SET
self._abbreviated_name_value = bb.NOT_SET
if given_name is not None:
self.given_name = given_name
if surname is not None:
self.surname = surname
if familiar_name is not None:
self.familiar_name = familiar_name
if display_name is not None:
self.display_name = display_name
if abbreviated_name is not None:
self.abbreviated_name = abbreviated_name
# Instance attribute type: str (validator is set below)
given_name = bb.Attribute("given_name")
# Instance attribute type: str (validator is set below)
surname = bb.Attribute("surname")
# Instance attribute type: str (validator is set below)
familiar_name = bb.Attribute("familiar_name")
# Instance attribute type: str (validator is set below)
display_name = bb.Attribute("display_name")
# Instance attribute type: str (validator is set below)
abbreviated_name = bb.Attribute("abbreviated_name")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(Name, self)._process_custom_annotations(annotation_type, field_path, processor)
Name_validator = bv.Struct(Name)
class PaperAsFilesValue(bb.Union):
"""
The value for ``UserFeature.paper_as_files``.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar bool users.PaperAsFilesValue.enabled: When this value is true, the
user's Paper docs are accessible in Dropbox with the .paper extension
and must be accessed via the /files endpoints. When this value is
false, the user's Paper docs are stored separate from Dropbox files and
folders and should be accessed via the /paper endpoints.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
other = None
@classmethod
def enabled(cls, val):
"""
Create an instance of this class set to the ``enabled`` tag with value
``val``.
:param bool val:
:rtype: PaperAsFilesValue
"""
return cls('enabled', val)
def is_enabled(self):
"""
Check if the union tag is ``enabled``.
:rtype: bool
"""
return self._tag == 'enabled'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def get_enabled(self):
"""
When this value is true, the user's Paper docs are accessible in Dropbox
with the .paper extension and must be accessed via the /files endpoints.
When this value is false, the user's Paper docs are stored separate from
Dropbox files and folders and should be accessed via the /paper
endpoints.
Only call this if :meth:`is_enabled` is true.
:rtype: bool
"""
if not self.is_enabled():
raise AttributeError("tag 'enabled' not set")
return self._value
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(PaperAsFilesValue, self)._process_custom_annotations(annotation_type, field_path, processor)
PaperAsFilesValue_validator = bv.Union(PaperAsFilesValue)
class SpaceAllocation(bb.Union):
"""
Space is allocated differently based on the type of account.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar IndividualSpaceAllocation SpaceAllocation.individual: The user's space
allocation applies only to their individual account.
:ivar TeamSpaceAllocation SpaceAllocation.team: The user shares space with
other members of their team.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
other = None
@classmethod
def individual(cls, val):
"""
Create an instance of this class set to the ``individual`` tag with
value ``val``.
:param IndividualSpaceAllocation val:
:rtype: SpaceAllocation
"""
return cls('individual', val)
@classmethod
def team(cls, val):
"""
Create an instance of this class set to the ``team`` tag with value
``val``.
:param TeamSpaceAllocation val:
:rtype: SpaceAllocation
"""
return cls('team', val)
def is_individual(self):
"""
Check if the union tag is ``individual``.
:rtype: bool
"""
return self._tag == 'individual'
def is_team(self):
"""
Check if the union tag is ``team``.
:rtype: bool
"""
return self._tag == 'team'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def get_individual(self):
"""
The user's space allocation applies only to their individual account.
Only call this if :meth:`is_individual` is true.
:rtype: IndividualSpaceAllocation
"""
if not self.is_individual():
raise AttributeError("tag 'individual' not set")
return self._value
def get_team(self):
"""
The user shares space with other members of their team.
Only call this if :meth:`is_team` is true.
:rtype: TeamSpaceAllocation
"""
if not self.is_team():
raise AttributeError("tag 'team' not set")
return self._value
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(SpaceAllocation, self)._process_custom_annotations(annotation_type, field_path, processor)
SpaceAllocation_validator = bv.Union(SpaceAllocation)
class SpaceUsage(bb.Struct):
"""
Information about a user's space usage and quota.
:ivar users.SpaceUsage.used: The user's total space usage (bytes).
:ivar users.SpaceUsage.allocation: The user's space allocation.
"""
__slots__ = [
'_used_value',
'_allocation_value',
]
_has_required_fields = True
def __init__(self,
used=None,
allocation=None):
self._used_value = bb.NOT_SET
self._allocation_value = bb.NOT_SET
if used is not None:
self.used = used
if allocation is not None:
self.allocation = allocation
# Instance attribute type: int (validator is set below)
used = bb.Attribute("used")
# Instance attribute type: SpaceAllocation (validator is set below)
allocation = bb.Attribute("allocation", user_defined=True)
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(SpaceUsage, self)._process_custom_annotations(annotation_type, field_path, processor)
SpaceUsage_validator = bv.Struct(SpaceUsage)
class TeamSpaceAllocation(bb.Struct):
"""
:ivar users.TeamSpaceAllocation.used: The total space currently used by the
user's team (bytes).
:ivar users.TeamSpaceAllocation.allocated: The total space allocated to the
user's team (bytes).
:ivar users.TeamSpaceAllocation.user_within_team_space_allocated: The total
space allocated to the user within its team allocated space (0 means
that no restriction is imposed on the user's quota within its team).
:ivar users.TeamSpaceAllocation.user_within_team_space_limit_type: The type
of the space limit imposed on the team member (off, alert_only,
stop_sync).
:ivar users.TeamSpaceAllocation.user_within_team_space_used_cached: An
accurate cached calculation of a team member's total space usage
(bytes).
"""
__slots__ = [
'_used_value',
'_allocated_value',
'_user_within_team_space_allocated_value',
'_user_within_team_space_limit_type_value',
'_user_within_team_space_used_cached_value',
]
_has_required_fields = True
def __init__(self,
used=None,
allocated=None,
user_within_team_space_allocated=None,
user_within_team_space_limit_type=None,
user_within_team_space_used_cached=None):
self._used_value = bb.NOT_SET
self._allocated_value = bb.NOT_SET
self._user_within_team_space_allocated_value = bb.NOT_SET
self._user_within_team_space_limit_type_value = bb.NOT_SET
self._user_within_team_space_used_cached_value = bb.NOT_SET
if used is not None:
self.used = used
if allocated is not None:
self.allocated = allocated
if user_within_team_space_allocated is not None:
self.user_within_team_space_allocated = user_within_team_space_allocated
if user_within_team_space_limit_type is not None:
self.user_within_team_space_limit_type = user_within_team_space_limit_type
if user_within_team_space_used_cached is not None:
self.user_within_team_space_used_cached = user_within_team_space_used_cached
# Instance attribute type: int (validator is set below)
used = bb.Attribute("used")
# Instance attribute type: int (validator is set below)
allocated = bb.Attribute("allocated")
# Instance attribute type: int (validator is set below)
user_within_team_space_allocated = bb.Attribute("user_within_team_space_allocated")
# Instance attribute type: team_common.MemberSpaceLimitType (validator is set below)
user_within_team_space_limit_type = bb.Attribute("user_within_team_space_limit_type", user_defined=True)
# Instance attribute type: int (validator is set below)
user_within_team_space_used_cached = bb.Attribute("user_within_team_space_used_cached")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(TeamSpaceAllocation, self)._process_custom_annotations(annotation_type, field_path, processor)
TeamSpaceAllocation_validator = bv.Struct(TeamSpaceAllocation)
class UserFeature(bb.Union):
"""
A set of features that a Dropbox User account may have configured.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar users.UserFeature.paper_as_files: This feature contains information
about how the user's Paper files are stored.
:ivar users.UserFeature.file_locking: This feature allows users to lock
files in order to restrict other users from editing them.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
paper_as_files = None
# Attribute is overwritten below the class definition
file_locking = None
# Attribute is overwritten below the class definition
other = None
def is_paper_as_files(self):
"""
Check if the union tag is ``paper_as_files``.
:rtype: bool
"""
return self._tag == 'paper_as_files'
def is_file_locking(self):
"""
Check if the union tag is ``file_locking``.
:rtype: bool
"""
return self._tag == 'file_locking'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(UserFeature, self)._process_custom_annotations(annotation_type, field_path, processor)
UserFeature_validator = bv.Union(UserFeature)
class UserFeatureValue(bb.Union):
"""
Values that correspond to entries in :class:`UserFeature`.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
other = None
@classmethod
def paper_as_files(cls, val):
"""
Create an instance of this class set to the ``paper_as_files`` tag with
value ``val``.
:param PaperAsFilesValue val:
:rtype: UserFeatureValue
"""
return cls('paper_as_files', val)
@classmethod
def file_locking(cls, val):
"""
Create an instance of this class set to the ``file_locking`` tag with
value ``val``.
:param FileLockingValue val:
:rtype: UserFeatureValue
"""
return cls('file_locking', val)
def is_paper_as_files(self):
"""
Check if the union tag is ``paper_as_files``.
:rtype: bool
"""
return self._tag == 'paper_as_files'
def is_file_locking(self):