3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
13 * APIv3 functions for registering/processing mailing group events.
15 * @package CiviCRM_APIv3
19 * Handle a queue event.
21 * @param array $params
28 function civicrm_api3_mailing_event_queue_create($params) {
29 if (!array_key_exists('id', $params) && !array_key_exists('email_id', $params) && !array_key_exists('phone_id', $params)) {
30 throw new API_Exception("Mandatory key missing from params array: id, email_id, or phone_id field is required");
32 civicrm_api3_verify_mandatory($params,
33 'CRM_Mailing_DAO_MailingJob',
34 ['job_id', 'contact_id'],
37 return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params, 'Queue');
41 * Get mailing event queue record.
43 * @param array $params
47 function civicrm_api3_mailing_event_queue_get($params) {
48 return _civicrm_api3_basic_get('CRM_Mailing_Event_BAO_Queue', $params);
52 * Delete mailing event queue record.
54 * @param array $params
57 * @throws \API_Exception
59 function civicrm_api3_mailing_event_queue_delete($params) {
60 return _civicrm_api3_basic_delete('CRM_Mailing_Event_BAO_Queue', $params);
64 * Adjust Metadata for Create action.
66 * The metadata is used for setting defaults, documentation & validation.
68 * @param array $params
69 * Array of parameters determined by getfields.
71 function _civicrm_api3_mailing_event_queue_create_spec(&$params) {
72 $params['job_id']['api.required'] = 1;
73 $params['contact_id']['api.required'] = 1;