GroupsAPI

new GroupsAPI(rest)

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

Methods

(async) addContactToGroup(group_id, contact_id, optionsopt) → {Promise.<TidyAPI_EmptyResponse>}

This function is used to add a contact to a group in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
group_idnumberThe ID of the group.
contact_idnumberThe ID of the contact.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An empty response.
Type: 
Promise.<TidyAPI_EmptyResponse>

(async) createGroup(name, optionsopt) → {Promise.<TidyAPI_V1_Group>}

Create a new group in TidyHQ.
Parameters:
NameTypeAttributesDescription
namestringThe name of the group.
optionsobject<optional>
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
descriptionstring<optional>
The description of the group.
Returns:
- The group.
Type: 
Promise.<TidyAPI_V1_Group>

(async) deleteGroup(group_id, optionsopt) → {Promise.<TidyAPI_Response>}

Delete a group in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
group_idnumberThe ID of the group.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- Success or failure.
Type: 
Promise.<TidyAPI_Response>

(async) getGroup(group_id, optionsopt) → {Promise.<TidyAPI_V1_Group>}

Get a single group from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
group_idnumberThe ID of the group.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- A group.
Type: 
Promise.<TidyAPI_V1_Group>

(async) getGroups(optionsopt) → {Promise.<TidyAPI_V1_Groups>}

Get a list of groups from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
limitnumber<optional>
The maximum number of groups to return.
offsetnumber<optional>
The number of groups to skip.
search_termsstring<optional>
The search terms to use.
Returns:
- An array of groups.
Type: 
Promise.<TidyAPI_V1_Groups>

(async) getGroupsForContact(contact_id, optionsopt) → {Promise.<TidyAPI_V1_Groups>}

Get groups for a contact from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
contact_idnumberThe ID of the contact.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
limitnumber<optional>
The maximum number of groups to return.
offsetnumber<optional>
The number of groups to skip.
search_termsstring<optional>
The search terms to use.
Returns:
- An array of groups.
Type: 
Promise.<TidyAPI_V1_Groups>

(async) removeContactFromGroup(group_id, contact_id, optionsopt) → {Promise.<TidyAPI_EmptyResponse>}

This function is used to remove a contact from a group in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
group_idnumberThe ID of the group.
contact_idnumberThe ID of the contact.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An empty response.
Type: 
Promise.<TidyAPI_EmptyResponse>

(async) updateGroup(group_id, optionsopt) → {Promise.<TidyAPI_V1_Group>}

Update a group in TidyHQ.
Parameters:
NameTypeAttributesDescription
group_idnumberThe ID of the group.
optionsobject<optional>
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
namestring<optional>
The name of the group.
descriptionstring<optional>
The description of the group.
Returns:
- The group.
Type: 
Promise.<TidyAPI_V1_Group>