Merge pull request #18980 from christianwach/lab-core-1931
[civicrm-core.git] / api / v3 / DashboardContact.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * This api exposes CiviCRM dashboard contacts.
14 *
15 * @package CiviCRM_APIv3
16 */
17
18 /**
19 * Creates/Updates a new Dashboard Contact Entry.
20 *
21 * @param array $params
22 *
23 * @return array
24 */
25 function civicrm_api3_dashboard_contact_create($params) {
26 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'DashboardContact');
27 }
28
29 /**
30 * Gets a CiviCRM Dashlets of Contacts according to parameters.
31 *
32 * @param array $params
33 * Array per getfields metadata.
34 *
35 * @return array
36 */
37 function civicrm_api3_dashboard_contact_get($params) {
38 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
39 }
40
41 /**
42 * Adjust Metadata for Create action.
43 *
44 * The metadata is used for setting defaults, documentation & validation.
45 *
46 * @param array $fields
47 * Array of fields determined by getfields.
48 */
49 function _civicrm_api3_dashboard_contact_create_spec(&$fields) {
50 $fields['dashboard_id']['api.required'] = TRUE;
51 }
52
53 /**
54 * Delete an existing dashboard-contact.
55 *
56 * @param array $params
57 *
58 * @return array
59 * @throws \API_Exception
60 */
61 function civicrm_api3_dashboard_contact_delete($params) {
62 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
63 }