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 premiums.
15 * Premiums are used as incentive gifts on contribution pages.
16 * Premiums contain "Products" which has a separate api.
17 * Use chaining to create a premium and related products in one api call.
19 * @package CiviCRM_APIv3
25 * @param array $params
27 * @throws API_Exception
30 function civicrm_api3_premium_create($params) {
31 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'Premium');
37 * @param array $params
40 * Array of retrieved premium property values.
42 function civicrm_api3_premium_get($params) {
43 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
49 * @param array $params
51 * @throws API_Exception
53 * Array of deleted values.
55 function civicrm_api3_premium_delete($params) {
56 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
60 * Return field specification specific to get requests.
62 * @param array $params
64 function _civicrm_api3_premium_get_spec(&$params) {
65 $params['premiums_active']['api.aliases'] = ['is_active'];
69 * Return field specification specific to create requests.
71 * @param array $params
73 function _civicrm_api3_premium_create_spec(&$params) {
74 $params['premiums_active']['api.aliases'] = ['is_active'];