Minor tidyup of api3 completetransaction; plus comments
[civicrm-core.git] / api / v3 / GroupNesting.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
a30c801b 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 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 |
6a488035
TO
9 +--------------------------------------------------------------------+
10 */
11
12/**
244bbdd8 13 * This api exposes CiviCRM GroupNesting.
6a488035 14 *
b081365f 15 * This defines parent/child relationships between nested groups.
6a488035 16 *
b081365f 17 * @package CiviCRM_APIv3
6a488035
TO
18 */
19
6a488035
TO
20/**
21 * Provides group nesting record(s) given parent and/or child id.
22 *
cf470720
TO
23 * @param array $params
24 * An array containing at least child_group_id or parent_group_id.
6a488035 25 *
a6c01b45 26 * @return array
72b3a70c 27 * list of group nesting records
6a488035
TO
28 */
29function civicrm_api3_group_nesting_get($params) {
6a488035
TO
30 return _civicrm_api3_basic_get('CRM_Contact_DAO_GroupNesting', $params);
31}
32
33/**
34 * Creates group nesting record for given parent and child id.
22242c87 35 *
6a488035
TO
36 * Parent and child groups need to exist.
37 *
cf470720
TO
38 * @param array $params
39 * Parameters array - allowed array keys include:.
6a488035 40 *
a6c01b45 41 * @return array
1237d8d7 42 * API success array
6a488035
TO
43 */
44function civicrm_api3_group_nesting_create($params) {
1237d8d7 45 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'GroupNesting');
6a488035 46}
11e09c59
TO
47
48/**
0aa0303c
EM
49 * Adjust Metadata for Create action.
50 *
51 * The metadata is used for setting defaults, documentation & validation.
1c88e578 52 *
cf470720 53 * @param array $params
b081365f 54 * Array of parameters determined by getfields.
6a488035
TO
55 */
56function _civicrm_api3_group_nesting_create_spec(&$params) {
57 $params['child_group_id']['api.required'] = 1;
58 $params['parent_group_id']['api.required'] = 1;
59}
60
61/**
62 * Removes specific nesting records.
63 *
cf470720 64 * @param array $params
6a488035 65 *
a6c01b45 66 * @return array
72b3a70c 67 * API Success or fail array
6a488035
TO
68 *
69 * @todo Work out the return value.
70 */
71function civicrm_api3_group_nesting_delete($params) {
6a488035
TO
72 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
73}