Commit 66cb30b2 authored by jaapjansma's avatar jaapjansma
Browse files

Merge branch 'extend_api' into 'master'

more api items

See merge request extensions/civirules!26
parents c6f818b0 6a605382
<?php
use CRM_Civirules_ExtensionUtil as E;
/**
* CiviRuleRuleAction.Create API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
*/
function _civicrm_api3_civi_rule_rule_action_Create_spec(&$spec) {
$spec['rule_id']['api.required'] = 1;
$spec['action_id']['api.required'] = 1;
$spec['action_params']['api.required'] = 0;
}
/**
* CiviRuleRuleAction.Create API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_civi_rule_rule_action_Create($params) {
$returnValues = CRM_Civirules_BAO_RuleAction::add($params);
$keyedReturnValues = [$returnValues['id']=>$returnValues];
return civicrm_api3_create_success($keyedReturnValues, $params, 'CiviRuleRuleAction', 'Create');
}
<?php
use CRM_Civirules_ExtensionUtil as E;
/**
* CiviRuleRuleAction.Delete API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
*/
function _civicrm_api3_civi_rule_rule_action_Delete_spec(&$spec) {
$spec['id']['api.required'] = 1;
}
/**
* CiviRuleRuleAction.Delete API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_civi_rule_rule_action_Delete($params) {
$id = $params['id'];
CRM_Civirules_BAO_RuleAction::deleteWithId($id);
return civicrm_api3_create_success(1, $params, 'CiviRuleRuleAction', 'delete');
}
<?php
use CRM_Civirules_ExtensionUtil as E;
/**
* CiviRuleRuleAction.Get API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_civi_rule_rule_action_Get($params) {
$returnValues = CRM_Civirules_BAO_RuleAction::getValues($params);
return civicrm_api3_create_success($returnValues, $params, 'CiviRuleRule', 'Get');
}
<?php
use CRM_Civirules_ExtensionUtil as E;
/**
* CiviRuleRuleCondition.Create API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
*/
function _civicrm_api3_civi_rule_rule_condition_Create_spec(&$spec) {
$spec['rule_id']['api.required'] = 1;
$spec['condition_id']['api.required'] =1;
$spec['condition_params']['api.required'] = 0;
}
/**
* CiviRuleRuleCondition.Create API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_civi_rule_rule_condition_Create($params) {
$returnValues = CRM_Civirules_BAO_RuleCondition::add($params);
$keyedReturnValues = [$returnValues['id']=>$returnValues];
return civicrm_api3_create_success($keyedReturnValues, $params,'CiviRuleRuleCondition', 'create');
}
<?php
use CRM_Civirules_ExtensionUtil as E;
/**
* CiviRuleRuleAction.Delete API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
*/
function _civicrm_api3_civi_rule_rule_condition_Delete_spec(&$spec) {
$spec['id']['api.required'] = 1;
}
/**
* CiviRuleRuleCondition.Delete API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
*/
function civicrm_api3_civi_rule_rule_condition_Delete($params) {
$id = $params['id'];
CRM_Civirules_BAO_RuleCondition::deleteWithId($id);
return civicrm_api3_create_success(1, $params, 'CiviRuleRuleCondition', 'delete');
}
<?php
use CRM_Civirules_ExtensionUtil as E;
/**
* CiviRuleRuleCondition.Get API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
*/
function _civicrm_api3_civi_rule_rule_condition_Get_spec(&$spec) {
}
/**
* CiviRuleRuleCondition.Get API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_civi_rule_rule_condition_Get($params) {
$returnValues = CRM_Civirules_BAO_RuleCondition::getValues($params);
return civicrm_api3_create_success($returnValues, $params, 'CiviRuleRule', 'Get');
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment