File: contacts.py

package info (click to toggle)
python-dropbox 12.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,772 kB
  • sloc: python: 76,994; sh: 27; makefile: 24
file content (138 lines) | stat: -rw-r--r-- 4,355 bytes parent folder | download | duplicates (2)
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
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
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

class DeleteManualContactsArg(bb.Struct):
    """
    :ivar contacts.DeleteManualContactsArg.email_addresses: List of manually
        added contacts to be deleted.
    """

    __slots__ = [
        '_email_addresses_value',
    ]

    _has_required_fields = True

    def __init__(self,
                 email_addresses=None):
        self._email_addresses_value = bb.NOT_SET
        if email_addresses is not None:
            self.email_addresses = email_addresses

    # Instance attribute type: list of [str] (validator is set below)
    email_addresses = bb.Attribute("email_addresses")

    def _process_custom_annotations(self, annotation_type, field_path, processor):
        super(DeleteManualContactsArg, self)._process_custom_annotations(annotation_type, field_path, processor)

DeleteManualContactsArg_validator = bv.Struct(DeleteManualContactsArg)

class DeleteManualContactsError(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 list of [str] contacts.DeleteManualContactsError.contacts_not_found:
        Can't delete contacts from this list. Make sure the list only has
        manually added contacts. The deletion was cancelled.
    """

    _catch_all = 'other'
    # Attribute is overwritten below the class definition
    other = None

    @classmethod
    def contacts_not_found(cls, val):
        """
        Create an instance of this class set to the ``contacts_not_found`` tag
        with value ``val``.

        :param list of [str] val:
        :rtype: DeleteManualContactsError
        """
        return cls('contacts_not_found', val)

    def is_contacts_not_found(self):
        """
        Check if the union tag is ``contacts_not_found``.

        :rtype: bool
        """
        return self._tag == 'contacts_not_found'

    def is_other(self):
        """
        Check if the union tag is ``other``.

        :rtype: bool
        """
        return self._tag == 'other'

    def get_contacts_not_found(self):
        """
        Can't delete contacts from this list. Make sure the list only has
        manually added contacts. The deletion was cancelled.

        Only call this if :meth:`is_contacts_not_found` is true.

        :rtype: list of [str]
        """
        if not self.is_contacts_not_found():
            raise AttributeError("tag 'contacts_not_found' not set")
        return self._value

    def _process_custom_annotations(self, annotation_type, field_path, processor):
        super(DeleteManualContactsError, self)._process_custom_annotations(annotation_type, field_path, processor)

DeleteManualContactsError_validator = bv.Union(DeleteManualContactsError)

DeleteManualContactsArg.email_addresses.validator = bv.List(common.EmailAddress_validator)
DeleteManualContactsArg._all_field_names_ = set(['email_addresses'])
DeleteManualContactsArg._all_fields_ = [('email_addresses', DeleteManualContactsArg.email_addresses.validator)]

DeleteManualContactsError._contacts_not_found_validator = bv.List(common.EmailAddress_validator)
DeleteManualContactsError._other_validator = bv.Void()
DeleteManualContactsError._tagmap = {
    'contacts_not_found': DeleteManualContactsError._contacts_not_found_validator,
    'other': DeleteManualContactsError._other_validator,
}

DeleteManualContactsError.other = DeleteManualContactsError('other')

delete_manual_contacts = bb.Route(
    'delete_manual_contacts',
    1,
    False,
    bv.Void(),
    bv.Void(),
    bv.Void(),
    {'auth': 'user',
     'host': 'api',
     'style': 'rpc'},
)
delete_manual_contacts_batch = bb.Route(
    'delete_manual_contacts_batch',
    1,
    False,
    DeleteManualContactsArg_validator,
    bv.Void(),
    DeleteManualContactsError_validator,
    {'auth': 'user',
     'host': 'api',
     'style': 'rpc'},
)

ROUTES = {
    'delete_manual_contacts': delete_manual_contacts,
    'delete_manual_contacts_batch': delete_manual_contacts_batch,
}