cityofaustin / knackpy

A Python client for interacting with Knack applications
https://cityofaustin.github.io/knackpy/docs/user-guide/
Other
39 stars 18 forks source link

Feature Request: add a formatter for user_roles field type #113

Open jenna-jordan opened 2 years ago

jenna-jordan commented 2 years ago

The user_roles field type is used in User Roles (a.k.a Accounts) type objects. Currently, the only value grabbed (formatted or unformatted) is the role id (e.g. 'profile_34'). However, the more useful information is the human-readable label (e.g. 'Admin'). These human readable labels are available either in the not raw version of the field (but trapped in html), or in the profile_keys field.

Example of dict stored in the records object is copied below:

'profile_keys':'Admin, Applicants, Licensing Board-p',
'profile_keys_raw':[{'id': 'profile_51', 'identifier': 'Admin'}, {'id': 'profile_34', 'identifier': 'Applicants'}, {'id': 'profile_35', 'identifier': 'Licensing Board-p'}],
'field_96':'<span class="profile_51">Admin</span><br /><span class="profile_34">Applicants</span><br /><span class="profile_35">Licensing Board-p</span>',
'field_96_raw':['profile_51', 'profile_34', 'profile_35']

It would be great to have a formatter to handle this specific field type.