Merge pull request #17376 from artfulrobot/artfulrobot-public-status-messages
[civicrm-core.git] / api / v3 / Country.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 country.
14 *
15 * @package CiviCRM_APIv3
16 */
17
18 /**
19 * Add an Country for a contact.
20 *
21 * @param array $params
22 * Array per getfields metadata.
23 *
24 * @return array
25 * API result array
26 * @throws \API_Exception
27 */
28 function civicrm_api3_country_create($params) {
29 return _civicrm_api3_basic_create(_civicrm_api3_get_DAO(__FUNCTION__), $params, 'Country');
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_country_create_spec(&$params) {
41 $params['name']['api.required'] = 1;
42 }
43
44 /**
45 * Deletes an existing Country.
46 *
47 * @param array $params
48 *
49 * @return array
50 */
51 function civicrm_api3_country_delete($params) {
52 return _civicrm_api3_basic_delete(_civicrm_api3_get_DAO(__FUNCTION__), $params);
53 }
54
55 /**
56 * Retrieve one or more countryies.
57 *
58 * @param array $params
59 * Array per getfields metadata.
60 *
61 * @return array
62 * api result array
63 */
64 function civicrm_api3_country_get($params) {
65
66 return _civicrm_api3_basic_get(_civicrm_api3_get_DAO(__FUNCTION__), $params);
67 }