| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 6 | | This work is published under the GNU AGPLv3 license with some | |
| 7 | | permitted exceptions and without any warranty. For full license | |
| 8 | | and copyright information, see https://civicrm.org/licensing | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * |
| 14 | * APIv3 functions for registering/processing mailing jobs. |
| 15 | * |
| 16 | * @package CiviCRM_APIv3 |
| 17 | */ |
| 18 | |
| 19 | /** |
| 20 | * Handle creation of a MailingJob for a Mailing. |
| 21 | * |
| 22 | * @param array $params |
| 23 | * |
| 24 | * @return array |
| 25 | * @throws \API_Exception |
| 26 | */ |
| 27 | function civicrm_api3_mailing_job_create($params) { |
| 28 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingJob'); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Adjust Metadata for Create action. |
| 33 | * |
| 34 | * The metadata is used for setting defaults, documentation & validation. |
| 35 | * |
| 36 | * @param array $params |
| 37 | * Array of parameters determined by getfields. |
| 38 | */ |
| 39 | function _civicrm_api3_mailing_job_create_spec(&$params) { |
| 40 | $params['status']['api.default'] = 'Scheduled'; |
| 41 | $params['scheduled_date']['api.default'] = 'now'; |
| 42 | $params['is_test']['api.default'] = 0; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Returns array of Mailing Jobs matching a set of one or more group properties. |
| 47 | * |
| 48 | * @param array $params |
| 49 | * |
| 50 | * @return array |
| 51 | * API return Array of matching mailing jobs. |
| 52 | */ |
| 53 | function civicrm_api3_mailing_job_get($params) { |
| 54 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingJob'); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Handle deletion of a Mailing Job for a Mailing. |
| 59 | * |
| 60 | * @param array $params |
| 61 | * |
| 62 | * @return array |
| 63 | * @throws \API_Exception |
| 64 | */ |
| 65 | function civicrm_api3_mailing_job_delete($params) { |
| 66 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingJob'); |
| 67 | } |