Merge pull request #21235 from seamuslee001/dev_core_2768
[civicrm-core.git] / api / v3 / MailingJob.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
a30c801b 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
a30c801b
TO
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 |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
c28e1768 14 * APIv3 functions for registering/processing mailing jobs.
6a488035
TO
15 *
16 * @package CiviCRM_APIv3
6a488035
TO
17 */
18
6a488035 19/**
244bbdd8 20 * Handle creation of a MailingJob for a Mailing.
22242c87 21 *
d0997921 22 * @param array $params
22242c87 23 *
645ee340
EM
24 * @return array
25 * @throws \API_Exception
6a488035
TO
26 */
27function civicrm_api3_mailing_job_create($params) {
f487e358 28 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingJob');
6a488035
TO
29}
30
11e09c59 31/**
0aa0303c
EM
32 * Adjust Metadata for Create action.
33 *
34 * The metadata is used for setting defaults, documentation & validation.
11e09c59 35 *
cf470720 36 * @param array $params
b081365f 37 * Array of parameters determined by getfields.
11e09c59 38 */
6a488035
TO
39function _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/**
22242c87 46 * Returns array of Mailing Jobs matching a set of one or more group properties.
6a488035 47 *
cf470720 48 * @param array $params
69dbd1ba 49 *
a6c01b45 50 * @return array
795492f3 51 * API return Array of matching mailing jobs.
6a488035 52 */
54f1aa2a 53function civicrm_api3_mailing_job_get($params) {
f487e358 54 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingJob');
6a488035
TO
55}
56
c43d01f3 57/**
58 * Handle deletion of a Mailing Job for a Mailing.
22242c87 59 *
d0997921 60 * @param array $params
22242c87 61 *
645ee340
EM
62 * @return array
63 * @throws \API_Exception
c43d01f3 64 */
65function civicrm_api3_mailing_job_delete($params) {
6f65a84f 66 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingJob');
c43d01f3 67}