INFRA-132 - Fix spacing of @return tag in comments
[civicrm-core.git] / api / v3 / Email.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.6 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2014 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /**
30 * File for the CiviCRM APIv3 email functions
31 *
32 * @package CiviCRM_APIv3
33 * @subpackage API_Email
34 *
35 * @copyright CiviCRM LLC (c) 2004-2014
36 * @version $Id: Email.php 2011-02-16 ErikHommel $
37 */
38
39 /**
40 * Add an Email for a contact
41 *
42 * Allowed @params array keys are:
43 *
44 * @example EmailCreate.php Standard Create Example
45 *
46 * @param array $params
47 *
48 * @return array
49 * API result array
50 * {@getfields email_create}
51 * @access public
52 */
53 function civicrm_api3_email_create($params) {
54 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
55 }
56
57 /**
58 * Adjust Metadata for Create action
59 *
60 * The metadata is used for setting defaults, documentation & validation
61 * @param array $params
62 * Array or parameters determined by getfields.
63 */
64 function _civicrm_api3_email_create_spec(&$params) {
65 // TODO a 'clever' default should be introduced
66 $params['is_primary']['api.default'] = 0;
67 $params['email']['api.required'] = 1;
68 $params['contact_id']['api.required'] = 1;
69 }
70
71 /**
72 * Deletes an existing Email
73 *
74 * @param array $params
75 *
76 * @example EmailDelete.php Standard Delete Example
77 *
78 * @return boolean
79 * | error true if successfull, error otherwise
80 * {@getfields email_delete}
81 * @access public
82 */
83 function civicrm_api3_email_delete($params) {
84 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
85 }
86
87 /**
88 * Retrieve one or more emails
89 *
90 * @param array input parameters
91 *
92 *
93 * @example EmailGet.php Standard Get Example
94 *
95 * @param array $params
96 * An associative array of name/value pairs.
97 *
98 * @return array
99 * api result array
100 * {@getfields email_get}
101 * @access public
102 */
103 function civicrm_api3_email_get($params) {
104
105 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
106 }