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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430
|
# -*- 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):
"""
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 get_paper_as_files(self):
"""
Only call this if :meth:`is_paper_as_files` is true.
:rtype: PaperAsFilesValue
"""
if not self.is_paper_as_files():
raise AttributeError("tag 'paper_as_files' not set")
return self._value
def get_file_locking(self):
"""
Only call this if :meth:`is_file_locking` is true.
:rtype: FileLockingValue
"""
if not self.is_file_locking():
raise AttributeError("tag 'file_locking' not set")
return self._value
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(UserFeatureValue, self)._process_custom_annotations(annotation_type, field_path, processor)
UserFeatureValue_validator = bv.Union(UserFeatureValue)
class UserFeaturesGetValuesBatchArg(bb.Struct):
"""
:ivar users.UserFeaturesGetValuesBatchArg.features: A list of features in
:class:`UserFeature`. If the list is empty, this route will return
:class:`UserFeaturesGetValuesBatchError`.
"""
__slots__ = [
'_features_value',
]
_has_required_fields = True
def __init__(self,
features=None):
self._features_value = bb.NOT_SET
if features is not None:
self.features = features
# Instance attribute type: list of [UserFeature] (validator is set below)
features = bb.Attribute("features")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(UserFeaturesGetValuesBatchArg, self)._process_custom_annotations(annotation_type, field_path, processor)
UserFeaturesGetValuesBatchArg_validator = bv.Struct(UserFeaturesGetValuesBatchArg)
class UserFeaturesGetValuesBatchError(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.UserFeaturesGetValuesBatchError.empty_features_list: At least
one :class:`UserFeature` must be included in the
:class:`UserFeaturesGetValuesBatchArg`.features list.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
empty_features_list = None
# Attribute is overwritten below the class definition
other = None
def is_empty_features_list(self):
"""
Check if the union tag is ``empty_features_list``.
:rtype: bool
"""
return self._tag == 'empty_features_list'
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(UserFeaturesGetValuesBatchError, self)._process_custom_annotations(annotation_type, field_path, processor)
UserFeaturesGetValuesBatchError_validator = bv.Union(UserFeaturesGetValuesBatchError)
class UserFeaturesGetValuesBatchResult(bb.Struct):
__slots__ = [
'_values_value',
]
_has_required_fields = True
def __init__(self,
values=None):
self._values_value = bb.NOT_SET
if values is not None:
self.values = values
# Instance attribute type: list of [UserFeatureValue] (validator is set below)
values = bb.Attribute("values")
def _process_custom_annotations(self, annotation_type, field_path, processor):
super(UserFeaturesGetValuesBatchResult, self)._process_custom_annotations(annotation_type, field_path, processor)
UserFeaturesGetValuesBatchResult_validator = bv.Struct(UserFeaturesGetValuesBatchResult)
GetAccountBatchResult_validator = bv.List(BasicAccount_validator)
Account.account_id.validator = users_common.AccountId_validator
Account.name.validator = Name_validator
Account.email.validator = bv.String()
Account.email_verified.validator = bv.Boolean()
Account.profile_photo_url.validator = bv.Nullable(bv.String())
Account.disabled.validator = bv.Boolean()
Account._all_field_names_ = set([
'account_id',
'name',
'email',
'email_verified',
'profile_photo_url',
'disabled',
])
Account._all_fields_ = [
('account_id', Account.account_id.validator),
('name', Account.name.validator),
('email', Account.email.validator),
('email_verified', Account.email_verified.validator),
('profile_photo_url', Account.profile_photo_url.validator),
('disabled', Account.disabled.validator),
]
BasicAccount.is_teammate.validator = bv.Boolean()
BasicAccount.team_member_id.validator = bv.Nullable(bv.String())
BasicAccount._all_field_names_ = Account._all_field_names_.union(set([
'is_teammate',
'team_member_id',
]))
BasicAccount._all_fields_ = Account._all_fields_ + [
('is_teammate', BasicAccount.is_teammate.validator),
('team_member_id', BasicAccount.team_member_id.validator),
]
FileLockingValue._enabled_validator = bv.Boolean()
FileLockingValue._other_validator = bv.Void()
FileLockingValue._tagmap = {
'enabled': FileLockingValue._enabled_validator,
'other': FileLockingValue._other_validator,
}
FileLockingValue.other = FileLockingValue('other')
FullAccount.country.validator = bv.Nullable(bv.String(min_length=2, max_length=2))
FullAccount.locale.validator = bv.String(min_length=2)
FullAccount.referral_link.validator = bv.String()
FullAccount.team.validator = bv.Nullable(FullTeam_validator)
FullAccount.team_member_id.validator = bv.Nullable(bv.String())
FullAccount.is_paired.validator = bv.Boolean()
FullAccount.account_type.validator = users_common.AccountType_validator
FullAccount.root_info.validator = common.RootInfo_validator
FullAccount._all_field_names_ = Account._all_field_names_.union(set([
'country',
'locale',
'referral_link',
'team',
'team_member_id',
'is_paired',
'account_type',
'root_info',
]))
FullAccount._all_fields_ = Account._all_fields_ + [
('country', FullAccount.country.validator),
('locale', FullAccount.locale.validator),
('referral_link', FullAccount.referral_link.validator),
('team', FullAccount.team.validator),
('team_member_id', FullAccount.team_member_id.validator),
('is_paired', FullAccount.is_paired.validator),
('account_type', FullAccount.account_type.validator),
('root_info', FullAccount.root_info.validator),
]
Team.id.validator = bv.String()
Team.name.validator = bv.String()
Team._all_field_names_ = set([
'id',
'name',
])
Team._all_fields_ = [
('id', Team.id.validator),
('name', Team.name.validator),
]
FullTeam.sharing_policies.validator = team_policies.TeamSharingPolicies_validator
FullTeam.office_addin_policy.validator = team_policies.OfficeAddInPolicy_validator
FullTeam._all_field_names_ = Team._all_field_names_.union(set([
'sharing_policies',
'office_addin_policy',
]))
FullTeam._all_fields_ = Team._all_fields_ + [
('sharing_policies', FullTeam.sharing_policies.validator),
('office_addin_policy', FullTeam.office_addin_policy.validator),
]
GetAccountArg.account_id.validator = users_common.AccountId_validator
GetAccountArg._all_field_names_ = set(['account_id'])
GetAccountArg._all_fields_ = [('account_id', GetAccountArg.account_id.validator)]
GetAccountBatchArg.account_ids.validator = bv.List(users_common.AccountId_validator, min_items=1)
GetAccountBatchArg._all_field_names_ = set(['account_ids'])
GetAccountBatchArg._all_fields_ = [('account_ids', GetAccountBatchArg.account_ids.validator)]
GetAccountBatchError._no_account_validator = users_common.AccountId_validator
GetAccountBatchError._other_validator = bv.Void()
GetAccountBatchError._tagmap = {
'no_account': GetAccountBatchError._no_account_validator,
'other': GetAccountBatchError._other_validator,
}
GetAccountBatchError.other = GetAccountBatchError('other')
GetAccountError._no_account_validator = bv.Void()
GetAccountError._other_validator = bv.Void()
GetAccountError._tagmap = {
'no_account': GetAccountError._no_account_validator,
'other': GetAccountError._other_validator,
}
GetAccountError.no_account = GetAccountError('no_account')
GetAccountError.other = GetAccountError('other')
IndividualSpaceAllocation.allocated.validator = bv.UInt64()
IndividualSpaceAllocation._all_field_names_ = set(['allocated'])
IndividualSpaceAllocation._all_fields_ = [('allocated', IndividualSpaceAllocation.allocated.validator)]
Name.given_name.validator = bv.String()
Name.surname.validator = bv.String()
Name.familiar_name.validator = bv.String()
Name.display_name.validator = bv.String()
Name.abbreviated_name.validator = bv.String()
Name._all_field_names_ = set([
'given_name',
'surname',
'familiar_name',
'display_name',
'abbreviated_name',
])
Name._all_fields_ = [
('given_name', Name.given_name.validator),
('surname', Name.surname.validator),
('familiar_name', Name.familiar_name.validator),
('display_name', Name.display_name.validator),
('abbreviated_name', Name.abbreviated_name.validator),
]
PaperAsFilesValue._enabled_validator = bv.Boolean()
PaperAsFilesValue._other_validator = bv.Void()
PaperAsFilesValue._tagmap = {
'enabled': PaperAsFilesValue._enabled_validator,
'other': PaperAsFilesValue._other_validator,
}
PaperAsFilesValue.other = PaperAsFilesValue('other')
SpaceAllocation._individual_validator = IndividualSpaceAllocation_validator
SpaceAllocation._team_validator = TeamSpaceAllocation_validator
SpaceAllocation._other_validator = bv.Void()
SpaceAllocation._tagmap = {
'individual': SpaceAllocation._individual_validator,
'team': SpaceAllocation._team_validator,
'other': SpaceAllocation._other_validator,
}
SpaceAllocation.other = SpaceAllocation('other')
SpaceUsage.used.validator = bv.UInt64()
SpaceUsage.allocation.validator = SpaceAllocation_validator
SpaceUsage._all_field_names_ = set([
'used',
'allocation',
])
SpaceUsage._all_fields_ = [
('used', SpaceUsage.used.validator),
('allocation', SpaceUsage.allocation.validator),
]
TeamSpaceAllocation.used.validator = bv.UInt64()
TeamSpaceAllocation.allocated.validator = bv.UInt64()
TeamSpaceAllocation.user_within_team_space_allocated.validator = bv.UInt64()
TeamSpaceAllocation.user_within_team_space_limit_type.validator = team_common.MemberSpaceLimitType_validator
TeamSpaceAllocation.user_within_team_space_used_cached.validator = bv.UInt64()
TeamSpaceAllocation._all_field_names_ = set([
'used',
'allocated',
'user_within_team_space_allocated',
'user_within_team_space_limit_type',
'user_within_team_space_used_cached',
])
TeamSpaceAllocation._all_fields_ = [
('used', TeamSpaceAllocation.used.validator),
('allocated', TeamSpaceAllocation.allocated.validator),
('user_within_team_space_allocated', TeamSpaceAllocation.user_within_team_space_allocated.validator),
('user_within_team_space_limit_type', TeamSpaceAllocation.user_within_team_space_limit_type.validator),
('user_within_team_space_used_cached', TeamSpaceAllocation.user_within_team_space_used_cached.validator),
]
UserFeature._paper_as_files_validator = bv.Void()
UserFeature._file_locking_validator = bv.Void()
UserFeature._other_validator = bv.Void()
UserFeature._tagmap = {
'paper_as_files': UserFeature._paper_as_files_validator,
'file_locking': UserFeature._file_locking_validator,
'other': UserFeature._other_validator,
}
UserFeature.paper_as_files = UserFeature('paper_as_files')
UserFeature.file_locking = UserFeature('file_locking')
UserFeature.other = UserFeature('other')
UserFeatureValue._paper_as_files_validator = PaperAsFilesValue_validator
UserFeatureValue._file_locking_validator = FileLockingValue_validator
UserFeatureValue._other_validator = bv.Void()
UserFeatureValue._tagmap = {
'paper_as_files': UserFeatureValue._paper_as_files_validator,
'file_locking': UserFeatureValue._file_locking_validator,
'other': UserFeatureValue._other_validator,
}
UserFeatureValue.other = UserFeatureValue('other')
UserFeaturesGetValuesBatchArg.features.validator = bv.List(UserFeature_validator)
UserFeaturesGetValuesBatchArg._all_field_names_ = set(['features'])
UserFeaturesGetValuesBatchArg._all_fields_ = [('features', UserFeaturesGetValuesBatchArg.features.validator)]
UserFeaturesGetValuesBatchError._empty_features_list_validator = bv.Void()
UserFeaturesGetValuesBatchError._other_validator = bv.Void()
UserFeaturesGetValuesBatchError._tagmap = {
'empty_features_list': UserFeaturesGetValuesBatchError._empty_features_list_validator,
'other': UserFeaturesGetValuesBatchError._other_validator,
}
UserFeaturesGetValuesBatchError.empty_features_list = UserFeaturesGetValuesBatchError('empty_features_list')
UserFeaturesGetValuesBatchError.other = UserFeaturesGetValuesBatchError('other')
UserFeaturesGetValuesBatchResult.values.validator = bv.List(UserFeatureValue_validator)
UserFeaturesGetValuesBatchResult._all_field_names_ = set(['values'])
UserFeaturesGetValuesBatchResult._all_fields_ = [('values', UserFeaturesGetValuesBatchResult.values.validator)]
features_get_values = bb.Route(
'features/get_values',
1,
False,
UserFeaturesGetValuesBatchArg_validator,
UserFeaturesGetValuesBatchResult_validator,
UserFeaturesGetValuesBatchError_validator,
{'auth': 'user',
'host': 'api',
'style': 'rpc'},
)
get_account = bb.Route(
'get_account',
1,
False,
GetAccountArg_validator,
BasicAccount_validator,
GetAccountError_validator,
{'auth': 'user',
'host': 'api',
'style': 'rpc'},
)
get_account_batch = bb.Route(
'get_account_batch',
1,
False,
GetAccountBatchArg_validator,
GetAccountBatchResult_validator,
GetAccountBatchError_validator,
{'auth': 'user',
'host': 'api',
'style': 'rpc'},
)
get_current_account = bb.Route(
'get_current_account',
1,
False,
bv.Void(),
FullAccount_validator,
bv.Void(),
{'auth': 'user',
'host': 'api',
'style': 'rpc'},
)
get_space_usage = bb.Route(
'get_space_usage',
1,
False,
bv.Void(),
SpaceUsage_validator,
bv.Void(),
{'auth': 'user',
'host': 'api',
'style': 'rpc'},
)
ROUTES = {
'features/get_values': features_get_values,
'get_account': get_account,
'get_account_batch': get_account_batch,
'get_current_account': get_current_account,
'get_space_usage': get_space_usage,
}
|