|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# Auto-generated by Stone, do not modify. |
| 3 | +# @generated |
| 4 | +# flake8: noqa |
| 5 | +# pylint: skip-file |
| 6 | +try: |
| 7 | + from . import stone_validators as bv |
| 8 | + from . import stone_base as bb |
| 9 | +except (ImportError, SystemError, ValueError): |
| 10 | + # Catch errors raised when importing a relative module when not in a package. |
| 11 | + # This makes testing this file directly (outside of a package) easier. |
| 12 | + import stone_validators as bv |
| 13 | + import stone_base as bb |
| 14 | + |
| 15 | +try: |
| 16 | + from . import ( |
| 17 | + common, |
| 18 | + ) |
| 19 | +except (ImportError, SystemError, ValueError): |
| 20 | + import common |
| 21 | + |
| 22 | +class DeleteManualContactsArg(bb.Struct): |
| 23 | + """ |
| 24 | + :ivar email_addresses: List of manually added contacts to be deleted. |
| 25 | + """ |
| 26 | + |
| 27 | + __slots__ = [ |
| 28 | + '_email_addresses_value', |
| 29 | + '_email_addresses_present', |
| 30 | + ] |
| 31 | + |
| 32 | + _has_required_fields = True |
| 33 | + |
| 34 | + def __init__(self, |
| 35 | + email_addresses=None): |
| 36 | + self._email_addresses_value = None |
| 37 | + self._email_addresses_present = False |
| 38 | + if email_addresses is not None: |
| 39 | + self.email_addresses = email_addresses |
| 40 | + |
| 41 | + @property |
| 42 | + def email_addresses(self): |
| 43 | + """ |
| 44 | + List of manually added contacts to be deleted. |
| 45 | +
|
| 46 | + :rtype: list of [str] |
| 47 | + """ |
| 48 | + if self._email_addresses_present: |
| 49 | + return self._email_addresses_value |
| 50 | + else: |
| 51 | + raise AttributeError("missing required field 'email_addresses'") |
| 52 | + |
| 53 | + @email_addresses.setter |
| 54 | + def email_addresses(self, val): |
| 55 | + val = self._email_addresses_validator.validate(val) |
| 56 | + self._email_addresses_value = val |
| 57 | + self._email_addresses_present = True |
| 58 | + |
| 59 | + @email_addresses.deleter |
| 60 | + def email_addresses(self): |
| 61 | + self._email_addresses_value = None |
| 62 | + self._email_addresses_present = False |
| 63 | + |
| 64 | + def _process_custom_annotations(self, annotation_type, processor): |
| 65 | + super(DeleteManualContactsArg, self)._process_custom_annotations(annotation_type, processor) |
| 66 | + |
| 67 | + def __repr__(self): |
| 68 | + return 'DeleteManualContactsArg(email_addresses={!r})'.format( |
| 69 | + self._email_addresses_value, |
| 70 | + ) |
| 71 | + |
| 72 | +DeleteManualContactsArg_validator = bv.Struct(DeleteManualContactsArg) |
| 73 | + |
| 74 | +class DeleteManualContactsError(bb.Union): |
| 75 | + """ |
| 76 | + This class acts as a tagged union. Only one of the ``is_*`` methods will |
| 77 | + return true. To get the associated value of a tag (if one exists), use the |
| 78 | + corresponding ``get_*`` method. |
| 79 | +
|
| 80 | + :ivar list of [str] contacts_not_found: Can't delete contacts from this |
| 81 | + list. Make sure the list only has manually added contacts. The deletion |
| 82 | + was cancelled. |
| 83 | + """ |
| 84 | + |
| 85 | + _catch_all = 'other' |
| 86 | + # Attribute is overwritten below the class definition |
| 87 | + other = None |
| 88 | + |
| 89 | + @classmethod |
| 90 | + def contacts_not_found(cls, val): |
| 91 | + """ |
| 92 | + Create an instance of this class set to the ``contacts_not_found`` tag |
| 93 | + with value ``val``. |
| 94 | +
|
| 95 | + :param list of [str] val: |
| 96 | + :rtype: DeleteManualContactsError |
| 97 | + """ |
| 98 | + return cls('contacts_not_found', val) |
| 99 | + |
| 100 | + def is_contacts_not_found(self): |
| 101 | + """ |
| 102 | + Check if the union tag is ``contacts_not_found``. |
| 103 | +
|
| 104 | + :rtype: bool |
| 105 | + """ |
| 106 | + return self._tag == 'contacts_not_found' |
| 107 | + |
| 108 | + def is_other(self): |
| 109 | + """ |
| 110 | + Check if the union tag is ``other``. |
| 111 | +
|
| 112 | + :rtype: bool |
| 113 | + """ |
| 114 | + return self._tag == 'other' |
| 115 | + |
| 116 | + def get_contacts_not_found(self): |
| 117 | + """ |
| 118 | + Can't delete contacts from this list. Make sure the list only has |
| 119 | + manually added contacts. The deletion was cancelled. |
| 120 | +
|
| 121 | + Only call this if :meth:`is_contacts_not_found` is true. |
| 122 | +
|
| 123 | + :rtype: list of [str] |
| 124 | + """ |
| 125 | + if not self.is_contacts_not_found(): |
| 126 | + raise AttributeError("tag 'contacts_not_found' not set") |
| 127 | + return self._value |
| 128 | + |
| 129 | + def _process_custom_annotations(self, annotation_type, processor): |
| 130 | + super(DeleteManualContactsError, self)._process_custom_annotations(annotation_type, processor) |
| 131 | + |
| 132 | + def __repr__(self): |
| 133 | + return 'DeleteManualContactsError(%r, %r)' % (self._tag, self._value) |
| 134 | + |
| 135 | +DeleteManualContactsError_validator = bv.Union(DeleteManualContactsError) |
| 136 | + |
| 137 | +DeleteManualContactsArg._email_addresses_validator = bv.List(common.EmailAddress_validator) |
| 138 | +DeleteManualContactsArg._all_field_names_ = set(['email_addresses']) |
| 139 | +DeleteManualContactsArg._all_fields_ = [('email_addresses', DeleteManualContactsArg._email_addresses_validator)] |
| 140 | + |
| 141 | +DeleteManualContactsError._contacts_not_found_validator = bv.List(common.EmailAddress_validator) |
| 142 | +DeleteManualContactsError._other_validator = bv.Void() |
| 143 | +DeleteManualContactsError._tagmap = { |
| 144 | + 'contacts_not_found': DeleteManualContactsError._contacts_not_found_validator, |
| 145 | + 'other': DeleteManualContactsError._other_validator, |
| 146 | +} |
| 147 | + |
| 148 | +DeleteManualContactsError.other = DeleteManualContactsError('other') |
| 149 | + |
| 150 | +delete_manual_contacts = bb.Route( |
| 151 | + 'delete_manual_contacts', |
| 152 | + 1, |
| 153 | + False, |
| 154 | + bv.Void(), |
| 155 | + bv.Void(), |
| 156 | + bv.Void(), |
| 157 | + {'host': u'api', |
| 158 | + 'style': u'rpc'}, |
| 159 | +) |
| 160 | +delete_manual_contacts_batch = bb.Route( |
| 161 | + 'delete_manual_contacts_batch', |
| 162 | + 1, |
| 163 | + False, |
| 164 | + DeleteManualContactsArg_validator, |
| 165 | + bv.Void(), |
| 166 | + DeleteManualContactsError_validator, |
| 167 | + {'host': u'api', |
| 168 | + 'style': u'rpc'}, |
| 169 | +) |
| 170 | + |
| 171 | +ROUTES = { |
| 172 | + 'delete_manual_contacts': delete_manual_contacts, |
| 173 | + 'delete_manual_contacts_batch': delete_manual_contacts_batch, |
| 174 | +} |
| 175 | + |
0 commit comments