Package com.avaya.clientservices.contact

## Interface ContactGroup

-     public interface ContactGroup

  Represents contact group object which exposes all possible contact group details. It allows to add and remove contacts to/from group and update name of the group.

  Contact gorups can be created by using `ContactService` method `ContactService.createContactGroup(String, Collection, CreateContactGroupCompletionHandler)` and deleted by method `ContactService.deleteContactGroup(ContactGroup, ContactCompletionHandler)`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addContactGroupListener​(ContactGroupListener contactGroupListener)` | Adds the contact group listener to get updates for this contact group.
    `void` | `addContacts​(java.util.Collection<Contact> contacts, ContactGroupOperationCompletionHandler completionHandler)` | Adds new contacts to a group Operation fails if at least one contact can't be added to a group due to capability not allowed.
    `Capability` | `getAddContactCapability()` | Returns Capability indicating whether this contact group can add new contacts.
    `java.util.Collection<Contact>` | `getGroupMembers()` | Returns collection of contacts associated with group.
    `java.lang.String` | `getName()` | Returns name of the group of contacts.
    `Capability` | `getRemoveContactCapability()` | Returns Capability indicating whether this contact group can remove contacts.
    `Capability` | `getRenameGroupCapability()` | Returns Capability indicating whether this contact group can be renamed.
    `void` | `removeContactGroupListener​(ContactGroupListener contactGroupListener)` | Removes the contact group listener to stop getting updates for this contact group.
    `void` | `removeContacts​(java.util.Collection<Contact> contacts, ContactGroupOperationCompletionHandler completionHandler)` | Removes contacts from a group Operation fails if at least one contact can't be removed from group due to capability not allowed.
    `void` | `renameGroup​(java.lang.String newName, ContactGroupOperationCompletionHandler completionHandler)` | Renames group.

- - ### Method Detail

    - #### addContactGroupListener

          void addContactGroupListener​(ContactGroupListener contactGroupListener)

      Adds the contact group listener to get updates for this contact group.
      Parameters:
        `contactGroupListener` - The listener to register with this object.

    - #### removeContactGroupListener

          void removeContactGroupListener​(ContactGroupListener contactGroupListener)

      Removes the contact group listener to stop getting updates for this contact group.
      Parameters:
        `contactGroupListener` - The listener to unregister from this object.

    - #### getName

          java.lang.String getName()

      Returns name of the group of contacts.
      Returns:
        Name of the group of contacts.

    - #### getGroupMembers

          java.util.Collection<Contact> getGroupMembers()

      Returns collection of contacts associated with group.
      Returns:
        collection of `Contact`) objects of group.

    - #### getRenameGroupCapability

          Capability getRenameGroupCapability()

      Returns Capability indicating whether this contact group can be renamed.
      Returns:
        `Capability` object describing whether the Contact Group supports renaming.

    - #### getAddContactCapability

          Capability getAddContactCapability()

      Returns Capability indicating whether this contact group can add new contacts.
      Returns:
        `Capability` object describing whether the Contact Group supports adding new contacts.

    - #### getRemoveContactCapability

          Capability getRemoveContactCapability()

      Returns Capability indicating whether this contact group can remove contacts.
      Returns:
        `Capability` object describing whether the Contact Group supports removing contacts.

    - #### renameGroup

          void renameGroup​(java.lang.String newName,
                           ContactGroupOperationCompletionHandler completionHandler)

      Renames group. Renaming of the group results in raising onCollectionChanged events on DataRetrievalWatcher - group deleted, group added.
      Parameters:
        `newName` - New name of the group of contacts. Group name length is limited by the server. There are some characters not allowed to be present in group name (< > , ").
        `completionHandler` - A block to be called when the operation is completed. If the operation was successful this parameter is nil. If an error occurred it contains an object describing the error.

    - #### addContacts

          void addContacts​(java.util.Collection<Contact> contacts,
                           ContactGroupOperationCompletionHandler completionHandler)

      Adds new contacts to a group Operation fails if at least one contact can't be added to a group due to capability not allowed. Entire collection remains unchanged in this case. Providing contact as argument which already exists in group treated as Success operation.
      Parameters:
        `contacts` - collection of `Contact` objects to be added to a group
        `completionHandler` - A block to be called when the operation is completed. If the operation was successful this parameter is nil. If an error occurred it contains an object describing the error.

    - #### removeContacts

          void removeContacts​(java.util.Collection<Contact> contacts,
                              ContactGroupOperationCompletionHandler completionHandler)

      Removes contacts from a group Operation fails if at least one contact can't be removed from group due to capability not allowed. Entire collection remains unchanged in this case. Providing contact as argument which doesn't exist in group treated as Success operation.
      Parameters:
        `contacts` - collection of `Contact` objects to be removed from a group
        `completionHandler` - A block to be called when the operation is completed. If the operation was successful this parameter is nil. If an error occurred it contains an object describing the error.