Merge pull request #17840 from seamuslee001/5272_rns
[civicrm-core.git] / api / v3 / MailingGroup.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/**
6a488035
TO
13 * APIv3 functions for registering/processing mailing group events.
14 *
c28e1768 15 * @deprecated
6a488035 16 * @package CiviCRM_APIv3
6a488035
TO
17 */
18
a14e9d08 19/**
22242c87
EM
20 * Declare deprecated functions.
21 *
a14e9d08 22 * @deprecated api notice
a6c01b45 23 * @return string
72b3a70c 24 * to indicate this entire api entity is deprecated
a14e9d08
CW
25 */
26function _civicrm_api3_mailing_group_deprecation() {
a8b7230d 27 $message = 'This action is deprecated. Use the mailing_event API instead.';
cf8f0fff 28 return [
a8b7230d
TO
29 'event_unsubscribe' => $message,
30 'event_domain_unsubscribe' => $message,
31 'event_resubscribe' => $message,
32 'event_subscribe' => $message,
cf8f0fff 33 ];
a14e9d08
CW
34}
35
6a488035 36/**
9d32e6f7
EM
37 * Handle an unsubscribe event.
38 *
6a488035
TO
39 * @deprecated
40 *
41 * @param array $params
42 *
43 * @return array
44 */
45function civicrm_api3_mailing_group_event_unsubscribe($params) {
7e6e8bd6 46 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
6a488035
TO
47}
48
49/**
9d32e6f7
EM
50 * Handle a site-level unsubscribe event.
51 *
bafd17fb 52 * @deprecated
6a488035
TO
53 *
54 * @param array $params
55 *
56 * @return array
57 */
58function civicrm_api3_mailing_group_event_domain_unsubscribe($params) {
7e6e8bd6
TO
59 $params['org_unsubscribe'] = 1;
60 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
6a488035
TO
61}
62
63/**
d1b0d05e
EM
64 * Handle a re-subscription event.
65 *
6a488035
TO
66 * @deprecated
67 *
68 * @param array $params
69 *
70 * @return array
71 */
72function civicrm_api3_mailing_group_event_resubscribe($params) {
7e6e8bd6 73 return civicrm_api('mailing_event_resubscribe', 'create', $params);
6a488035
TO
74}
75
76/**
dc64d047
EM
77 * Handle a subscription event.
78 *
6a488035
TO
79 * @deprecated
80 *
81 * @param array $params
82 *
83 * @return array
84 */
85function civicrm_api3_mailing_group_event_subscribe($params) {
7e6e8bd6 86 return civicrm_api('mailing_event_subscribe', 'create', $params);
6a488035
TO
87}
88
c23f45d3 89/**
dc64d047
EM
90 * Create mailing group.
91 *
c23f45d3 92 * @param array $params
dc64d047 93 *
c23f45d3
EM
94 * @return array
95 * @throws \API_Exception
96 */
21eb0c57
TO
97function civicrm_api3_mailing_group_create($params) {
98 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
99}
100
aa1b1481 101/**
dc64d047
EM
102 * Get mailing group.
103 *
c490a46a 104 * @param array $params
aa1b1481
EM
105 *
106 * @return array
107 */
f27a0a8e 108function civicrm_api3_mailing_group_get($params) {
109 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
110}
111
c23f45d3 112/**
22242c87
EM
113 * Delete mailing group.
114 *
c23f45d3 115 * @param array $params
22242c87 116 *
c23f45d3
EM
117 * @return array
118 * @throws \API_Exception
119 */
120function civicrm_api3_mailing_group_delete($params) {
f27a0a8e 121 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
122}