V2_ContactsAPI

new V2_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_V2_Contacts>}

Creates a new contact with the given data in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
contactTidy_V2_ContactThe contact to create.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
To Do
  • REFACTOR TYPES AND TEST
Returns:
- The created contact.
Type: 
Promise.<TidyAPI_V2_Contacts>

(async) createContactNote(contact_id, note, optionsopt) → {Promise.<TidyAPI_V2_Note>}

Adds a note to a specified contact.
Parameters:
NameTypeAttributesDefaultDescription
contact_idstringThe ID of the contact to create the note for.
notestringThe note to create.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The created note.
Type: 
Promise.<TidyAPI_V2_Note>

(async) deleteContactNote(contact_id, note_id, optionsopt) → {Promise.<TidyAPI_EmptyResponse>}

Deletes a specified note from a specified contact.
Parameters:
NameTypeAttributesDefaultDescription
contact_idstringThe ID of the contact to delete the note from.
note_idstringThe ID of the note to delete.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An empty response.
Type: 
Promise.<TidyAPI_EmptyResponse>

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

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

(async) getContactMemberships(contact_id, optionsopt) → {Promise.<TidyAPI_V2_Memberships>}

Gets all memberships for a given single contact.
Parameters:
NameTypeAttributesDefaultDescription
contact_idstringThe ID of the contact to find memberships for.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
updated_beforestring<optional>
ISO8601 formatted timestamp, only returns results last updated before the given time.
updated_sincestring<optional>
ISO8601 formatted timestamp, only returns results last updated since the given time.
limitnumber<optional>
The maximum number of contacts per page to return.
offsetnumber<optional>
The number of contacts to skip.
Returns:
- An array of memberships.
Type: 
Promise.<TidyAPI_V2_Memberships>

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

Get a list of contacts from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
updated_beforestring<optional>
ISO8601 formatted timestamp, only returns results last updated before the given time.
updated_sincestring<optional>
ISO8601 formatted timestamp, only returns results last updated since the given time.
limitnumber<optional>
The maximum number of contacts per page to return.
offsetnumber<optional>
The number of contacts to skip.
registeredboolean<optional>
When given, returns only users with / without a user account attached.
allboolean<optional>
When given, returns all (including inactive) - defaults to only returning visible / active.
idsArray.<string><optional>
When given, filters to those matching the given IDs. Can be combined with scope to specify the type of ID.
scope"contact_id_number" | "sports_australia_connect"<optional>
If specified, applies ids to the specified type. If not given, will default to check the id reference or the id.
search_termsstring<optional>
The search terms to use.
filter_equalsTidy_V2_ContactFilterEqualsOptions<optional>
Object with keys and values to filter by.
Returns:
- An array of contact objects.
Type: 
Promise.<TidyAPI_V2_Contacts>

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

Update a contact in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
contact_idstringThe ID of the contact to update.
contactTidy_V2_ContactThe new contact data.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The updated contact.
Type: 
Promise.<TidyAPI_V2_Contact>