PagerDuty / go-pagerduty

go client library for PagerDuty v2 API
https://v2.developer.pagerduty.com/docs/rest-api
Apache License 2.0
285 stars 241 forks source link

Add DeletedAt to APIObject #509

Open mattbnz opened 8 months ago

mattbnz commented 8 months ago

Some PagerDuty API responses appear to return an undocumented deleted_at key in their APIObject encodings when including objects that are no longer in-use. Can this field be added to APIObject so callers can make use of it to filter the returned lists?

It looks like a simple/straightforward change, but given the deleted_at field is undocumented as far as I can tell, I'm hesitant to rely on it or send a patch without some confirmation first.

More Details: I'm seeing this primarily on the ListSchedules API call, where the returned list of users can include entries for (apparently deleted) users whose IDs are no longer included in corresponding ListUsers calls. Currently in the API response there is no indication or way to tell which of the returned users are valid API objects that can be used in further API calls and which will result in errors...

However, in the underlying JSON there is an (undocumented) deleted_at key that would be very useful to expose to golang callers to allow filtering of the returned list of users - however because DeletedAt is not present in the APIObject struct this information is currently lost and unusable by consumers of the golang API.