feat: add multi-status ticket lookup and site meta removal#24
feat: add multi-status ticket lookup and site meta removal#24L0RD-ZER0 wants to merge 2 commits into
Conversation
- Add ResponseTicketsClient.get_multi_status() to fetch the status of multiple response tickets in a single request - Switch ticket summary/full endpoints from GET with path params to POST with form data, matching the API contract - Add SitesClient.remove_meta() to remove a single metadata key for a site
|
|
||
| _, identifier = self._get_service_and_identifier(site_id, domain) | ||
| endpoint = f"/site-meta/{identifier}/{key}/remove" | ||
| return self._post(endpoint) |
There was a problem hiding this comment.
remove_meta is the only "remove" in the SDK that uses POST — client.remove_meta and remove_alias both use GET. The site-meta endpoint's POST body marks value as required (its documented 400 includes "missing value"), so a POST here with no value risks a 400. The GET variant of /site-meta/{site}/{key}/{action} needs no body and supports the remove action, so use GET to match the sibling methods:
| return self._post(endpoint) | |
| return self._get(endpoint) |
| """ | ||
| Gets the status of multiple response tickets in a single request. | ||
|
|
||
| Args: | ||
| ticket_ids: A list of response ticket IDs. | ||
| Returns: | ||
| A dictionary containing the status of multiple tickets. | ||
| """ |
There was a problem hiding this comment.
Fixed in caa781f — added the blank line before Returns: and indented the description to match the other docstrings.
| endpoint = f"/response-ticket/multi-status" | ||
|
|
||
| return self._post(endpoint, data=[("response-tickets[]", _) for _ in ticket_ids]) No newline at end of file |
There was a problem hiding this comment.
Fixed in caa781f — dropped the needless f-string prefixes and switched the payload to data={"response-tickets[]": ticket_ids}. requests form-encodes a list value as repeated keys, so the wire format is unchanged while matching the dict payload shape used elsewhere in this module.
| endpoint = f"/site-meta/{identifier}/{key}/update" | ||
| return self._post(endpoint, data={"value": value}) | ||
|
|
||
| def remove_meta(self, key: str, site_id: Optional[int] = None, domain: Optional[str] = None) -> dict: |
There was a problem hiding this comment.
Leaving this as dict intentionally — the immediate siblings update_meta and remove_alias in this file also return plain dict, so changing only remove_meta would reduce local consistency. A file-wide annotation cleanup would be better done separately.
- Use GET for site remove_meta to match other remove endpoints - Fix get_multi_status docstring formatting - Use dict payload and drop needless f-strings in response tickets
Arittra-Bag
left a comment
There was a problem hiding this comment.
Reviewed the latest diff along with the existing inline feedback. The response-ticket methods and site metadata removal now match the WP Cloud API contract. I also verified the request shapes with focused smoke tests. No blocking issues from my side.
This pull request updates the
atomic_sdkAPI client with several improvements to the response tickets and sites modules. The main changes include switching certain ticket retrieval endpoints from GET to POST requests, introducing a new method for batch ticket status retrieval, and adding the ability to remove site metadata.Response Ticket API improvements:
get_summaryandget_fullmethods inresponse_tickets.pyto use POST requests with the ticket ID in the request body instead of GET requests with the ID in the URL. [1] [2]get_multi_statusmethod to retrieve the status of multiple response tickets in a single POST request.Site Metadata management:
remove_metamethod tosites.pyfor removing a single metadata key from a site by site ID or domain.