NewPath-Consulting/warm

Support 2 new optional config parameters for Contacts, Events and SentEmails

Closed this issue · 2 comments

In order to get the API to do some filtering for us before GDS gets the data let's support the $filter and $count arguments to the API call. These are optional.

For Contacts and Events both $filter and $count can be added as config parameters:

Filter text box
Return count only checkbox

For Contacts object the Filter config parameter should have the following description text displayed:

Create a filter clause to return only a subset of contact records to speed up processing in Google Data Studio. See https://gethelp.wildapricot.com/en/articles/502#filtering for more details.

For Events object the Filter config parameter should have the following description text displayed:
Create a filter clause to return only a subset of event records to speed up processing in Google Data Studio. See https://gethelp.wildapricot.com/en/articles/499-events-admin-api-call#filtering for more details.

For SentEmails object only the Filter config parameter should be available.

The following description text for the Filter text box parameter should be displayed

`Allowed filter fields (allowed operations):

SentDate (ge, le),
SenderId (eq) - ID of sender,
OriginType (eq) - see SentEmail.Origin.OriginType,
SendingType (eq) -SentEmail.SendingType (Automatic or Manual)

The AND boolean operator supported only for this filter.

...&$filter=SentDate ge 2018-05-01 - will return records sent on or after May 1st, 2018`

Concerns

  1. One concern I have with this is if the user enters an invalid $filter, the api just returns an error, which could cause frustration.
  2. I think the addition of the count field might cause confusion as the field will always be visible in the explorer even when not in use.

Implementation Notes

  1. The $filter param is already being used for the archived and member checkboxes for contacts. If the user includes these in the filter field as well, the user supplied $filter is appended with an AND clause.
  2. For the addition of the $count param, I added a count field to the schema, then filled a single row with the returned count, leaving every other field blank.
  3. Description fields do not support multi-line text, so the SentEmails filter description looks a little strange for now.

Looks good @stephenpoole -- makes the performance doing counts and filters much faster.