CustomFieldsAPI

new CustomFieldsAPI(rest)

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

Methods

(async) createCustomField(title, type, optionsopt) → {Promise.<TidyAPI_V1_CustomField>}

Create a new custom field in TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
titlestringThe title of the custom field to create.
typeTidy_V1_CustomFieldTypeThe type of the custom field to create.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The newly created custom field.
Type: 
Promise.<TidyAPI_V1_CustomField>

(async) createCustomFieldChoice(customFieldID, title, optionsopt) → {Promise.<TidyAPI_V1_CustomFieldChoice>}

Get a single choice for a dropdown custom field by name.
Parameters:
NameTypeAttributesDefaultDescription
customFieldIDstringThe ID of the custom field to get the choice for.
titlestringThe title of the choice to get.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- A choice object.
Type: 
Promise.<TidyAPI_V1_CustomFieldChoice>

(async) deleteCustomField(customFieldID, optionsopt) → {Promise.<TidyAPI_Response>}

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

(async) deleteCustomFieldChoice(customFieldID, choiceID, optionsopt) → {Promise.<TidyAPI_Response>}

Delete a choice for a dropdown custom field.
Parameters:
NameTypeAttributesDefaultDescription
customFieldIDstringThe ID of the custom field to delete the choice for.
choiceIDstringThe ID of the choice to delete.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- Success or failure.
Type: 
Promise.<TidyAPI_Response>

(async) getCustomField(customFieldID, optionsopt) → {Promise.<TidyAPI_V1_CustomField>}

Get a single custom field from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
customFieldIDstringThe ID of the CustomField to get
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The custom field.
Type: 
Promise.<TidyAPI_V1_CustomField>

(async) getCustomFieldChoice(customFieldID, choiceID, optionsopt) → {Promise.<TidyAPI_V1_CustomFieldChoice>}

Get a single choice for a dropdown custom field.
Parameters:
NameTypeAttributesDefaultDescription
customFieldIDstringThe ID of the custom field to get the choice for.
choiceIDstringThe ID of the choice to get.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- A choice object.
Type: 
Promise.<TidyAPI_V1_CustomFieldChoice>

(async) getCustomFieldChoices(customFieldID, optionsopt) → {Promise.<TidyAPI_V1_CustomFieldChoices>}

Get the choices for a dropdown custom field.
Parameters:
NameTypeAttributesDefaultDescription
customFieldIDstringThe ID of the custom field to get the choices for.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An array of choice objects.
Type: 
Promise.<TidyAPI_V1_CustomFieldChoices>

(async) getCustomFields(optionsopt) → {Promise.<TidyAPI_V1_CustomFields>}

Get a list of custom fields from TidyHQ.
Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- An array of custom fields.
Type: 
Promise.<TidyAPI_V1_CustomFields>

(async) updateCustomField(customFieldID, optionsopt) → {Promise.<TidyAPI_V1_CustomField>}

Update a custom field in TidyHQ.
Parameters:
NameTypeAttributesDescription
customFieldIDstringThe ID of the custom field to update.
optionsobject<optional>
The options to update the custom field with. At least one option is required that isn't the access_token.
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
titlestring<optional>
The new title of the custom field.
type"string" | "text" | "dropdown" | "boolean" | "date"<optional>
The new type of the custom field.
Returns:
- The updated custom field.
Type: 
Promise.<TidyAPI_V1_CustomField>

(async) updateCustomFieldChoice(customFieldID, choiceID, title, optionsopt) → {Promise.<TidyAPI_V1_CustomFieldChoice>}

Update a choice for a dropdown custom field.
Parameters:
NameTypeAttributesDefaultDescription
customFieldIDstringThe ID of the custom field to update the choice for.
choiceIDstringThe ID of the choice to update.
titlestringThe new title of the choice.
optionsobject<optional>
{}
Properties
NameTypeAttributesDescription
access_tokenstring<optional>
The access token to use.
Returns:
- The updated choice object.
Type: 
Promise.<TidyAPI_V1_CustomFieldChoice>