# Class: Contact

## Constructor

#### new Contact()

  Represents an immutable contact object which exposes all possible contact details.
  The contact object can also be used to subscribe for presence updates.

  Contacts can be retrieved by using Contacts functions Contacts.getContacts() or Contacts.searchContacts().
  Both functions return DataRetrieval that is notifying about operation status and new record coming in.
  This object can not be used to edit the contact record. In order to update contact use function Contacts.createEditableContact() and then operate on EditableContact object which should be passed to Contacts.updateContact() function.

  ##### See:

    - AvayaClientServices.Services.Contacts.EditableContact

## Methods

#### getAlias() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns alias of the contact.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getASCIIDisplayName() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns non-localized display name of the contact.
  If contact has both localized and non-localized versions of display name specified, Contact.getDisplayName() returns localized one and Contact.getASCIIDisplayName() returns non-localized one.
  If contact has only one version of display name specified, Contact.getDisplayName() returns the specified display name and Contact.getASCIIDisplayName() returns empty string.

  ##### See:

    - {AvayaClientServices.Services.Contacts.Contact#getDisplayName}

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getASCIIFirstName() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns non-localized first name of the contact.
  If contact has both localized and non-localized versions of first name specified, Contact.getFirstName() returns localized one and Contact.getASCIIFirstName() returns non-localized one.
  If contact has only one version of first name specified, Contact.getFirstName() returns the specified given name and Contact.getASCIIFirstName() returns empty string.

  ##### See:

    - {AvayaClientServices.Services.Contacts.Contact#getFirstName}

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getASCIILastName() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns non-localized surname of the contact.
  If contact has both localized and non-localized versions of surname specified, Contact.getLastName() returns localized one and Contact.getASCIILastName() returns non-localized one.
  If contact has only one version of surname specified, Contact.getLastName() returns the specified surname and Contact.getASCIILastName() returns empty string.

  ##### See:

    - {AvayaClientServices.Services.Contacts.Contact#getLastName}

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getCity() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the city.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getCompany() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the company.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getCountry() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the country.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getCustom1() → {AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactStringField>}

  Returns the list of Custom 1 fields.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactStringField> }

#### getCustom2() → {AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactStringField>}

  Returns the list of Custom 2 fields.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactStringField> }

#### getCustom3() → {AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactStringField>}

  Returns the list of Custom 3 fields.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactStringField> }

#### getDepartment() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the department.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getDisplayName() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns display name of the contact.
  If contact has both localized and non-localized versions of display name specified, Contact.getDisplayName() returns localized one and Contact.getASCIIDisplayName()} returns non-localized one.
  If contact has only one version of display name specified, Contact.getDisplayName()} returns the specified display name and Contact.getASCIIDisplayName() returns empty string.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getEmailAddresses() → {AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactEmailAddressField>}

  Returns the list of email addresses.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactEmailAddressField> }

#### getFirstName() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns first name of the contact.
  If contact has both localized and non-localized versions of first name specified, Contact.getFirstName() returns localized one and Contact.getASCIIFirstName() returns non-localized one.
  If contact has only one version of first name specified, Contact.getFirstName() returns the specified given name and Contact.getASCIIFirstName() returns empty string.

  ##### See:

    - {AvayaClientServices.Services.Contacts.Contact#getASCIIFirstName}

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getIMAddresses() → {AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactIMAddressField>}

  Returns the list of instant messaging addresses.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactIMAddressField> }

#### getLanguage() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the preferred locale of the contact (for example, 'en_US').

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getLastName() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns last name of the contact.
  If contact has both localized and non-localized versions of last name specified, Contact.getLastName() returns localized one and Contact.getASCIILastName() returns non-localized one.
  If contact has only one version of surname specified, Contact.getLastName() returns the specified surname and Contact.getASCIILastName() returns empty string.

  ##### See:

    - {AvayaClientServices.Services.Contacts.Contact#getASCIILastName}

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getLocation() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns location of the contact

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getManager() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the manager.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getNotes() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns notes of the contact.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getPhoneNumbers() → {AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactPhoneField>}

  Returns the list of phone numbers.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactFieldList.<AvayaClientServices.Services.Contacts.ContactPhoneField> }

#### getPictureUrl(size) → {string|undefined}

  Returns the URL of contact's picture. You can specify the desired picture size via size parameter.
  If the URL can not be retrieved or contact doesn't have picture, the function returns undefined.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `size` | AvayaClientServices.Services.Contacts.ContactPictureSize | Desired size of the picture.

  ##### Returns:

  { string | undefined }

#### getPostalCode() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the postal code.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getPresence() → {AvayaClientServices.Services.Presence.Presence|AvayaClientServices.Services.Presence.SelfPresence|undefined}

  Returns presence information of the contact.
  Note that for the presence to start being updated, Contact.startPresence() must be invoked.
  If presence will no longer be needed, use Contact.stopPresence() in order to stop presence subscription.

  ##### Returns:

  { AvayaClientServices.Services.Presence.Presence | AvayaClientServices.Services.Presence.SelfPresence | undefined }

