3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM IM records.
15 * @package CiviCRM_APIv3
19 * Add an IM for a contact.
21 * @param array $params
25 function civicrm_api3_im_create($params) {
26 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'Im');
30 * Adjust Metadata for Create action.
32 * The metadata is used for setting defaults, documentation & validation.
34 * @param array $params
35 * Array of parameters determined by getfields.
37 function _civicrm_api3_im_create_spec(&$params) {
38 $params['contact_id']['api.required'] = 1;
39 $defaultLocation = CRM_Core_BAO_LocationType
::getDefault();
40 if ($defaultLocation) {
41 $params['location_type_id']['api.default'] = $defaultLocation->id
;
46 * Deletes an existing IM.
48 * @param array $params
53 function civicrm_api3_im_delete($params) {
54 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
58 * Retrieve one or more IM.
60 * @param array $params
61 * An associative array of name/value pairs.
66 function civicrm_api3_im_get($params) {
67 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);