Merge pull request #9769 from scardinius/crm-19958
[civicrm-core.git] / api / v3 / MailingGroup.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
81621fee 4 | CiviCRM version 4.7 |
6a488035 5 +--------------------------------------------------------------------+
1f4ea726 6 | Copyright CiviCRM LLC (c) 2004-2017 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
6a488035
TO
29 * APIv3 functions for registering/processing mailing group events.
30 *
c28e1768 31 * @deprecated
6a488035 32 * @package CiviCRM_APIv3
6a488035
TO
33 */
34
a14e9d08 35/**
22242c87
EM
36 * Declare deprecated functions.
37 *
a14e9d08 38 * @deprecated api notice
a6c01b45 39 * @return string
72b3a70c 40 * to indicate this entire api entity is deprecated
a14e9d08
CW
41 */
42function _civicrm_api3_mailing_group_deprecation() {
a8b7230d
TO
43 $message = 'This action is deprecated. Use the mailing_event API instead.';
44 return array(
45 'event_unsubscribe' => $message,
46 'event_domain_unsubscribe' => $message,
47 'event_resubscribe' => $message,
48 'event_subscribe' => $message,
49 );
a14e9d08
CW
50}
51
6a488035 52/**
9d32e6f7
EM
53 * Handle an unsubscribe event.
54 *
6a488035
TO
55 * @deprecated
56 *
57 * @param array $params
58 *
59 * @return array
60 */
61function civicrm_api3_mailing_group_event_unsubscribe($params) {
7e6e8bd6 62 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
6a488035
TO
63}
64
65/**
9d32e6f7
EM
66 * Handle a site-level unsubscribe event.
67 *
bafd17fb 68 * @deprecated
6a488035
TO
69 *
70 * @param array $params
71 *
72 * @return array
73 */
74function civicrm_api3_mailing_group_event_domain_unsubscribe($params) {
7e6e8bd6
TO
75 $params['org_unsubscribe'] = 1;
76 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
6a488035
TO
77}
78
79/**
d1b0d05e
EM
80 * Handle a re-subscription event.
81 *
6a488035
TO
82 * @deprecated
83 *
84 * @param array $params
85 *
86 * @return array
87 */
88function civicrm_api3_mailing_group_event_resubscribe($params) {
7e6e8bd6 89 return civicrm_api('mailing_event_resubscribe', 'create', $params);
6a488035
TO
90}
91
92/**
dc64d047
EM
93 * Handle a subscription event.
94 *
6a488035
TO
95 * @deprecated
96 *
97 * @param array $params
98 *
99 * @return array
100 */
101function civicrm_api3_mailing_group_event_subscribe($params) {
7e6e8bd6 102 return civicrm_api('mailing_event_subscribe', 'create', $params);
6a488035
TO
103}
104
c23f45d3 105/**
dc64d047
EM
106 * Create mailing group.
107 *
c23f45d3 108 * @param array $params
dc64d047 109 *
c23f45d3
EM
110 * @return array
111 * @throws \API_Exception
112 */
21eb0c57
TO
113function civicrm_api3_mailing_group_create($params) {
114 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
115}
116
aa1b1481 117/**
dc64d047
EM
118 * Get mailing group.
119 *
c490a46a 120 * @param array $params
aa1b1481
EM
121 *
122 * @return array
123 */
f27a0a8e 124function civicrm_api3_mailing_group_get($params) {
125 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
126}
127
c23f45d3 128/**
22242c87
EM
129 * Delete mailing group.
130 *
c23f45d3 131 * @param array $params
22242c87 132 *
c23f45d3
EM
133 * @return array
134 * @throws \API_Exception
135 */
136function civicrm_api3_mailing_group_delete($params) {
f27a0a8e 137 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
138}