# -*- coding: utf-8 -*- # Auto-generated by Stone, do not modify. # @generated # flake8: noqa # pylint: skip-file try: from . import stone_validators as bv from . import stone_base as bb except (ImportError, SystemError, ValueError): # Catch errors raised when importing a relative module when not in a package. # This makes testing this file directly (outside of a package) easier. import stone_validators as bv import stone_base as bb try: from . import ( common, ) except (ImportError, SystemError, ValueError): import common class DeleteManualContactsArg(bb.Struct): """ :ivar contacts.DeleteManualContactsArg.email_addresses: List of manually added contacts to be deleted. """ __slots__ = [ '_email_addresses_value', '_email_addresses_present', ] _has_required_fields = True def __init__(self, email_addresses=None): self._email_addresses_value = None self._email_addresses_present = False if email_addresses is not None: self.email_addresses = email_addresses @property def email_addresses(self): """ List of manually added contacts to be deleted. :rtype: list of [str] """ if self._email_addresses_present: return self._email_addresses_value else: raise AttributeError("missing required field 'email_addresses'") @email_addresses.setter def email_addresses(self, val): val = self._email_addresses_validator.validate(val) self._email_addresses_value = val self._email_addresses_present = True @email_addresses.deleter def email_addresses(self): self._email_addresses_value = None self._email_addresses_present = False def _process_custom_annotations(self, annotation_type, field_path, processor): super(DeleteManualContactsArg, self)._process_custom_annotations(annotation_type, field_path, processor) def __repr__(self): return 'DeleteManualContactsArg(email_addresses={!r})'.format( self._email_addresses_value, ) 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) def __repr__(self): return 'DeleteManualContactsError(%r, %r)' % (self._tag, self._value) 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(), {'host': u'api', 'style': u'rpc'}, ) delete_manual_contacts_batch = bb.Route( 'delete_manual_contacts_batch', 1, False, DeleteManualContactsArg_validator, bv.Void(), DeleteManualContactsError_validator, {'host': u'api', 'style': u'rpc'}, ) ROUTES = { 'delete_manual_contacts': delete_manual_contacts, 'delete_manual_contacts_batch': delete_manual_contacts_batch, }