Skip to content

feat(api): add CronClient for /crontab endpoints#17

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-cron-resource-for-crontab-endpoints
Draft

feat(api): add CronClient for /crontab endpoints#17
Copilot wants to merge 2 commits intomainfrom
copilot/add-cron-resource-for-crontab-endpoints

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 29, 2026

Adds CronClient to cover the three previously unwrapped /crontab/{site}/* endpoints, modelled on edge_cache.py.

New: atomic_sdk/api/cron.py

  • list(site_id|domain)GET /crontab/{site}/list
  • add(schedule, command, site_id|domain)POST /crontab/{site}/add; raises ValueError on empty schedule or command
  • remove(cron_id, site_id|domain)POST /crontab/{site}/remove
  • find(cron_id=…|command=…, site_id|domain) — client-side filter over list()
  • clear(site_id|domain)destructive list+remove-all; returns removed IDs

All methods raise ValueError when neither site_id nor domain is provided. 4xx/5xx errors surface via inherited _request translation — no bespoke try/except.

Schedule semantics and platform constraints (8 h max runtime, no stacking, 3-concurrent limit, site-cron-results webhook on failure) are documented in docstrings.

atomic_sdk/client.py

CronClient imported and attached as self.cron, alphabetically between client and custom_certificates.

examples/cron/01_manage_cron.py

entries = client.cron.list(domain="example.com")
result  = client.cron.add(schedule="hourly", command="wp cron event run --due-now", domain="example.com")
entry   = client.cron.find(cron_id=result["cron_id"], domain="example.com")
client.cron.remove(cron_id=result["cron_id"], domain="example.com")

Both examples/README.md and the top-level README.md updated to include Cron in the supported-resources list.

Copilot AI linked an issue Apr 29, 2026 that may be closed by this pull request
6 tasks
Copilot AI changed the title [WIP] Add CronClient resource for /crontab endpoints feat(api): add CronClient for /crontab endpoints Apr 29, 2026
Copilot AI requested a review from rtBot April 29, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(api): add Cron resource for /crontab endpoints

2 participants