Merge pull request #19307 from eileenmcnaughton/534
[civicrm-core.git] / api / v3 / ActivityContact.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 the CiviCRM ActivityContact join table.
14 *
15 * @package CiviCRM_APIv3
16 */
17
18 /**
19 * Add a record relating a contact with an activity.
20 *
21 * @param array $params
22 *
23 * @return array
24 * API result array.
25 */
26 function civicrm_api3_activity_contact_create($params) {
27 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActivityContact');
28 }
29
30 /**
31 * Adjust Metadata for Create action.
32 *
33 * The metadata is used for setting defaults, documentation & validation.
34 *
35 * @param array $params
36 * Array of parameters determined by getfields.
37 */
38 function _civicrm_api3_activity_contact_create_spec(&$params) {
39 $params['contact_id']['api.required'] = 1;
40 $params['activity_id']['api.required'] = 1;
41 }
42
43 /**
44 * Delete an existing ActivityContact record.
45 *
46 * @param array $params
47 *
48 * @return array
49 * API result array
50 */
51 function civicrm_api3_activity_contact_delete($params) {
52 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
53 }
54
55 /**
56 * Get a ActivityContact.
57 *
58 * @param array $params
59 * An associative array of name/value pairs.
60 *
61 * @return array
62 * API result array
63 */
64 function civicrm_api3_activity_contact_get($params) {
65 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
66 }