Minor tidyup of api3 completetransaction; plus comments
[civicrm-core.git] / api / v3 / UFMatch.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 user framework match.
14 *
15 * @package CiviCRM_APIv3
16 */
17
18 /**
19 * Get the contact_id given a uf_id or vice versa.
20 *
21 * @param array $params
22 *
23 * @return array
24 */
25 function civicrm_api3_uf_match_get($params) {
26 return _civicrm_api3_basic_get('CRM_Core_BAO_UFMatch', $params);
27 }
28
29 /**
30 * Create or update a UF Match record.
31 *
32 * @param array $params
33 * Array per getfields metadata.
34 *
35 * @return array
36 * Api result array
37 */
38 function civicrm_api3_uf_match_create($params) {
39 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'UFMatch');
40 }
41
42 /**
43 * Adjust Metadata for Create action.
44 *
45 * The metadata is used for setting defaults, documentation & validation.
46 *
47 * @param array $params
48 * Array of parameters determined by getfields.
49 */
50 function _civicrm_api3_uf_match_create_spec(&$params) {
51 $params['contact_id']['api.required'] = 1;
52 $params['uf_id']['api.required'] = 1;
53 $params['uf_name']['api.required'] = 1;
54 }
55
56 /**
57 * Delete a UF Match record.
58 *
59 * @param array $params
60 *
61 * @return array
62 * Api result array.
63 */
64 function civicrm_api3_uf_match_delete($params) {
65 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
66 }