lucasheld / uptime-kuma-api

A Python wrapper for the Uptime Kuma Socket.IO API
https://uptime-kuma-api.readthedocs.io
MIT License
269 stars 20 forks source link

Missing return element in `api.delete_status_page` #53

Closed Zerka30 closed 1 year ago

Zerka30 commented 1 year ago

Hey :wave:

Has api.delete_monitor(monitor_id) is returning :

{
    "msg": "Deleted sucessfully"
}

The same should apply to api.delete_status_page(slug)

Is there a constraint on this, so that this is not the case?

And for consistency in the API, I think api.delete_status_page() should take the status page ID as a parameter, not the slug

lucasheld commented 1 year ago

api.delete_status_page(slug) also returns the response: https://github.com/lucasheld/uptime-kuma-api/blob/ba047114c933a9f5d2701376505b5600591d0cb7/uptime_kuma_api/api.py#L2068

But for some reason Uptime Kuma does not send a message when a status page is deleted: https://github.com/louislam/uptime-kuma/blob/c4e222d1e6bc3846d6672368ae30301a796fa39e/server/socket-handlers/status-page-socket-handler.js#L338

When a monitor is deleted, the message is sent: https://github.com/louislam/uptime-kuma/blob/c4e222d1e6bc3846d6672368ae30301a796fa39e/server/server.js#L958


That's right, status pages need the slug, but all other objects need the id. The reason for this is that it is also handled this way by Uptime Kuma. I decided not to use the id as parameter, because otherwise another query would be necessary to find out which slug is assigned to the id.

https://github.com/louislam/uptime-kuma/blob/c4e222d1e6bc3846d6672368ae30301a796fa39e/server/server.js#L931

https://github.com/louislam/uptime-kuma/blob/c4e222d1e6bc3846d6672368ae30301a796fa39e/server/socket-handlers/status-page-socket-handler.js#L299