(NFC) (dev/core#878) Simplify copyright header (api/*)
[civicrm-core.git] / api / v3 / Pcp.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
11 */
12
13 /**
14 * This api exposes CiviCRM PCP records.
15 *
16 *
17 * @package CiviCRM_APIv3
18 */
19
20 /**
21 * Create or update a survey.
22 *
23 * @param array $params
24 * Array per getfields metadata.
25 *
26 * @return array api result array
27 */
28 function civicrm_api3_pcp_create($params) {
29 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Pcp');
30 }
31
32 /**
33 * Adjust Metadata for Create action.
34 *
35 * The metadata is used for setting defaults, documentation & validation.
36 *
37 * @param array $params
38 * Array of parameters determined by getfields.
39 */
40 function _civicrm_api3_pcp_create_spec(&$params) {
41 $params['title']['api.required'] = 1;
42 $params['contact_id']['api.required'] = 1;
43 $params['page_id']['api.required'] = 1;
44 $params['pcp_block_id']['api.required'] = 1;
45 }
46
47 /**
48 * Returns array of pcps matching a set of one or more properties.
49 *
50 * @param array $params
51 * Array per getfields
52 *
53 * @return array Array of matching pcps
54 */
55 function civicrm_api3_pcp_get($params) {
56 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Pcp');
57 }
58
59 /**
60 * Delete an existing PCP.
61 *
62 * This method is used to delete any existing PCP given its id.
63 *
64 * @param array $params
65 * [id]
66 *
67 * @return array api result array
68 */
69 function civicrm_api3_pcp_delete($params) {
70 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
71 }