As far as I can understand, the way to add a job is to set it up in your extension as an API.
So I have created the default code using
civix generate:api --schedule=Daily Contact myendpoint
Enabled the extention and it appears in the API Explorer
But when I run it
cv api Contact.myendpoint debug=1
it fails
{
"error_code": "not-found",
"entity": "Contact",
"action": "myendpoint",
"trace": "#0 /var/www/html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(166): Civi\\API\\Kernel->resolve(Array)\n#1 /var/www/html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(100): Civi\\API\\Kernel->runRequest(Array)\n#2 /var/www/html/wp-content/plugins/civicrm/civicrm/api/api.php(23): Civi\\API\\Kernel->runSafe('Contact', 'myendpoint', Array, NULL)\n#3 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php(311): civicrm_api('Contact', 'myendpoint', Array)\n#4 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php(548): CRM_Utils_REST::process(Array, Array)\n#5 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(275): CRM_Utils_REST::ajax()\n#6 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem(Array)\n#7 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke(Array)\n#8 /var/www/html/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke(Array)\n#9 /var/www/html/wp-includes/class-wp-hook.php(286): CiviCRM_For_WordPress->invoke('')\n#10 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)\n#11 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)\n#12 /var/www/html/wp-admin/admin.php(224): do_action('toplevel_page_C...')\n#13 {main}",
"is_error": 1,
"error_message": "API (Contact, myendpoint) does not exist (join the API team and implement it!)"
}
So it looks like I'm missing a step somewhere - but can't find it in the docs .. any help?