ZettaIO / cachet-client

A python 3.6+ client for the Cachet API : https://cachet-client.readthedocs.io/
MIT License
14 stars 8 forks source link

Support searching and sorting #6

Open einarf opened 5 years ago

einarf commented 5 years ago

Some notes on searching is mentioned in the advanced section: https://docs.cachethq.io/docs/advanced-api-usage#section-searching

What fields support sort and order is not well documented. Needs more investigation looking at the source.

einarf commented 5 years ago

API Views we need to look at: https://github.com/CachetHQ/Cachet/tree/2.4/app/Http/Controllers/Api

sedan07 commented 3 years ago

Started working on this feature as I needed the search functionality. However it appears the search functionality is broken in Cachet 2.3 when applied with pagination, same applies to 2.4..

With a patched version of 2.3 or the forked and continued version 2.5 the following code enables searching Incidents and Components: https://github.com/fiveai/cachet-client/tree/support-searchable-list-query

Not sure if this is the best way to approach this? Any thoughts and pointers would be appreciated.

einarf commented 3 years ago

This explains quite a bit. I did play around with this for a bit and ran into some trouble as well. I think the sorting works ok (for the supported fields). Searching is another story. Would it maybe make sense to have a Filter instead of a Searchable to support both sorting and searching? (or possibly separate classes)

It really is a puzzle sometimes when trying to get these things running with all cachet versions. How something ends up is almost related to these limitations. I was really just planning to add some keyword arguments myself and experiment with what was possible in 2.3 and 2.4+ before making it more fancy.