Class ContactAPI


  • public class ContactAPI
    extends BaseAPI
    Each user have a profile attached, that holds all the personal details of the user. This includes very basic information like the name and mail addresses, but can also include more advanced fields like billing address and IM addresses. Fields can have either one or multiple values. There can f.ex. only be one name, but multiple mail addresses. The value of a field can either be a string, a number or a date.
    • Constructor Detail

    • Method Detail

      • addSpaceContact

        public int addSpaceContact​(int spaceId,
                                   ContactCreate create,
                                   boolean silent)
        Adds a new contact to the given space.
        Parameters:
        spaceId - The id of the space the contact should be added to
        create - The data for the new contact
        silent - True if the create should be silent, false otherwise
        Returns:
        The id of the newly created contact
      • updateSpaceContact

        public void updateSpaceContact​(int profileId,
                                       ContactUpdate update,
                                       boolean silent,
                                       boolean hook)
        Updates the entire space contact. Only fields which have values specified will be updated. To delete the contents of a field, pass an empty array for the value.
        Parameters:
        profileId - The id of the space contact to be updated
        update - The data for the update
        silent - True if the update should be silent, false otherwise
        hook - True if hooks should be executed for the change, false otherwise
      • deleteSpaceContact

        public void deleteSpaceContact​(int profileId,
                                       boolean silent)
        Deletes a space contact.
        Parameters:
        profileId - The id of the space contact to be deleted
        silent - True if the deletion should be silent, false otherwise
      • getContact

        public Profile getContact​(int profileId)
        Returns all the contact details about the user with the given id.
        Parameters:
        profileId - The profile id of the user
        Returns:
        The contact profile
      • getContactField

        public <T,​R> List<T> getContactField​(int userId,
                                                   ProfileField<T,​R> field)
        Returns the value of a contact with the specific field
        Parameters:
        userId - The id of the user
        field - The field for which data should be returned
        Returns:
        The list of values for the given field
      • getContactTotal

        public ContactTotal getContactTotal()
        Returns the total number of contacts by organization.
        Returns:
        The list of contact totals by organization
      • getContacts

        public <T,​F,​R> List<T> getContacts​(ProfileField<F,​R> key,
                                                       F value,
                                                       Integer limit,
                                                       Integer offset,
                                                       ProfileType<T> type,
                                                       ContactOrder order,
                                                       ContactType contactType)
        Used to get a list of contacts for the user.
        Parameters:
        key - The profile field if the contacts should be filtered
        value - The value for the field if the contacts should be filtered
        limit - The maximum number of contacts to return
        offset - The offset into the list of contacts
        type - The format in which the contacts should be returned
        order - How the contacts should be ordered
        contactType - The type of contacts to be returned
        Returns:
        The list of contacts
      • getOrganizationContacts

        public <T,​F,​R> List<T> getOrganizationContacts​(int organizationId,
                                                                   ProfileField<F,​R> key,
                                                                   F value,
                                                                   Integer limit,
                                                                   Integer offset,
                                                                   ProfileType<T> type,
                                                                   ContactOrder order,
                                                                   ContactType contactType)
        Returns all the profiles of the users contacts on the given organization
        Parameters:
        organizationId - The id of the organization the contacts should be returned from
        key - The profile field if the contacts should be filtered
        value - The value for the field if the contacts should be filtered
        limit - The maximum number of contacts to return
        offset - The offset into the list of contacts
        type - The format in which the contacts should be returned
        order - How the contacts should be ordered
        contactType - The type of contacts to be returned
        Returns:
        The list of contacts
      • getSpaceContacts

        public <T,​F,​R> List<T> getSpaceContacts​(int spaceId,
                                                            ProfileField<F,​R> key,
                                                            F value,
                                                            Integer limit,
                                                            Integer offset,
                                                            ProfileType<T> type,
                                                            ContactOrder order,
                                                            ContactType contactType)
        Returns all the profiles of the users contacts on the given space
        Parameters:
        spaceId - The id of the space the contacts should be returned from
        key - The profile field if the contacts should be filtered
        value - The value for the field if the contacts should be filtered
        limit - The maximum number of contacts to return
        offset - The offset into the list of contacts
        type - The format in which the contacts should be returned
        order - How the contacts should be ordered
        contactType - The type of contacts to be returned
        Returns:
        The list of contacts
      • getSpaceContactTotals

        public SpaceContactTotals getSpaceContactTotals​(int spaceId)
        Returns the total number of contacts on the space
        Parameters:
        spaceId - The id of the space the number of contacts should be returned from
        Returns:
        The total number of space contacts