ContactsAPI

new ContactsAPI(rest)

This class is used to interact with Contacts in TidyHQ.
Parameters:
NameTypeDescription
restRestThe rest instance to use for requests.

Methods

(async) createContact(contact, optionsopt) → {Promise.<TidyAPI_V1_Contact>}

Creates a new contact with the given data in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
contactTidy_V1_ContactParamsThe contact to create. Requires a first name.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The newly created contact.
Type: 
Promise.<TidyAPI_V1_Contact>

(async) deleteContact(contact_id, optionsopt) → {Promise.<TidyAPI_Response>}

Deletes a contact from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
contact_idnumberThe ID of the contact to delete.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- Success or failure.
Type: 
Promise.<TidyAPI_Response>

(async) getContact(contactIDopt, optionsopt) → {Promise.<TidyAPI_V1_Contact>}

Get a single contact from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
contactIDnumber | string<optional>
"me"The ID of the contact to get ("me" returns the contact of the user who authorized the application)
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- A contact.
Type: 
Promise.<TidyAPI_V1_Contact>

(async) getContacts(optionsopt) → {Promise.<TidyAPI_V1_Contacts>}

Get a list of contacts from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
limitnumber<optional>
The maximum number of contacts to return.
offsetnumber<optional>
The number of contacts to skip.
search_termsstring<optional>
The search terms to use.
show_allboolean<optional>
Whether to show all contacts or not.
updated_sincestring<optional>
The timestamp of the last update in ISO 8601 format.
idsArray.<number><optional>
An array of contact IDs to get.
fieldsArray.<string><optional>
An array of fields to get.
filterArray.<string><optional>
An array of filters to use.
Returns:
- An array of contacts.
Type: 
Promise.<TidyAPI_V1_Contacts>

(async) getContactsInGroup(group_id, optionsopt) → {Promise.<TidyAPI_V1_Contacts>}

Get a list of contacts in a group from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
group_idstringThe ID of the group to get contacts from.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
limitnumber<optional>
The maximum number of contacts to return.
offsetnumber<optional>
The number of contacts to skip.
search_termsstring<optional>
The search terms to use.
show_allboolean<optional>
Whether to show all contacts or not.
updated_sincestring<optional>
The timestamp of the last update in ISO 8601 format.
idsArray.<number><optional>
An array of contact IDs to get.
fieldsArray.<string><optional>
An array of fields to get.
filterArray.<string><optional>
An array of filters to use.
Returns:
- An array of contacts.
Type: 
Promise.<TidyAPI_V1_Contacts>

(async) updateContact(contact_id, contact, optionsopt) → {Promise.<TidyAPI_V1_Contact>}

Updates a contact with the given data in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
contact_idnumberThe ID of the contact to update.
contactTidy_V1_ContactParamsThe contact to update.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The updated contact.
Type: 
Promise.<TidyAPI_V1_Contact>