#### getRank() → {AvayaClientServices.Services.Contacts.ContactNumberField}

  Returns rank of the contact. This value may be used for sorting the contacts list.
  Can be any non-negative number (including fractional numbers).

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactNumberField }

#### getScopiaLoginId() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns Scopia Login ID.
  This field will have empty value in non-Scopia deployments or if this contact represents Scopia Terminal.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getScopiaUserId() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns Scopia User ID.
  This field will have empty value in non-Scopia deployments or if this contact represents Scopia Terminal.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getState() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the state field.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getStreetAddress() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the street address.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getTenantId() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the tenant Id. This will only be filled in if the contact is a VDN.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### getTerminal() → {AvayaClientServices.Services.Contacts.Terminal}

  Returns Scopia Terminal.
  This field will have empty value in non-Scopia deployments or if this contact doesn't represent Scopia Terminal.

  ##### See:

    - {AvayaClientServices.Services.Contacts.Contacts#getNetworkSearchTerminalCapability}

  ##### Returns:

  { AvayaClientServices.Services.Contacts.Terminal }

#### getUniqueAddressForMatching() → {string}

  Returns the unique ID of the contact.

  ##### Returns:

  { string }

  The address used for matching/merging other contact records.

#### getWorkRoomNumber() → {AvayaClientServices.Services.Contacts.ContactStringField}

  Returns the work room number.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactStringField }

#### isBuddy() → {AvayaClientServices.Services.Contacts.ContactBooleanField}

  Returns the buddy flag. Used for presence feature purposes.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactBooleanField }

#### isFavorite() → {AvayaClientServices.Services.Contacts.ContactBooleanField}

  Returns the favorite flag.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactBooleanField }

#### isVideoCapable() → {AvayaClientServices.Services.Contacts.ContactBooleanField}

  Returns the video capable flag.

  ##### Returns:

  { AvayaClientServices.Services.Contacts.ContactBooleanField }

#### startPresence() → {AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)>}

  Starts monitoring presence of this contact. Once the operation is completed, Contact.getPresence() will be returning the actual presence information for the contact.

  ##### See:

    - {AvayaClientServices.Services.Contacts.Contact#stopPresence}

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)> }

#### stopPresence() → {AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)>}

  Stops monitoring presence of this contact. Once the operation is completed, Contact.getPresence() will not be returning contact's actual presence information.

  ##### Returns:

  { AvayaClientServices.Base.Promise.<(undefined|AvayaClientServices.Services.Presence.PresenceError)> }

### Callbacks

#### addOnContactChangedCallback(callback)

  Adds a new onContactChangedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Contacts.Contact#onContactChangedCallback |

  Deprecated:
    - This callback is never executed

#### addOnPresenceChangedCallback(callback)

  Adds a new onPresenceChangedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Contacts.Contact#onPresenceChangedCallback |

#### removeOnContactChangedCallback(callback)

  Removes existing onContactChangedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Contacts.Contact#onContactChangedCallback |

  Deprecated:
    - This callback is never executed

#### removeOnPresenceChangedCallback(callback)

  Removes existing onPresenceChangedCallback.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Services.Contacts.Contact#onPresenceChangedCallback |

### Capabilities

#### getDeleteContactCapability() → {AvayaClientServices.Base.Capability}

  Returns the capability indicating if this contact can be deleted from the contact list. See Contacts.deleteContact().

  ##### Returns:

  { AvayaClientServices.Base.Capability }

  Capability object describing whether this particular contact can be deleted or not.

#### getPresenceCapability() → {AvayaClientServices.Base.Capability}

  Returns the capability specifying if Presence information can be retrieved for this contact. See Contact.getPresence().

  ##### See:

    - {AvayaClientServices.Services.Presence}

  ##### Returns:

  { AvayaClientServices.Base.Capability }

  Capability object describing whether the presence for this particular contact can be retrieved or not.

#### getUpdateContactCapability() → {AvayaClientServices.Base.Capability}

  Returns the capability indicating if this contact can be updated. See also Contacts.updateContact().

  ##### Returns:

  { AvayaClientServices.Base.Capability }

  Capability object describing whether this particular contact can be changed or not.

## Type Definitions

#### onContactChangedCallback(contacts, contact)

  Interface for the callback function to be invoked when the contact is updated.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `contacts` | AvayaClientServices.Services.Contacts.Contacts | An instance of contacts module.
  `contact` | AvayaClientServices.Services.Contacts.Contact | Updated contact object.

#### onPresenceChangedCallback(contact, presence)

  Interface for the callback function to be invoked when the contact's presence information is changed.
  Note that Contact.startPresence() must be invoked in order to trigger receiving presence updates.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `contact` | AvayaClientServices.Services.Contacts.Contact | Object the presence has been updated for.
  `presence` | AvayaClientServices.Services.Presence.Presence | AvayaClientServices.Services.Presence.SelfPresence | Presence information of the contact.