Commit | Line | Data |
---|---|---|
a219d9b1 TM |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
a219d9b1 | 5 | | | |
a30c801b TO |
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 | | |
a219d9b1 TM |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * This api exposes CiviCRM OpenID records. | |
14 | * | |
15 | * @package CiviCRM_APIv3 | |
16 | */ | |
17 | ||
18 | /** | |
19 | * Add an OpenID for a contact. | |
20 | * | |
21 | * @param array $params | |
22 | * | |
23 | * @return array | |
00f8641b | 24 | * API result array |
a219d9b1 | 25 | */ |
533c7496 | 26 | function civicrm_api3_open_i_d_create($params) { |
a25b46e9 | 27 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OpenID'); |
a219d9b1 TM |
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 | */ | |
533c7496 | 38 | function _civicrm_api3_open_i_d_create_spec(&$params) { |
a219d9b1 | 39 | $params['contact_id']['api.required'] = 1; |
0e70279a AS |
40 | $defaultLocation = CRM_Core_BAO_LocationType::getDefault(); |
41 | if ($defaultLocation) { | |
42 | $params['location_type_id']['api.default'] = $defaultLocation->id; | |
43 | } | |
a219d9b1 TM |
44 | } |
45 | ||
46 | /** | |
47 | * Deletes an existing OpenID. | |
48 | * | |
49 | * @param array $params | |
50 | * | |
51 | * @return array | |
00f8641b | 52 | * API result array |
a219d9b1 | 53 | */ |
533c7496 | 54 | function civicrm_api3_open_i_d_delete($params) { |
a219d9b1 TM |
55 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); |
56 | } | |
57 | ||
58 | /** | |
59 | * Retrieve one or more OpenID. | |
60 | * | |
61 | * @param array $params | |
62 | * An associative array of name/value pairs. | |
63 | * | |
64 | * @return array | |
00f8641b | 65 | * API result array |
a219d9b1 | 66 | */ |
533c7496 | 67 | function civicrm_api3_open_i_d_get($params) { |
a219d9b1 TM |
68 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); |
69 | } |